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.52 by root, Thu Jan 8 04:35:03 2009 UTC vs.
Revision 1.54 by root, Sun Oct 11 18:18:03 2009 UTC

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 activator 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 * the originator is the player or monster who did something.
36 */ 36 */
37static void 37static void
38activate_connection_link (objectlink *ol, bool state, object *activator, object *originator) 38activate_connection_link (objectlink *ol, int state, object *activator, object *originator)
39{ 39{
40 for (; ol; ol = ol->next) 40 for (; ol; ol = ol->next)
41 { 41 {
42 if (!ol->ob) 42 if (!ol->ob)
43 { 43 {
135 case FIREWALL: 135 case FIREWALL:
136 if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL) 136 if (!QUERY_FLAG (tmp, FLAG_ANIMATE) && tmp->type == FIREWALL)
137 move_firewall (tmp); 137 move_firewall (tmp);
138 else 138 else
139 { 139 {
140 if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ 140 tmp->stats.sp = absdir (tmp->stats.sp + tmp->stats.maxsp); /* next direction */
141 tmp->stats.sp = ((tmp->stats.sp - 1) % 8) + 1;
142
143 animate_turning (tmp); 141 animate_turning (tmp);
144 } 142 }
145 break; 143 break;
146 144
147 case TELEPORTER: 145 case TELEPORTER:
199 * 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
200 * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly. 198 * who have FLAG_ACTIVATE_ON_PUSH/RELEASE set properly.
201 * 199 *
202 */ 200 */
203void 201void
204maptile::trigger (shstr_tmp id, bool state, object *activator, object *originator) 202maptile::trigger (shstr_tmp id, int state, object *activator, object *originator)
205{ 203{
206 if (INVOKE_MAP (TRIGGER, this, ARG_STRING (&id), ARG_INT (state), ARG_OBJECT (originator))) 204 if (INVOKE_MAP (TRIGGER, this, ARG_STRING (&id), ARG_INT (state), ARG_OBJECT (originator)))
207 return; 205 return;
208 206
209 if (oblinkpt *obp = find_link (id)) 207 if (oblinkpt *obp = find_link (id))
319 * sacrificed. This fixes a bug of trying to put multiple altars/related 317 * sacrificed. This fixes a bug of trying to put multiple altars/related
320 * objects on the same space that take the same sacrifice. 318 * objects on the same space that take the same sacrifice.
321 */ 319 */
322 320
323int 321int
324check_altar_sacrifice (const object *altar, const object *sacrifice) 322check_altar_sacrifice (object *altar, object *sacrifice, object *originator)
325{ 323{
324 if (sacrifice->flag [FLAG_UNPAID])
325 return 0;
326
327 if (is_match_expr (ARCH_SACRIFICE (altar)))
328 return match (ARCH_SACRIFICE (altar), altar, originator);
329
326 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) 330 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE)
327 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) 331 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED)
328 && sacrifice->type != PLAYER) 332 && sacrifice->type != PLAYER)
329 { 333 {
330 if (ARCH_SACRIFICE (altar) == shstr_money 334 if (ARCH_SACRIFICE (altar) == shstr_money
351 * 355 *
352 * If this function returns 1, '*sacrifice' is modified to point to the 356 * 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. 357 * remaining sacrifice, or is set to NULL if the sacrifice was used up.
354 */ 358 */
355int 359int
356operate_altar (object *altar, object **sacrifice) 360operate_altar (object *altar, object **sacrifice, object *originator)
357{ 361{
358 if (!altar->map) 362 if (!altar->map)
359 { 363 {
360 LOG (llevError, "BUG: operate_altar(): altar has no map\n"); 364 LOG (llevError, "BUG: operate_altar(): altar has no map\n");
361 return 0; 365 return 0;
362 } 366 }
363 367
364 if (!altar->slaying || altar->value) 368 if (!altar->slaying || altar->value)
365 return 0; 369 return 0;
366 370
367 if (!check_altar_sacrifice (altar, *sacrifice)) 371 if (!check_altar_sacrifice (altar, *sacrifice, originator))
368 return 0; 372 return 0;
369 373
370 /* check_altar_sacrifice should have already verified that enough money 374 /* check_altar_sacrifice should have already verified that enough money
371 * has been dropped. 375 * has been dropped.
372 */ 376 */
421 * TRIGGER: Returns 1 if handle could be moved, 0 if not. 425 * TRIGGER: Returns 1 if handle could be moved, 0 if not.
422 * 426 *
423 * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. 427 * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0.
424 */ 428 */
425int 429int
426check_trigger (object *op, object *cause) 430check_trigger (object *op, object *cause, object *originator)
427{ 431{
428 object *tmp; 432 object *tmp;
429 int push = 0, tot = 0; 433 int push = 0, tot = 0;
430 int in_movement = op->stats.wc || op->speed; 434 int in_movement = op->stats.wc || op->speed;
431 435
509 if (cause) 513 if (cause)
510 { 514 {
511 if (in_movement) 515 if (in_movement)
512 return 0; 516 return 0;
513 517
514 if (operate_altar (op, &cause)) 518 if (operate_altar (op, &cause)) /* TODO: originator? */
515 { 519 {
516 if (NUM_ANIMATIONS (op) > 1) 520 if (NUM_ANIMATIONS (op) > 1)
517 { 521 {
518 SET_ANIMATION (op, 1); 522 SET_ANIMATION (op, 1);
519 update_object (op, UP_OBJ_FACE); 523 update_object (op, UP_OBJ_FACE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines