mirror of
https://github.com/brmlab/brmlife.git
synced 2025-08-02 18:03:37 +02:00
connnection::actions(): Take agent&
This commit is contained in:
parent
415475cd26
commit
e22c57c97f
3 changed files with 4 additions and 4 deletions
2
agent.cc
2
agent.cc
|
@ -59,7 +59,7 @@ agent::on_action_takes(void)
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
conn->actions(this);
|
conn->actions(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -47,7 +47,7 @@ connection::bump(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connection::actions(class agent *agent)
|
connection::actions(class agent &agent)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&buf_lock);
|
pthread_mutex_lock(&buf_lock);
|
||||||
if (in_buf.find("\r\n\r\n") == std::string::npos) {
|
if (in_buf.find("\r\n\r\n") == std::string::npos) {
|
||||||
|
@ -70,7 +70,7 @@ connection::actions(class agent *agent)
|
||||||
sscanf(line.c_str(), "%d %d", &x, &y);
|
sscanf(line.c_str(), "%d %d", &x, &y);
|
||||||
if (x < -1) x = -1; if (x > 1) x = 1;
|
if (x < -1) x = -1; if (x > 1) x = 1;
|
||||||
if (y < -1) y = -1; if (y > 1) y = 1;
|
if (y < -1) y = -1; if (y > 1) y = 1;
|
||||||
if (!agent->move_dir(x, y))
|
if (!agent.move_dir(x, y))
|
||||||
bump();
|
bump();
|
||||||
} else {
|
} else {
|
||||||
std::cout << "unknown line " << cmd << " " << line << " ...\n";
|
std::cout << "unknown line " << cmd << " " << line << " ...\n";
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void senses(int tick_id, class agent &);
|
void senses(int tick_id, class agent &);
|
||||||
void actions(class agent *);
|
void actions(class agent &);
|
||||||
|
|
||||||
void cancel(void);
|
void cancel(void);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue