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.70 by root, Mon Oct 29 23:55:52 2012 UTC vs.
Revision 1.74 by root, Sat Nov 17 23:39:59 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
236 237
237 object *tmp = ol->ob; 238 object *tmp = ol->ob;
238 239
239 if (tmp->type == BUTTON) 240 if (tmp->type == BUTTON)
240 { 241 {
241 sint32 total = 0; 242 weight_t total = 0;
242 243
243 for (object *ab = tmp->above; ab; ab = ab->above) 244 for (object *ab = tmp->above; ab; ab = ab->above)
244 /* Basically, if the move_type matches that on what the 245 /* Basically, if the move_type matches that on what the
245 * button wants, we count it. The second check is so that 246 * button wants, we count it. The second check is so that
246 * objects who don't move (swords, etc) will count. Note that 247 * objects who don't move (swords, etc) will count. Note that
561 op->last_sp = -op->last_sp; 562 op->last_sp = -op->last_sp;
562 } 563 }
563 else 564 else
564 { 565 {
565 /* for trigger altar with last_sp, the ON/OFF 566 /* for trigger altar with last_sp, the ON/OFF
566 * status (-> +/- value) is "simulated": 567 * status (-> +/- value) is "simulated":
567 */ 568 */
568 op->value = !op->value; 569 op->value = !op->value;
569 trigger_move (op, 1, cause); 570 trigger_move (op, 1, cause);
570 op->last_sp = -op->last_sp; 571 op->last_sp = -op->last_sp;
571 op->value = !op->value; 572 op->value = !op->value;
585 } 586 }
586 587
587 /* If trigger_altar has "last_sp > 0" set on the map, 588 /* If trigger_altar has "last_sp > 0" set on the map,
588 * it will push the connected value only once per sacrifice. 589 * it will push the connected value only once per sacrifice.
589 * Otherwise (default), the connected value will be 590 * Otherwise (default), the connected value will be
590 * pushed twice: First by sacrifice, second by reset! -AV 591 * pushed twice: First by sacrifice, second by reset! -AV
591 */ 592 */
592 if (!op->last_sp) 593 if (!op->last_sp)
593 trigger_move (op, 0, cause); 594 trigger_move (op, 0, cause);
594 else 595 else
595 { 596 {
738 return obp; 739 return obp;
739 740
740 return 0; 741 return 0;
741} 742}
742 743
743/* This routine makes monsters who are 744/* This routine makes monsters who are
744 * standing on the 'mood floor' change their 745 * standing on the 'mood floor' change their
745 * disposition if it is different. 746 * disposition if it is different.
746 * If floor is to be triggered must have 747 * If floor is to be triggered must have
747 * a speed of zero (default is 1 for all 748 * a speed of zero (default is 1 for all
748 * but the charm floor type). 749 * but the charm floor type).
749 * by b.t. thomas@nomad.astro.psu.edu 750 * by b.t. thomas@nomad.astro.psu.edu
750 */ 751 */
874 return tmp; 875 return tmp;
875 } 876 }
876 return NULL; 877 return NULL;
877} 878}
878 879
879/* check_inv(), a function to search the inventory, 880/* check_inv(), a function to search the inventory,
880 * of a player and then based on a set of conditions, 881 * of a player and then based on a set of conditions,
881 * the square will activate connected items. 882 * the square will activate connected items.
882 * Monsters can't trigger this square (for now) 883 * Monsters can't trigger this square (for now)
883 * Values are: last_sp = 1/0 obj/no obj triggers 884 * Values are: last_sp = 1/0 obj/no obj triggers
884 * last_heal = 1/0 remove/dont remove obj if triggered 885 * last_heal = 1/0 remove/dont remove obj if triggered
885 * -b.t. (thomas@nomad.astro.psu.edu 886 * -b.t. (thomas@nomad.astro.psu.edu
886 * 887 *
887 * Tue Dec 19 15:34:00 CET 2006 elmex: changed the function to ignore op 888 * Tue Dec 19 15:34:00 CET 2006 elmex: changed the function to ignore op
888 * because the check-inventory semantic essentially only applies when 889 * because the check-inventory semantic essentially only applies when
889 * something is above the inventory checker. 890 * something is above the inventory checker.
890 * The semantic prior this change was: trigger if something has moved on or off 891 * The semantic prior this change was: trigger if something has moved on or off
893 * away, and then leaves the inventory checker. That would've caused an always-enabled 894 * away, and then leaves the inventory checker. That would've caused an always-enabled
894 * state in the inventory checker. This won't happen anymore now. 895 * state in the inventory checker. This won't happen anymore now.
895 * 896 *
896 * Wed Jan 10 11:34:26 CET 2007 elmex: fixed this function, we now check 897 * Wed Jan 10 11:34:26 CET 2007 elmex: fixed this function, we now check
897 * whether op is on this mapspace or not, because the value (1|0) depends 898 * whether op is on this mapspace or not, because the value (1|0) depends
898 * on this information. also make sure to only push_button if op has 899 * on this information. also make sure to only push_button if op has
899 * a matching item (because when we do a push_button with value=0 timed gates 900 * a matching item (because when we do a push_button with value=0 timed gates
900 * will still open)! (i hope i got the semantics right this time) 901 * will still open)! (i hope i got the semantics right this time)
901 * 902 *
902 */ 903 */
903void 904void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines