mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-03 18:33:39 +02:00
map::on_tick(): Introduce, call in each tick
This commit is contained in:
parent
d7ed0bc6ce
commit
eb42ab4764
2 changed files with 8 additions and 0 deletions
2
main.cc
2
main.cc
|
@ -43,6 +43,8 @@ main(int argc, char *argv[])
|
||||||
while (true) {
|
while (true) {
|
||||||
std::cout << "tick " << tick_id << '\n';
|
std::cout << "tick " << tick_id << '\n';
|
||||||
|
|
||||||
|
map.on_tick();
|
||||||
|
|
||||||
if (agent) {
|
if (agent) {
|
||||||
agent->on_tick();
|
agent->on_tick();
|
||||||
if (agent->conn && agent->conn->error) {
|
if (agent->conn && agent->conn->error) {
|
||||||
|
|
6
map.h
6
map.h
|
@ -54,6 +54,12 @@ public:
|
||||||
return *tiles[y * w + x];
|
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);
|
void print_map(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue