diff --git a/agent.cc b/agent.cc index ac00c03..ea097c7 100644 --- a/agent.cc +++ b/agent.cc @@ -59,7 +59,7 @@ agent::on_action_takes(void) if (!conn) return; - conn->actions(this); + conn->actions(*this); } void diff --git a/connection.cc b/connection.cc index bd81b0d..6a5176a 100644 --- a/connection.cc +++ b/connection.cc @@ -47,7 +47,7 @@ connection::bump(void) } void -connection::actions(class agent *agent) +connection::actions(class agent &agent) { pthread_mutex_lock(&buf_lock); 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); if (x < -1) x = -1; if (x > 1) x = 1; if (y < -1) y = -1; if (y > 1) y = 1; - if (!agent->move_dir(x, y)) + if (!agent.move_dir(x, y)) bump(); } else { std::cout << "unknown line " << cmd << " " << line << " ...\n"; diff --git a/connection.h b/connection.h index ab7541d..753f360 100644 --- a/connection.h +++ b/connection.h @@ -27,7 +27,7 @@ public: } void senses(int tick_id, class agent &); - void actions(class agent *); + void actions(class agent &); void cancel(void);