From: Rick Bird Date: Fri, 25 Mar 2011 19:10:19 +0000 (-0400) Subject: PennMUSH Incorp 182p3 X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=0ce7bc5489a65ccca685672c18a0672d3abc8d64;p=cobramush.git PennMUSH Incorp 182p3 If we should fail to clear a semaphore attribute for some reason (e.g., it's the branch of an attribute tree), reset the semaphore count on the attribute to 0. Patch by Javelin. --- diff --git a/src/cque.c b/src/cque.c index ffa1e80..48e5343 100644 --- a/src/cque.c +++ b/src/cque.c @@ -167,10 +167,13 @@ add_to_generic(dbref player, int am, const char *name, int flags) if (a) num = parse_integer(atr_value(a)); num += am; - if (num) { - sprintf(buff, "%d", num); - (void) atr_add(player, name, buff, GOD, flags); - } else { + /* We set the attribute's value to 0 even if we're going to clear + * it later, because clearing it may fail (perhaps someone's also + * foolishly using it as a branch in an attribute tree) + */ + sprintf(buff, "%d", num); + (void) atr_add(player, name, buff, GOD, flags); + if (!num) { (void) atr_clr(player, name, GOD); } return (num);