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.49 by root, Mon Sep 29 10:32:50 2008 UTC vs.
Revision 1.55 by root, Mon Oct 12 04:02:17 2009 UTC

29 29
30/* 30/*
31 * elmex: 31 * elmex:
32 * This function takes a objectlink list with all the objects are going to be activated. 32 * This function takes a objectlink list with all the objects are going to be activated.
33 * state is a true/false flag that will actiavte objects that have FLAG_ACTIVATE_ON_PUSH/RELEASE set. 33 * state is a true/false flag that will actiavte objects that have FLAG_ACTIVATE_ON_PUSH/RELEASE set.
34 * The source argument can be 0 or the source object for this activation. 34 * The activator argument can be 0 or the source object for this activation.
35 * the originator is the player or monster who did something.
35 */ 36 */
36void 37static void
37activate_connection_link (objectlink * ol, bool state, object *source = 0) 38activate_connection_link (objectlink *ol, int state, object *activator, object *originator)
38{ 39{
39 for (; ol; ol = ol->next) 40 for (; ol; ol = ol->next)
40 { 41 {
41 if (!ol->ob) 42 if (!ol->ob)
42 { 43 {
105 SET_ANIMATION (tmp, tmp->value); 106 SET_ANIMATION (tmp, tmp->value);
106 update_object (tmp, UP_OBJ_FACE); 107 update_object (tmp, UP_OBJ_FACE);
107 break; 108 break;
108 109
109 case MOOD_FLOOR: 110 case MOOD_FLOOR:
110 do_mood_floor (tmp, source); 111 do_mood_floor (tmp, activator);
111 break; 112 break;
112 113
113 case TIMED_GATE: 114 case TIMED_GATE:
114 if (!tmp->active) 115 if (!tmp->active)
115 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_gate")); 116 tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_gate"));
117
116 tmp->set_speed (tmp->arch->speed); 118 tmp->set_speed (tmp->arch->speed);
117 tmp->value = tmp->arch->value; 119 tmp->value = tmp->arch->value;
118 tmp->stats.sp = 1; 120 tmp->stats.sp = 1;
119 tmp->stats.hp = tmp->stats.maxhp; 121 tmp->stats.hp = tmp->stats.maxhp;
120 /* Handle multipart gates. We copy the value for the other parts 122 /* Handle multipart gates. We copy the value for the other parts
133 case FIREWALL: 135 case FIREWALL:
134 if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL) 136 if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL)
135 move_firewall (tmp); 137 move_firewall (tmp);
136 else 138 else
137 { 139 {
138 if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ 140 tmp->stats.sp = absdir (tmp->stats.sp + tmp->stats.maxsp); /* next direction */
139 tmp->stats.sp = ((tmp->stats.sp - 1) % 8) + 1;
140
141 animate_turning (tmp); 141 animate_turning (tmp);
142 } 142 }
143 break; 143 break;
144 144
145 case TELEPORTER: 145 case TELEPORTER:
155 move_marker (tmp); 155 move_marker (tmp);
156 break; 156 break;
157 157
158 case DUPLICATOR: 158 case DUPLICATOR:
159 move_duplicator (tmp); 159 move_duplicator (tmp);
160 break;
161
162 case MAPSCRIPT:
163 cfperl_mapscript_activate (tmp, state, activator, originator);
160 break; 164 break;
161 } 165 }
162 } 166 }
163} 167}
164 168
173 * Changed the routine to loop through _all_ objects. 177 * Changed the routine to loop through _all_ objects.
174 * Better hurry with that linked list... 178 * Better hurry with that linked list...
175 * 179 *
176 */ 180 */
177void 181void
178push_button (object *op) 182push_button (object *op, object *originator)
179{ 183{
180 oblinkpt *obp = get_button_links (op); 184 if (oblinkpt *obp = op->find_link ())
181 185 {
182 if (!obp) 186 if (INVOKE_MAP (TRIGGER, op->map, ARG_STRING (&obp->id), ARG_INT (op->value), ARG_OBJECT (op), ARG_OBJECT (originator)))
183 return; 187 return;
184 188
185 if (INVOKE_MAP (TRIGGER, op->map, ARG_INT64 (obp->value), ARG_INT (op->value)))
186 return;
187
188 activate_connection_link (obp->link, op->value, op); 189 activate_connection_link (obp->link, op->value, op, originator);
190 }
189} 191}
190 192
191/* 193/*
192 * elmex: 194 * elmex:
193 * This activates a connection, similar to push_button (object *op) but it takes 195 * This activates a connection, similar to push_button (object *op) but it takes
195 * the connection was 'state' or 'released'. So that you can activate objects 197 * the connection was 'state' or 'released'. So that you can activate objects
196 * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly. 198 * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly.
197 * 199 *
198 */ 200 */
199void 201void
200activate_connection (maptile *map, long connection, bool state) 202maptile::trigger (shstr_tmp id, int state, object *activator, object *originator)
201{ 203{
202 if (INVOKE_MAP (TRIGGER, map, ARG_INT64 (connection), ARG_INT (state))) 204 if (INVOKE_MAP (TRIGGER, this, ARG_STRING (&id), ARG_INT (state), ARG_OBJECT (originator)))
203 return; 205 return;
204 206
205 oblinkpt *obp = get_connection_links (map, connection); 207 if (oblinkpt *obp = find_link (id))
206
207 if (obp)
208 activate_connection_link (obp->link, state); 208 activate_connection_link (obp->link, state, activator, originator);
209} 209}
210 210
211/* 211/*
212 * Updates everything connected with the button op. 212 * Updates everything connected with the button op.
213 * After changing the state of a button, this function must be called 213 * After changing the state of a button, this function must be called
214 * to make sure that all gates and other buttons connected to the 214 * to make sure that all gates and other buttons connected to the
215 * button reacts to the (eventual) change of state. 215 * button reacts to the (eventual) change of state.
216 */ 216 */
217void 217void
218update_button (object *op) 218update_button (object *op, object *originator)
219{ 219{
220 int any_down = 0, old_value = op->value; 220 int any_down = 0, old_value = op->value;
221 oblinkpt *obp = 0;
222 objectlink *ol;
223 221
224 obp = get_button_links (op); 222 if (oblinkpt *obp = op->find_link ())
225 if (obp)
226 for (ol = obp->link; ol; ol = ol->next) 223 for (objectlink *ol = obp->link; ol; ol = ol->next)
227 { 224 {
228 if (!ol->ob) 225 if (!ol->ob)
229 { 226 {
230 LOG (llevDebug, "Internal error in update_button (%s).\n", &op->name); 227 LOG (llevDebug, "Internal error in update_button (%s).\n", &op->name);
231 continue; 228 continue;
251 248
252 any_down = any_down || tmp->value; 249 any_down = any_down || tmp->value;
253 } 250 }
254 else if (tmp->type == PEDESTAL) 251 else if (tmp->type == PEDESTAL)
255 { 252 {
253 bool is_match = is_match_expr (tmp->slaying);
256 tmp->value = 0; 254 tmp->value = 0;
257 255
258 for (object *ab = tmp->above; ab; ab = ab->above) 256 for (object *ab = tmp->above; ab; ab = ab->above)
259 { 257 {
260 object *head = ab->head_ (); 258 object *head = ab->head_ ();
261 259
262 /* Same note regarding move_type for buttons above apply here. */ 260 /* Same note regarding move_type for buttons above apply here. */
263 if (((ab->move_type & tmp->move_on) || ab->move_type == 0) 261 if (((ab->move_type & tmp->move_on) || ab->move_type == 0))
262 if (is_match
263 ? match (tmp->slaying, head, tmp, originator)
264 && (head->race == tmp->slaying 264 : (head->race == tmp->slaying
265 || (head->type == SPECIAL_KEY && head->slaying == tmp->slaying) 265 || (head->type == SPECIAL_KEY && head->slaying == tmp->slaying)
266 || (tmp->slaying == shstr_player && head->type == PLAYER))) 266 || (tmp->slaying == shstr_player && head->type == PLAYER)))
267 {
267 tmp->value = 1; 268 tmp->value = 1;
269 break;
270 }
268 } 271 }
269 272
270 any_down = any_down || tmp->value; 273 any_down = any_down || tmp->value;
271 } 274 }
272 } 275 }
279 /* If this button hasn't changed, don't do anything */ 282 /* If this button hasn't changed, don't do anything */
280 if (op->value != old_value) 283 if (op->value != old_value)
281 { 284 {
282 SET_ANIMATION (op, op->value); 285 SET_ANIMATION (op, op->value);
283 update_object (op, UP_OBJ_FACE); 286 update_object (op, UP_OBJ_FACE);
284 push_button (op); /* Make all other buttons the same */ 287 push_button (op, originator); /* Make all other buttons the same */
285 } 288 }
286} 289}
287 290
288void 291void
289use_trigger (object *op) 292use_trigger (object *op, object *originator)
290{ 293{
291 /* Toggle value */ 294 /* Toggle value */
292 op->value = !op->value; 295 op->value = !op->value;
296
293 push_button (op); 297 push_button (op, originator);
294} 298}
295 299
296/* 300/*
297 * Note: animate_object should be used instead of this, 301 * Note: animate_object should be used instead of this,
298 * but it can't handle animations in the 8 directions 302 * but it can't handle animations in the 8 directions
319 * sacrificed. This fixes a bug of trying to put multiple altars/related 323 * sacrificed. This fixes a bug of trying to put multiple altars/related
320 * objects on the same space that take the same sacrifice. 324 * objects on the same space that take the same sacrifice.
321 */ 325 */
322 326
323int 327int
324check_altar_sacrifice (const object *altar, const object *sacrifice) 328check_altar_sacrifice (object *altar, object *sacrifice, object *originator)
325{ 329{
330 if (sacrifice->flag [FLAG_UNPAID])
331 return 0;
332
333 if (is_match_expr (ARCH_SACRIFICE (altar)))
334 return match (ARCH_SACRIFICE (altar), altar, originator);
335
326 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) 336 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE)
327 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) 337 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED)
328 && sacrifice->type != PLAYER) 338 && sacrifice->type != PLAYER)
329 { 339 {
330 if (ARCH_SACRIFICE (altar) == shstr_money 340 if (ARCH_SACRIFICE (altar) == shstr_money
351 * 361 *
352 * If this function returns 1, '*sacrifice' is modified to point to the 362 * If this function returns 1, '*sacrifice' is modified to point to the
353 * remaining sacrifice, or is set to NULL if the sacrifice was used up. 363 * remaining sacrifice, or is set to NULL if the sacrifice was used up.
354 */ 364 */
355int 365int
356operate_altar (object *altar, object **sacrifice) 366operate_altar (object *altar, object **sacrifice, object *originator)
357{ 367{
358 if (!altar->map) 368 if (!altar->map)
359 { 369 {
360 LOG (llevError, "BUG: operate_altar(): altar has no map\n"); 370 LOG (llevError, "BUG: operate_altar(): altar has no map\n");
361 return 0; 371 return 0;
362 } 372 }
363 373
364 if (!altar->slaying || altar->value) 374 if (!altar->slaying || altar->value)
365 return 0; 375 return 0;
366 376
367 if (!check_altar_sacrifice (altar, *sacrifice)) 377 if (!check_altar_sacrifice (altar, *sacrifice, originator))
368 return 0; 378 return 0;
369 379
370 /* check_altar_sacrifice should have already verified that enough money 380 /* check_altar_sacrifice should have already verified that enough money
371 * has been dropped. 381 * has been dropped.
372 */ 382 */
390 400
391 return 1; 401 return 1;
392} 402}
393 403
394void 404void
395trigger_move (object *op, int state) /* 1 down and 0 up */ 405trigger_move (object *op, int state, object *originator) /* 1 down and 0 up */
396{ 406{
397 op->stats.wc = state; 407 op->stats.wc = state;
408
398 if (state) 409 if (state)
399 { 410 {
400 use_trigger (op); 411 use_trigger (op, originator);
401 op->set_speed (op->stats.exp > 0 ? 1. / op->stats.exp : 1.); 412 op->set_speed (op->stats.exp > 0 ? 1. / op->stats.exp : 1.);
402 op->speed_left = -1; 413 op->speed_left = -1;
403 } 414 }
404 else 415 else
405 { 416 {
406 use_trigger (op); 417 use_trigger (op, originator);
407 op->set_speed (0); 418 op->set_speed (0);
408 } 419 }
409} 420}
410 421
411 422
420 * TRIGGER: Returns 1 if handle could be moved, 0 if not. 431 * TRIGGER: Returns 1 if handle could be moved, 0 if not.
421 * 432 *
422 * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. 433 * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.
423 */ 434 */
424int 435int
425check_trigger (object *op, object *cause) 436check_trigger (object *op, object *cause, object *originator)
426{ 437{
427 object *tmp; 438 object *tmp;
428 int push = 0, tot = 0; 439 int push = 0, tot = 0;
429 int in_movement = op->stats.wc || op->speed; 440 int in_movement = op->stats.wc || op->speed;
430 441
460 } 471 }
461 472
462 if (in_movement || !push) 473 if (in_movement || !push)
463 return 0; 474 return 0;
464 } 475 }
476
465 trigger_move (op, push); 477 trigger_move (op, push, cause);
466 } 478 }
467 479
468 return 0; 480 return 0;
469 481
470 case TRIGGER_PEDESTAL: 482 case TRIGGER_PEDESTAL:
474 { 486 {
475 object *head = tmp->head_ (); 487 object *head = tmp->head_ ();
476 488
477 /* See comment in TRIGGER_BUTTON about move_types */ 489 /* See comment in TRIGGER_BUTTON about move_types */
478 if (((head->move_type & op->move_on) || head->move_type == 0) 490 if (((head->move_type & op->move_on) || head->move_type == 0)
479 && (head->race == op->slaying || (!strcmp (op->slaying, "player") && head->type == PLAYER))) 491 && (head->race == op->slaying || (op->slaying == shstr_player && head->type == PLAYER)))
480 { 492 {
481 push = 1; 493 push = 1;
482 break; 494 break;
483 } 495 }
484 } 496 }
498 510
499 if (in_movement || !push) 511 if (in_movement || !push)
500 return 0; 512 return 0;
501 } 513 }
502 514
503 trigger_move (op, push); 515 trigger_move (op, push, cause);
504 return 0; 516 return 0;
505 517
506 case TRIGGER_ALTAR: 518 case TRIGGER_ALTAR:
507 if (cause) 519 if (cause)
508 { 520 {
509 if (in_movement) 521 if (in_movement)
510 return 0; 522 return 0;
511 523
512 if (operate_altar (op, &cause)) 524 if (operate_altar (op, &cause)) /* TODO: originator? */
513 { 525 {
514 if (NUM_ANIMATIONS (op) > 1) 526 if (NUM_ANIMATIONS (op) > 1)
515 { 527 {
516 SET_ANIMATION (op, 1); 528 SET_ANIMATION (op, 1);
517 update_object (op, UP_OBJ_FACE); 529 update_object (op, UP_OBJ_FACE);
518 } 530 }
519 531
520 if (op->last_sp >= 0) 532 if (op->last_sp >= 0)
521 { 533 {
522 trigger_move (op, 1); 534 trigger_move (op, 1, cause);
535
523 if (op->last_sp > 0) 536 if (op->last_sp > 0)
524 op->last_sp = -op->last_sp; 537 op->last_sp = -op->last_sp;
525 } 538 }
526 else 539 else
527 { 540 {
528 /* for trigger altar with last_sp, the ON/OFF 541 /* for trigger altar with last_sp, the ON/OFF
529 * status (-> +/- value) is "simulated": 542 * status (-> +/- value) is "simulated":
530 */ 543 */
531 op->value = !op->value; 544 op->value = !op->value;
532 trigger_move (op, 1); 545 trigger_move (op, 1, cause);
533 op->last_sp = -op->last_sp; 546 op->last_sp = -op->last_sp;
534 op->value = !op->value; 547 op->value = !op->value;
535 } 548 }
536 549
537 return cause == NULL; 550 return cause == NULL;
551 * it will push the connected value only once per sacrifice. 564 * it will push the connected value only once per sacrifice.
552 * Otherwise (default), the connected value will be 565 * Otherwise (default), the connected value will be
553 * pushed twice: First by sacrifice, second by reset! -AV 566 * pushed twice: First by sacrifice, second by reset! -AV
554 */ 567 */
555 if (!op->last_sp) 568 if (!op->last_sp)
556 trigger_move (op, 0); 569 trigger_move (op, 0, cause);
557 else 570 else
558 { 571 {
559 op->stats.wc = 0; 572 op->stats.wc = 0;
560 op->value = !op->value; 573 op->value = !op->value;
561 op->set_speed (0); 574 op->set_speed (0);
576 { 589 {
577 SET_ANIMATION (op, push); 590 SET_ANIMATION (op, push);
578 update_object (op, UP_OBJ_FACE); 591 update_object (op, UP_OBJ_FACE);
579 } 592 }
580 593
581 trigger_move (op, push); 594 trigger_move (op, push, cause);
582 return 1; 595 return 1;
583 596
584 default: 597 default:
585 LOG (llevDebug, "Unknown trigger type: %s (%d)\n", &op->name, op->type); 598 LOG (llevDebug, "Unknown trigger type: %s (%d)\n", &op->name, op->type);
586 return 0; 599 return 0;
587 } 600 }
588} 601}
589 602
590void 603void
591add_button_link (object *button, maptile *map, int connected) 604object::add_link (maptile *map, shstr_tmp id)
592{ 605{
593 oblinkpt *obp;
594 objectlink *ol = get_objectlink ();
595
596 if (!map) 606 if (!map)
597 { 607 {
598 LOG (llevError, "Tried to add button-link without map.\n"); 608 LOG (llevError, "Tried to add button-link without map.\n");
599 return; 609 return;
600 } 610 }
601 611
602 button->path_attuned = connected; /* peterm: I need this so I can rebuild 612 flag [FLAG_IS_LINKED] = true;
603 a connected map from a template map. */
604 613
605 SET_FLAG (button, FLAG_IS_LINKED); 614 objectlink *ol = get_objectlink ();
606
607 ol->ob = button; 615 ol->ob = this;
608 616
609 for (obp = map->buttons; obp && obp->value != connected; obp = obp->next) 617 for (oblinkpt *obp = map->buttons; obp; obp = obp->next)
610 ; 618 if (obp->id == id)
611
612 if (obp)
613 { 619 {
614 ol->next = obp->link; 620 ol->next = obp->link;
615 obp->link = ol; 621 obp->link = ol;
622 return;
616 } 623 }
617 else 624
618 {
619 obp = get_objectlinkpt (); 625 oblinkpt *obp = get_objectlinkpt ();
620 obp->value = connected; 626 obp->id = id;
621 627
622 obp->next = map->buttons; 628 obp->next = map->buttons;
623 map->buttons = obp; 629 map->buttons = obp;
624 obp->link = ol; 630 obp->link = ol;
625 }
626} 631}
627 632
628/* 633/*
629 * Remove the object from the linked lists of buttons in the map. 634 * Remove the object from the linked lists of buttons in the map.
630 * This is only needed by editors. 635 * This is only needed by editors.
631 */ 636 */
632
633void 637void
634remove_button_link (object *op) 638object::remove_link ()
635{ 639{
636 oblinkpt *obp; 640 if (!map)
637 objectlink **olp, *ol;
638
639 if (op->map == NULL)
640 { 641 {
641 LOG (llevError, "remove_button_link() in object without map.\n"); 642 LOG (llevError, "remove_button_link() in object without map.\n");
642 return; 643 return;
643 } 644 }
644 645
645 if (!QUERY_FLAG (op, FLAG_IS_LINKED)) 646 if (!flag [FLAG_IS_LINKED])
646 { 647 {
647 LOG (llevError, "remove_button_linked() in unlinked object.\n"); 648 LOG (llevError, "remove_button_linked() in unlinked object.\n");
648 return; 649 return;
649 } 650 }
650 651
652 flag [FLAG_IS_LINKED] = false;
653
651 for (obp = op->map->buttons; obp; obp = obp->next) 654 for (oblinkpt *obp = map->buttons; obp; obp = obp->next)
652 for (olp = &obp->link; (ol = *olp); olp = &ol->next) 655 for (objectlink **olp = &obp->link; *olp; olp = &(*olp)->next)
653 if (ol->ob == op) 656 if ((*olp)->ob == this)
654 { 657 {
655 658 objectlink *ol = *olp;
656/* LOG(llevDebug, "Removed link %d in button %s and map %s.\n",
657 obp->value, op->name, op->map->path);
658*/
659 *olp = ol->next; 659 *olp = ol->next;
660 delete ol; 660 delete ol;
661 return; 661 return;
662 } 662 }
663 663
664 LOG (llevError, "remove_button_linked(): couldn't find object.\n"); 664 LOG (llevError, "remove_button_linked(): couldn't find object.\n");
665 CLEAR_FLAG (op, FLAG_IS_LINKED); 665}
666
667/*
668 * Updates every button on the map (by calling update_button() for them).
669 */
670void
671maptile::update_buttons ()
672{
673 for (oblinkpt *obp = buttons; obp; obp = obp->next)
674 for (objectlink *ol = obp->link; ol; ol = ol->next)
675 {
676 if (!ol->ob)
677 {
678 LOG (llevError, "Internal error in update_button (%s (%dx%d), connected %ld).\n",
679 ol->ob ? (const char *) ol->ob->name : "null", ol->ob ? ol->ob->x : -1, ol->ob ? ol->ob->y : -1, &obp->id);
680 continue;
681 }
682
683 if (ol->ob->type == BUTTON || ol->ob->type == PEDESTAL)
684 {
685 update_button (ol->ob, 0);
686 break;
687 }
688 }
666} 689}
667 690
668/* 691/*
669 * Gets the objectlink for this connection from the map. 692 * Gets the objectlink for this connection from the map.
670 */ 693 */
671oblinkpt * 694oblinkpt *
672get_connection_links (maptile *map, long connection) 695maptile::find_link (shstr_tmp id)
673{ 696{
674 for (oblinkpt * obp = map->buttons; obp; obp = obp->next) 697 for (oblinkpt *obp = buttons; obp; obp = obp->next)
675 if (obp->value == connection) 698 if (obp->id == id)
676 return obp; 699 return obp;
677 700
678 return 0; 701 return 0;
679} 702}
680 703
681/* 704/*
682 * Return the first objectlink in the objects linked to this one 705 * Return the first objectlink in the objects linked to this one
683 */ 706 */
684
685oblinkpt * 707oblinkpt *
686get_button_links (const object *button) 708object::find_link () const
687{ 709{
688 oblinkpt *obp; 710 if (map)
689 objectlink *ol;
690
691 if (!button->map)
692 return NULL;
693
694 for (obp = button->map->buttons; obp; obp = obp->next) 711 for (oblinkpt *obp = map->buttons; obp; obp = obp->next)
695 for (ol = obp->link; ol; ol = ol->next) 712 for (objectlink *ol = obp->link; ol; ol = ol->next)
696 if (ol->ob == button) 713 if (ol->ob == this)
697 return obp; 714 return obp;
698 715
699 return NULL;
700}
701
702/*
703 * Made as a separate function to increase efficiency
704 */
705
706int
707get_button_value (const object *button)
708{
709 oblinkpt *obp;
710 objectlink *ol;
711
712 if (!button->map)
713 return 0;
714 for (obp = button->map->buttons; obp; obp = obp->next)
715 for (ol = obp->link; ol; ol = ol->next)
716 if (ol->ob == button)
717 return obp->value;
718 return 0; 716 return 0;
719} 717}
720 718
721/* This routine makes monsters who are 719/* This routine makes monsters who are
722 * standing on the 'mood floor' change their 720 * standing on the 'mood floor' change their
724 * If floor is to be triggered must have 722 * If floor is to be triggered must have
725 * a speed of zero (default is 1 for all 723 * a speed of zero (default is 1 for all
726 * but the charm floor type). 724 * but the charm floor type).
727 * by b.t. thomas@nomad.astro.psu.edu 725 * by b.t. thomas@nomad.astro.psu.edu
728 */ 726 */
729
730void 727void
731do_mood_floor (object *op, object *source) 728do_mood_floor (object *op, object *source)
732{ 729{
733 if (!source) 730 if (!source)
734 source = op; 731 source = op;
898 { 895 {
899 if (trig->last_heal) 896 if (trig->last_heal)
900 match->decrease (); 897 match->decrease ();
901 898
902 trig->value = (pl == op ? 1 : 0); // 1 if matching player entered, and 0 if he left 899 trig->value = (pl == op ? 1 : 0); // 1 if matching player entered, and 0 if he left
903 push_button (trig); 900 push_button (trig, op);
904 } 901 }
905 else if (!match && !trig->last_sp) // match == not having 902 else if (!match && !trig->last_sp) // match == not having
906 { 903 {
907 trig->value = (pl == op ? 1 : 0); // 1 if matching player entered, and 0 if he left 904 trig->value = (pl == op ? 1 : 0); // 1 if matching player entered, and 0 if he left
908 push_button (trig); 905 push_button (trig, op);
909 } 906 }
910} 907}
911 908

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines