Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Environment Class Reference

#include <environment.h>

List of all members.

Public Member Functions

 Environment (unsigned int width, unsigned int height, Layer *pBL, Kernel *kernel)
unsigned int getHeight () const
unsigned int getWidth () const
void displayAgent ()
void registerAgent (Agent *agent, int x, int y)
void unregisterAgent (Agent *agent)
AgentgetAgentAt (int x, int y)
bool hasAgentAt (const Agent *agent, int x, int y) const
bool moveAgent (Agent *agent, int x, int y)
const bool findShortestPath (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, std::vector< Destination > &rvdest)
StructuregetBuildingXY (unsigned int x, unsigned int y)

Static Public Member Functions

static unsigned int toSquareDistance (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)

Private Types

typedef std::map< Agent *,
AgentPosition >::iterator 
typedef std::vector< Agent
* >::iterator 
typedef std::vector< Agent
* >::const_iterator 

Private Attributes

unsigned int m_width
 Width of the map.
unsigned int m_height
 Height of the map.
std::map< Agent *, AgentPositionm_last_pos
std::vector< Agent * > m_vector

Detailed Description

This is the environment of the Multi-Agent System.

Definition at line 62 of file environment.h.

Constructor & Destructor Documentation

Environment::Environment unsigned int  width,
unsigned int  height,
Layer pBL,
Kernel kernel

Create a new Environment instance with the specified width, and height.

The specified width and height must be equal to the width and the height of the specified Layer respectively
See also:

Definition at line 99 of file environment.cpp.

References m_height, and m_width.

Member Function Documentation

void Environment::displayAgent  ) 

Display all the registered agents.

See also:

Definition at line 114 of file environment.cpp.

References GraphicManager::DisplayAgent(), Kernel::getStep(), Agent::getX(), Agent::getY(), and GlobalVar::gpGraphicMgr.

const bool Environment::findShortestPath unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2,
std::vector< Destination > &  rvdest

Return the shortest path between 2 points. The length of the path is limited to MAX_PATH_LENGTH

See also:

Definition at line 211 of file environment.cpp.

References PathFinder::findShortestPath(), and GlobalVar::gpPathFinder.

unsigned int Environment::toSquareDistance unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2

Calculate the square of the euclidian distance between 2 points

The square of the euclidian distance

Definition at line 238 of file environment.cpp.

The documentation for this class was generated from the following files:
Generated on Sat Nov 11 10:21:11 2006 for OpenCity by  doxygen 1.4.2