map::on_tick(): Introduce, call in each tick

This commit is contained in:
Petr Baudis 2011-11-27 00:03:20 +01:00
parent d7ed0bc6ce
commit eb42ab4764
2 changed files with 8 additions and 0 deletions

View file

@ -43,6 +43,8 @@ main(int argc, char *argv[])
while (true) {
std::cout << "tick " << tick_id << '\n';
map.on_tick();
if (agent) {
agent->on_tick();
if (agent->conn && agent->conn->error) {

6
map.h
View file

@ -54,6 +54,12 @@ public:
return *tiles[y * w + x];
};
void on_tick(void)
{
for (int i = 0; i < w * h; i++)
tiles[i]->on_tick();
}
void print_map(void);
};