mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 09:53:38 +02:00
agent::move_dir(): Disallow movement of dead agent
This commit is contained in:
parent
77e555706b
commit
e27a9fe2aa
1 changed files with 4 additions and 0 deletions
4
agent.cc
4
agent.cc
|
@ -19,6 +19,9 @@ agent::put_at(class tile &t)
|
|||
bool
|
||||
agent::move_dir(int dir_x, int dir_y)
|
||||
{
|
||||
if (dead)
|
||||
return false;
|
||||
|
||||
energy -= world::move_cost;
|
||||
|
||||
class tile *t2 = &tile->tile_in_dir(dir_x, dir_y);
|
||||
|
@ -33,6 +36,7 @@ agent::move_dir(int dir_x, int dir_y)
|
|||
void
|
||||
agent::die(void)
|
||||
{
|
||||
assert(!dead);
|
||||
dead = true;
|
||||
energy = world::dead_body_energy;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue