mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
agent::move_dir(): Make sure to properly detach eaten agent from a tile
This commit is contained in:
parent
9c4adb5a3a
commit
a40cd4e87c
1 changed files with 4 additions and 1 deletions
5
agent.cc
5
agent.cc
|
@ -42,13 +42,16 @@ agent::move_dir(int dir_x, int dir_y)
|
|||
if (t2->herb_here()) {
|
||||
class agent *a = t2->agent;
|
||||
t2->on_agent_leave(*a);
|
||||
a->tile = NULL;
|
||||
chenergy(a->energy); /* Nom. */
|
||||
a->die();
|
||||
|
||||
} else if (t2->agent->dead) {
|
||||
class agent *a = t2->agent;
|
||||
t2->on_agent_leave(*a);
|
||||
a->tile = NULL; // XXX: If one agent kills another while third is trying to move at that place, the killed agent never receives a DEATH.
|
||||
chenergy(a->energy); /* Nom. */
|
||||
a->energy = 0;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue