… | |
… | |
317 | * 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 |
318 | * objects on the same space that take the same sacrifice. |
318 | * objects on the same space that take the same sacrifice. |
319 | */ |
319 | */ |
320 | |
320 | |
321 | int |
321 | int |
322 | check_altar_sacrifice (const object *altar, const object *sacrifice) |
322 | check_altar_sacrifice (object *altar, object *sacrifice, object *originator) |
323 | { |
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 | |
324 | if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) |
330 | if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) |
325 | && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) |
331 | && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) |
326 | && sacrifice->type != PLAYER) |
332 | && sacrifice->type != PLAYER) |
327 | { |
333 | { |
328 | if (ARCH_SACRIFICE (altar) == shstr_money |
334 | if (ARCH_SACRIFICE (altar) == shstr_money |
… | |
… | |
349 | * |
355 | * |
350 | * 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 |
351 | * 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. |
352 | */ |
358 | */ |
353 | int |
359 | int |
354 | operate_altar (object *altar, object **sacrifice) |
360 | operate_altar (object *altar, object **sacrifice, object *originator) |
355 | { |
361 | { |
356 | if (!altar->map) |
362 | if (!altar->map) |
357 | { |
363 | { |
358 | LOG (llevError, "BUG: operate_altar(): altar has no map\n"); |
364 | LOG (llevError, "BUG: operate_altar(): altar has no map\n"); |
359 | return 0; |
365 | return 0; |
360 | } |
366 | } |
361 | |
367 | |
362 | if (!altar->slaying || altar->value) |
368 | if (!altar->slaying || altar->value) |
363 | return 0; |
369 | return 0; |
364 | |
370 | |
365 | if (!check_altar_sacrifice (altar, *sacrifice)) |
371 | if (!check_altar_sacrifice (altar, *sacrifice, originator)) |
366 | return 0; |
372 | return 0; |
367 | |
373 | |
368 | /* check_altar_sacrifice should have already verified that enough money |
374 | /* check_altar_sacrifice should have already verified that enough money |
369 | * has been dropped. |
375 | * has been dropped. |
370 | */ |
376 | */ |
… | |
… | |
419 | * TRIGGER: Returns 1 if handle could be moved, 0 if not. |
425 | * TRIGGER: Returns 1 if handle could be moved, 0 if not. |
420 | * |
426 | * |
421 | * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. |
427 | * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. |
422 | */ |
428 | */ |
423 | int |
429 | int |
424 | check_trigger (object *op, object *cause) |
430 | check_trigger (object *op, object *cause, object *originator) |
425 | { |
431 | { |
426 | object *tmp; |
432 | object *tmp; |
427 | int push = 0, tot = 0; |
433 | int push = 0, tot = 0; |
428 | int in_movement = op->stats.wc || op->speed; |
434 | int in_movement = op->stats.wc || op->speed; |
429 | |
435 | |
… | |
… | |
507 | if (cause) |
513 | if (cause) |
508 | { |
514 | { |
509 | if (in_movement) |
515 | if (in_movement) |
510 | return 0; |
516 | return 0; |
511 | |
517 | |
512 | if (operate_altar (op, &cause)) |
518 | if (operate_altar (op, &cause)) /* TODO: originator? */ |
513 | { |
519 | { |
514 | if (NUM_ANIMATIONS (op) > 1) |
520 | if (NUM_ANIMATIONS (op) > 1) |
515 | { |
521 | { |
516 | SET_ANIMATION (op, 1); |
522 | SET_ANIMATION (op, 1); |
517 | update_object (op, UP_OBJ_FACE); |
523 | update_object (op, UP_OBJ_FACE); |