Main Page   Class Hierarchy   Compound List   File List   Compound Members  

SWorld Class Reference

The World according to the server. More...

#include <periserver.h>

Collaboration diagram for SWorld:

Collaboration graph
[legend]
List of all members.

Public Methods

 SWorld ()
 constructor.

 ~SWorld ()
 destructor.

bool parseMap (string &map)
 parse the map.

void run ()
 run.


Private Methods

void upDatePlayerPos (unsigned ID, int pX, int pY, int d)
 update the player positions.

void addPlayer (unsigned index, string name, Race r, char color)
 add a new player to the game.

void addPlayer (const SPlayer &p)
 add a new player to the game.

void deletePlayer (unsigned i)
 delete a player from the game.

Tile & getTile (unsigned i, unsigned j)
 get a tile from the map.

void getNewClients ()
 gets new clients from the networking module and sets them up.

void processMessage (string msg, int playerIndex)
 get a single message and process it.

void processMessagea (string c)
 process the a message the a message is the general move character message Message Form: appxxxxxyyyyyd pp = player ID | xxxxx = position in x | yyyyy = position in y | d = direction in cardinal points. More...

void processMessageb (string c)
 process the b message the b message is the general request resource message Message Form: bpprrxxxyyy##### pp = player ID | rr = resource | xxx = tile in x | yyy = tile in y | ##### = amount of resources. More...

void processMessagec (string c)
 process the c message the c message is the general request tool message Message Form: cppxxxyyy pp = player ID | xxx = tile location of the tool in x | yyy = tile location of the tool in y. More...

void processMessagef (string c)
 process the f message the f message is the place a new building message Message Form: fppttxxxyyy pp = player ID tt = building type xxx = tile location of the building in x yyy = tile location of the building in y.

void processMessageg (string c)
 process the g message the g message is the get resource from building message Message Form: gpprraaaaaxxxyyy pp = player ID rr = resource aaaaa = amount of resource xxx = tile location of the building in x yyy = tile location of the building in y.

void processMessagei (string c, unsigned client)
 process the i message the m message is the "request information about a player" message Message Form: ipp pp = player ID. More...

void processMessagem (string c)
 process the m message the m message is the add player message Message Form: mnnnnnrc nnnn... More...

void processMessagen (string c)
 process the n message the n message is the remove player message Message Form: npp pp = player ID. More...

void processMessageq (string c)
 process the q message the q message is the request cost of items Message Form: qpp pp = player ID. More...

void processMessaget (string c, int playerIndex)
 process the t message the t message is the chat message Message Form: tmmmmmmmm... More...

void processMessager (string c)
 process the r message the r message is the trade message Message Form: rpptrraaaaa.

void processMessages (string c)
 process the s message the s message is the shop message Message Form: rpptrraaaaa.

void processMessagex (string c)
 process the x message the x message is the blank message Message Form: x. More...

string buildMessageA (unsigned p, int x, int y, int d)
 build the A message the A message is update Player Position Message Message Form: Appxxxxxyyyyyd p = player id x = x position y = y position d = direction.

string buildMessageB (unsigned p, Resource r, char c, int a)
string buildMessageC (unsigned p, ToolType t)
string buildMessageD (ToolType t, int x, int y)
string buildMessageE (Resource r, int x, int y)
string buildMessageU ()

Private Attributes

vector< SPlayerplayers
unsigned height
unsigned width
vector< Tile > map
int temperature
NetManagerServer net
string mapName

Detailed Description

The World according to the server.


Member Function Documentation

void SWorld::processMessagea string    c [private]
 

process the a message the a message is the general move character message Message Form: appxxxxxyyyyyd pp = player ID | xxxxx = position in x | yyyyy = position in y | d = direction in cardinal points.

the a message is the general move character message Message Form: appxxxxxyyyyyd pp = player ID | xxxxx = position in x | yyyyy = position in y | d = direction in cardinal points

void SWorld::processMessageb string    c [private]
 

process the b message the b message is the general request resource message Message Form: bpprrxxxyyy##### pp = player ID | rr = resource | xxx = tile in x | yyy = tile in y | ##### = amount of resources.

the b message is the general request resource message Message Form: bpprrxxxyyy##### pp = player ID | rr = resource | xxx = tile in x | yyy = tile in y | ##### = amount of resources

void SWorld::processMessagec string    c [private]
 

process the c message the c message is the general request tool message Message Form: cppxxxyyy pp = player ID | xxx = tile location of the tool in x | yyy = tile location of the tool in y.

the c message is the general request tool message

Message Form: cppxxxyyy

pp = player ID | xxx = tile location of the tool in x |

yyy = tile location of the tool in y

void SWorld::processMessagei string    c,
unsigned    client
[private]
 

process the i message the m message is the "request information about a player" message Message Form: ipp pp = player ID.

Parameters:
the  message string.
client  the index of the message sender.

void SWorld::processMessagem string    c [private]
 

process the m message the m message is the add player message Message Form: mnnnnnrc nnnn...

= player name ends in a '
' | r = race in int | c = color

void SWorld::processMessagen string    c [private]
 

process the n message the n message is the remove player message Message Form: npp pp = player ID.

the n message is the remove player message Message Form: npp pp = player ID

void SWorld::processMessageq string    c [private]
 

process the q message the q message is the request cost of items Message Form: qpp pp = player ID.

the q message is the request cost of items Message Form: qpp pp = player ID

void SWorld::processMessaget string    c,
int    playerIndex
[private]
 

process the t message the t message is the chat message Message Form: tmmmmmmmm...

mmmmmm... = message from client

void SWorld::processMessagex string    c [private]
 

process the x message the x message is the blank message Message Form: x.

the x message is the blank message Message Form: x


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