ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/button.C
(Generate patch)

Comparing deliantra/server/common/button.C (file contents):
Revision 1.16 by elmex, Tue Dec 19 15:30:01 2006 UTC vs.
Revision 1.17 by root, Wed Dec 20 09:14:21 2006 UTC

205 * Updates everything connected with the button op. 205 * Updates everything connected with the button op.
206 * After changing the state of a button, this function must be called 206 * After changing the state of a button, this function must be called
207 * to make sure that all gates and other buttons connected to the 207 * to make sure that all gates and other buttons connected to the
208 * button reacts to the (eventual) change of state. 208 * button reacts to the (eventual) change of state.
209 */ 209 */
210
211void 210void
212update_button (object *op) 211update_button (object *op)
213{ 212{
214 object *ab, *tmp, *head; 213 object *ab, *tmp, *head;
215 int tot, any_down = 0, old_value = op->value; 214 int tot, any_down = 0, old_value = op->value;
354 ARCH_SACRIFICE (altar) == sacrifice->name || 353 ARCH_SACRIFICE (altar) == sacrifice->name ||
355 ARCH_SACRIFICE (altar) == sacrifice->slaying || 354 ARCH_SACRIFICE (altar) == sacrifice->slaying ||
356 (!strcmp (ARCH_SACRIFICE (altar), query_base_name (sacrifice, 0)))) 355 (!strcmp (ARCH_SACRIFICE (altar), query_base_name (sacrifice, 0))))
357 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1)) 356 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1))
358 return 1; 357 return 1;
358
359 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0 359 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0
360 && sacrifice->type == MONEY && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar)) 360 && sacrifice->type == MONEY && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar))
361 return 1; 361 return 1;
362 } 362 }
363
363 return 0; 364 return 0;
364} 365}
365 366
366/* 367/*
367 * operate_altar checks if sacrifice was accepted and removes sacrificed 368 * operate_altar checks if sacrifice was accepted and removes sacrificed
792 break; 793 break;
793 case 4: /* charm all monsters */ 794 case 4: /* charm all monsters */
794 if (op == source) 795 if (op == source)
795 break; /* only if 'connected' */ 796 break; /* only if 'connected' */
796 797
797 for (tmp2 = get_map_ob (source->map, source->x, source->y); /* finding an owner */ 798 for (tmp2 = GET_MAP_OB (source->map, source->x, source->y); /* finding an owner */
798 tmp2->type != PLAYER; tmp2 = tmp2->above) 799 tmp2->type != PLAYER; tmp2 = tmp2->above)
799 if (tmp2->above == NULL) 800 if (tmp2->above == NULL)
800 break; 801 break;
801 802
802 if (tmp2->type != PLAYER) 803 if (tmp2->type != PLAYER)
803 break; 804 break;
805
804 tmp->set_owner (tmp2); 806 tmp->set_owner (tmp2);
805 SET_FLAG (tmp, FLAG_MONSTER); 807 SET_FLAG (tmp, FLAG_MONSTER);
808
806 tmp->stats.exp = 0; 809 tmp->stats.exp = 0;
807 SET_FLAG (tmp, FLAG_FRIENDLY); 810 SET_FLAG (tmp, FLAG_FRIENDLY);
811
808 add_friendly_object (tmp); 812 add_friendly_object (tmp);
809 tmp->attack_movement = PETMOVE; 813 tmp->attack_movement = PETMOVE;
810 break; 814 break;
811 815
812 default: 816 default:
818 * It will descend through containers to find the object. 822 * It will descend through containers to find the object.
819 * slaying = match object slaying flag 823 * slaying = match object slaying flag
820 * race = match object archetype name flag 824 * race = match object archetype name flag
821 * hp = match object type (excpt type '0'== PLAYER) 825 * hp = match object type (excpt type '0'== PLAYER)
822 */ 826 */
823
824object * 827object *
825check_inv_recursive (object *op, const object *trig) 828check_inv_recursive (object *op, const object *trig)
826{ 829{
827 object *tmp, *ret = NULL; 830 object *tmp, *ret = NULL;
828 831

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines