… | |
… | |
2547 | return splay (tmp); |
2547 | return splay (tmp); |
2548 | |
2548 | |
2549 | return 0; |
2549 | return 0; |
2550 | } |
2550 | } |
2551 | |
2551 | |
|
|
2552 | void |
|
|
2553 | object::force_set_timer (int duration) |
|
|
2554 | { |
|
|
2555 | this->duration = 1; |
|
|
2556 | this->speed_left = -1.f; |
|
|
2557 | |
|
|
2558 | this->set_speed (duration ? 1.f / duration : 0.f); |
|
|
2559 | } |
|
|
2560 | |
2552 | object * |
2561 | object * |
2553 | object::force_add (shstr_tmp name, int duration) |
2562 | object::force_add (shstr_tmp name, int duration) |
2554 | { |
2563 | { |
2555 | if (object *force = force_find (name)) |
2564 | if (object *force = force_find (name)) |
2556 | force->destroy (); |
2565 | force->destroy (); |
2557 | |
2566 | |
2558 | object *force = get_archetype (FORCE_NAME); |
2567 | object *force = get_archetype (FORCE_NAME); |
2559 | |
2568 | |
2560 | force->slaying = name; |
2569 | force->slaying = name; |
2561 | force->stats.food = 1; |
|
|
2562 | force->speed_left = -1.f; |
|
|
2563 | |
2570 | |
2564 | force->set_speed (duration ? 1.f / duration : 0.f); |
2571 | force->force_set_timer (duration); |
2565 | force->flag [FLAG_IS_USED_UP] = true; |
2572 | |
2566 | force->flag [FLAG_APPLIED] = true; |
2573 | force->flag [FLAG_APPLIED] = true; |
2567 | |
2574 | |
2568 | return insert (force); |
2575 | return insert (force); |
2569 | } |
2576 | } |
2570 | |
2577 | |