From 0ce7bc5489a65ccca685672c18a0672d3abc8d64 Mon Sep 17 00:00:00 2001 From: Rick Bird Date: Fri, 25 Mar 2011 15:10:19 -0400 Subject: [PATCH] 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. --- src/cque.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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); -- 2.30.2