mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-03 02:13:35 +02:00
agent::on_senses_update(): Split off on_tick()
This commit is contained in:
parent
9c746310de
commit
f0d0bef899
3 changed files with 11 additions and 0 deletions
5
agent.cc
5
agent.cc
|
@ -30,6 +30,11 @@ agent::move_dir(int dir_x, int dir_y)
|
||||||
|
|
||||||
void
|
void
|
||||||
agent::on_tick(void)
|
agent::on_tick(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
agent::on_senses_update(void)
|
||||||
{
|
{
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return;
|
return;
|
||||||
|
|
1
agent.h
1
agent.h
|
@ -19,6 +19,7 @@ public:
|
||||||
bool move_dir(int dir_x, int dir_y);
|
bool move_dir(int dir_x, int dir_y);
|
||||||
|
|
||||||
void on_tick(void);
|
void on_tick(void);
|
||||||
|
void on_senses_update(void);
|
||||||
|
|
||||||
~agent();
|
~agent();
|
||||||
|
|
||||||
|
|
5
main.cc
5
main.cc
|
@ -79,6 +79,11 @@ next_agent:
|
||||||
for (std::list<class agent *>::iterator agent = agents.begin(); agent != agents.end(); agent++)
|
for (std::list<class agent *>::iterator agent = agents.begin(); agent != agents.end(); agent++)
|
||||||
(*agent)->on_tick();
|
(*agent)->on_tick();
|
||||||
|
|
||||||
|
/* Update agents' senses. */
|
||||||
|
|
||||||
|
for (std::list<class agent *>::iterator agent = agents.begin(); agent != agents.end(); agent++)
|
||||||
|
(*agent)->on_senses_update();
|
||||||
|
|
||||||
/* Finish a tick. */
|
/* Finish a tick. */
|
||||||
|
|
||||||
map.print_map();
|
map.print_map();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue