#include <agent.h>
Inheritance diagram for Agent:
Public Types | |
enum | agent_state_t { AGENT_BORN, AGENT_LIVE, AGENT_DIE } |
Public Member Functions | |
Agent (Kernel &kernel, Environment &env, int x, int y, Role_t role) | |
< OpenCity's specifics | |
void | receiveMessage (const Message &msg) |
void | sendMessage (Role_t role, const Message &msg) |
void | sendMessageToAgent (AgentID_t agent, const Message &msg) |
virtual void | processMessage () |
virtual void | born () |
virtual void | live () |
virtual void | die () |
unsigned int | getX () const |
unsigned int | getY () const |
Agent * | lookForAgent (direction_t dir, unsigned long max_distance) |
AgentID_t | getId () const |
Role_t | getRole () const |
bool | moveDirection () |
bool | move (int x, int y) |
bool | canMove (int x, int y) const |
bool | canMove (direction_t dir, int &x, int &y) const |
bool | canMove (direction_t dir) const |
bool | randomMove (int turn_percent=60) |
virtual void | output (std::ostream &os) const |
const OPENCITY_GRAPHIC_CODE | GetGraphicCode () const |
void | SetGraphicCode (const OPENCITY_GRAPHIC_CODE gc) |
Protected Member Functions | |
bool | doRandomMove (int turn_percent) |
Protected Attributes | |
Kernel & | m_kernel |
Environment & | m_environment |
int | m_x |
int | m_y |
direction_t | m_direction |
unsigned int | m_move_speed |
Role_t | m_role |
agent_state_t | m_agent_state |
std::list< Message > | m_messages |
OPENCITY_GRAPHIC_CODE | m_enumGC |
OpenCity's graphic code. | |
Private Attributes | |
AgentID_t | m_id |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Agent &agent) |
Definition at line 51 of file agent.h.
|
Returns the OpenCity's GRAPHIC_CODE of the agent Definition at line 264 of file agent.cpp. References m_enumGC. |
|
Move the agent accordingly to the current direction
Definition at line 287 of file agent.cpp. Referenced by randomMove(). |
|
Move the agent randomly
Definition at line 123 of file agent.cpp. References moveDirection(). |