mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
agent::conn: Do not assume being non-NULL
Disconnected agents will remain in the world in the future.
This commit is contained in:
parent
a645ba5758
commit
cd347a316d
1 changed files with 5 additions and 1 deletions
6
agent.cc
6
agent.cc
|
@ -31,6 +31,9 @@ agent::move_dir(int dir_x, int dir_y)
|
|||
void
|
||||
agent::on_tick(void)
|
||||
{
|
||||
if (!conn)
|
||||
return;
|
||||
|
||||
char around[4] = {
|
||||
tile->tile_in_dir(0, -1).symbol(),
|
||||
tile->tile_in_dir(1, 0).symbol(),
|
||||
|
@ -43,5 +46,6 @@ agent::on_tick(void)
|
|||
agent::~agent()
|
||||
{
|
||||
tile->on_agent_leave(*this);
|
||||
delete conn;
|
||||
if (conn)
|
||||
delete conn;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue