Main Page   Class Hierarchy   Compound List   File List   Compound Members  

World Class Reference

Contains all the information needed for an asteroid to be run. More...

#include <world.h>

Collaboration diagram for World:

Collaboration graph
[legend]
List of all members.

Public Methods

 World (string const &name, char color=0, unsigned h=100, unsigned w=100, int cPlayer=0)
 ~World ()
vector< Tile > & getMap ()
Player & getCurrentPlayer ()
unsigned getCurrentPlayerIndex () const
int getHeight () const
int getWidth () const
unsigned getNumPlayers () const
int getNumBuildings () const
int getTemperature () const
Tile & getTile (unsigned x, unsigned y)
Tile & getTileFromPixel (int x, int y)
 Returns the tile corresponding to the position (x,y) in world coordinates. More...

Player & getPlayer (unsigned i)
void setTemperature (unsigned t)
bool parseMap (string &file)
bool playerExists (unsigned index) const
void addPlayer (const Player &p)
void addPlayer (unsigned id, string name, int race, char color)
void setCurrentPlayer (unsigned p)
 Sets the current (local) player for the game. More...

char * resource2string (Resource r)

Private Attributes

unsigned currentPlayer
unsigned height
unsigned width
int temperature
vector< Tile > map
vector< Player > players
vector< Tool > tools
vector< Building > buildings
Tile nullTile

Detailed Description

Contains all the information needed for an asteroid to be run.


Member Function Documentation

Tile & World::getTileFromPixel int    x,
int    y
 

Returns the tile corresponding to the position (x,y) in world coordinates.

World coordinates are measured in pixel units (but this doesn'y mean that they are relative to the screen origin ;) ).

Parameters:
x  the X world coordinate of the required position.
y  the Y world coordinate of the required position.
Returns:
the tile corresponding to position (x,y) in the map.

void World::setCurrentPlayer unsigned    p
 

Sets the current (local) player for the game.

Sets the current (local) player for the game to the one indicated in p. In case the indicated index exceeds the capacity of the players vector, it would expand it.

Parameters:
p  is the desired index for the new currentPlayer.


The documentation for this class was generated from the following files:
Generated on Thu Jun 6 17:22:24 2002 for Perihelion by doxygen1.2.15