--- deliantra/server/common/button.C 2006/12/26 08:54:58 1.20 +++ deliantra/server/common/button.C 2007/01/09 16:38:23 1.24 @@ -1,6 +1,7 @@ /* CrossFire, A Multiplayer game for X-windows + Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team Copyright (C) 2002 Mark Wedel & Crossfire Development Team Copyright (C) 1992 Frank Tore Johansen @@ -275,38 +276,9 @@ } } -/* - * Updates every button on the map (by calling update_button() for them). - */ - -void -update_buttons (maptile *m) -{ - objectlink *ol; - oblinkpt *obp; - - for (obp = m->buttons; obp; obp = obp->next) - for (ol = obp->link; ol; ol = ol->next) - { - if (!ol->ob) - { - LOG (llevError, "Internal error in update_button (%s (%dx%d), connected %ld).\n", - ol->ob ? (const char *) ol->ob->name : "null", ol->ob ? ol->ob->x : -1, ol->ob ? ol->ob->y : -1, obp->value); - continue; - } - - if (ol->ob->type == BUTTON || ol->ob->type == PEDESTAL) - { - update_button (ol->ob); - break; - } - } -} - void use_trigger (object *op) { - /* Toggle value */ op->value = !op->value; push_button (op); @@ -316,7 +288,6 @@ * Note: animate_object should be used instead of this, * but it can't handle animations in the 8 directions */ - void animate_turning (object *op) /* only one part objects */ { @@ -799,7 +770,6 @@ SET_FLAG (tmp, FLAG_MONSTER); tmp->stats.exp = 0; - SET_FLAG (tmp, FLAG_FRIENDLY); add_friendly_object (tmp); tmp->attack_movement = PETMOVE; @@ -864,6 +834,7 @@ void check_inv (object *op, object *trig) { + sint32 prev_state = trig->value; trig->value = 0; // deactivate if none of the following conditions apply if (object *pl = trig->ms ().player ()) @@ -881,6 +852,7 @@ trig->value = 1; } - push_button (trig); + if (prev_state != trig->value) + push_button (trig); }