agent::move_dir(): Implement

This commit is contained in:
Petr Baudis 2011-11-26 20:40:22 +01:00
parent 56726a6c05
commit b305a41cfc
3 changed files with 24 additions and 0 deletions

View file

@ -13,3 +13,15 @@ agent::put_at(class tile &t)
exit(EXIT_FAILURE);
}
}
bool
agent::move_dir(int dir_x, int dir_y)
{
class tile *t2 = &tile->tile_in_dir(dir_x, dir_y);
if (!t2->on_agent_enter(*this))
return false;
tile->on_agent_leave(*this);
tile = t2;
return true;
}