… | |
… | |
248 | |
248 | |
249 | any_down = any_down || tmp->value; |
249 | any_down = any_down || tmp->value; |
250 | } |
250 | } |
251 | else if (tmp->type == PEDESTAL) |
251 | else if (tmp->type == PEDESTAL) |
252 | { |
252 | { |
|
|
253 | bool is_match = is_match_expr (tmp->slaying); |
253 | tmp->value = 0; |
254 | tmp->value = 0; |
254 | |
255 | |
255 | for (object *ab = tmp->above; ab; ab = ab->above) |
256 | for (object *ab = tmp->above; ab; ab = ab->above) |
256 | { |
257 | { |
257 | object *head = ab->head_ (); |
258 | object *head = ab->head_ (); |
258 | |
259 | |
259 | /* Same note regarding move_type for buttons above apply here. */ |
260 | /* Same note regarding move_type for buttons above apply here. */ |
260 | 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) |
261 | && (head->race == tmp->slaying |
264 | : (head->race == tmp->slaying |
262 | || (head->type == SPECIAL_KEY && head->slaying == tmp->slaying) |
265 | || (head->type == SPECIAL_KEY && head->slaying == tmp->slaying) |
263 | || (tmp->slaying == shstr_player && head->type == PLAYER))) |
266 | || (tmp->slaying == shstr_player && head->type == PLAYER))) |
|
|
267 | { |
264 | tmp->value = 1; |
268 | tmp->value = 1; |
|
|
269 | break; |
|
|
270 | } |
265 | } |
271 | } |
266 | |
272 | |
267 | any_down = any_down || tmp->value; |
273 | any_down = any_down || tmp->value; |
268 | } |
274 | } |
269 | } |
275 | } |
… | |
… | |
317 | * 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 |
318 | * objects on the same space that take the same sacrifice. |
324 | * objects on the same space that take the same sacrifice. |
319 | */ |
325 | */ |
320 | |
326 | |
321 | int |
327 | int |
322 | check_altar_sacrifice (const object *altar, const object *sacrifice) |
328 | check_altar_sacrifice (object *altar, object *sacrifice, object *originator) |
323 | { |
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 | |
324 | if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) |
336 | if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) |
325 | && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) |
337 | && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) |
326 | && sacrifice->type != PLAYER) |
338 | && sacrifice->type != PLAYER) |
327 | { |
339 | { |
328 | if (ARCH_SACRIFICE (altar) == shstr_money |
340 | if (ARCH_SACRIFICE (altar) == shstr_money |
… | |
… | |
349 | * |
361 | * |
350 | * 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 |
351 | * 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. |
352 | */ |
364 | */ |
353 | int |
365 | int |
354 | operate_altar (object *altar, object **sacrifice) |
366 | operate_altar (object *altar, object **sacrifice, object *originator) |
355 | { |
367 | { |
356 | if (!altar->map) |
368 | if (!altar->map) |
357 | { |
369 | { |
358 | LOG (llevError, "BUG: operate_altar(): altar has no map\n"); |
370 | LOG (llevError, "BUG: operate_altar(): altar has no map\n"); |
359 | return 0; |
371 | return 0; |
360 | } |
372 | } |
361 | |
373 | |
362 | if (!altar->slaying || altar->value) |
374 | if (!altar->slaying || altar->value) |
363 | return 0; |
375 | return 0; |
364 | |
376 | |
365 | if (!check_altar_sacrifice (altar, *sacrifice)) |
377 | if (!check_altar_sacrifice (altar, *sacrifice, originator)) |
366 | return 0; |
378 | return 0; |
367 | |
379 | |
368 | /* check_altar_sacrifice should have already verified that enough money |
380 | /* check_altar_sacrifice should have already verified that enough money |
369 | * has been dropped. |
381 | * has been dropped. |
370 | */ |
382 | */ |
… | |
… | |
419 | * TRIGGER: Returns 1 if handle could be moved, 0 if not. |
431 | * TRIGGER: Returns 1 if handle could be moved, 0 if not. |
420 | * |
432 | * |
421 | * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. |
433 | * TRIGGER_BUTTON, TRIGGER_PEDESTAL: Returns 0. |
422 | */ |
434 | */ |
423 | int |
435 | int |
424 | check_trigger (object *op, object *cause) |
436 | check_trigger (object *op, object *cause, object *originator) |
425 | { |
437 | { |
426 | object *tmp; |
438 | object *tmp; |
427 | int push = 0, tot = 0; |
439 | int push = 0, tot = 0; |
428 | int in_movement = op->stats.wc || op->speed; |
440 | int in_movement = op->stats.wc || op->speed; |
429 | |
441 | |
… | |
… | |
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); |