GameHandler Class Reference

Manages connections to game client. More...

#include <gamehandler.hpp>

Inheritance diagram for GameHandler:

ConnectionHandler

List of all members.

Public Member Functions

 GameHandler ()
 Constructor.
bool startListen (enet_uint16 port)
 Starts the handler.
void sendTo (Character *, MessageOut &msg)
 Sends message to the given character.
void kill (Character *)
 Kills connection with given character.
void prepareServerChange (Character *)
 Prepares a server change for given character.
void completeServerChange (int id, const std::string &token, const std::string &address, int port)
 Completes a server change for given character ID.
void updateCharacter (int charid, int partyid)
 Updates the party id of the character.
void addPendingCharacter (const std::string &token, Character *)
 Registers a character that should soon be claimed by a client.
void tokenMatched (GameClient *computer, Character *character)
 Combines a client with its character.
void deletePendingClient (GameClient *computer)
 Deletes a pending client's data.
void deletePendingConnect (Character *character)
 Deletes a pending connection's data.
GameClient * getClientByNameSlow (const std::string &)
 Gets the client associated to a character name.

Protected Member Functions

NetComputercomputerConnected (ENetPeer *)
 Called when a computer connects to the server.
void computerDisconnected (NetComputer *)
 Called when a computer reconnects to the server.
void sendError (NetComputer *computer, int id, std::string errorMsg)
 Send error message back to player.
void processMessage (NetComputer *computer, MessageIn &message)
 Processes messages related to core game events.
void handleWalk (GameClient *client, MessageIn &message)
 Set the position a player wants to move to.
void handleSendPost (GameClient *client, MessageIn &message)
 Send a letter.
void handleGetPost (GameClient *client, MessageIn &message)
 Retrieve a letter.


Detailed Description

Manages connections to game client.

Definition at line 49 of file gamehandler.hpp.


Member Function Documentation

void GameHandler::addPendingCharacter ( const std::string &  token,
Character ch 
)

Registers a character that should soon be claimed by a client.

Parameters:
token token used by the client when connecting.

Definition at line 580 of file gamehandler.cpp.

References TokenCollector< Handler, Client, ServerData >::addPendingConnect(), ConnectionHandler::clients, Character::getDatabaseID(), and kill().

Referenced by AccountConnection::processMessage().

void GameHandler::tokenMatched ( GameClient *  computer,
Character character 
)

Combines a client with its character.

(Needed for TokenCollector)

Definition at line 618 of file gamehandler.cpp.

References kill(), Character::modifiedAttribute(), Character::setClient(), and MessageOut::writeByte().

void GameHandler::deletePendingClient ( GameClient *  computer  ) 

Deletes a pending client's data.

(Needed for TokenCollector)

Definition at line 647 of file gamehandler.cpp.

References MessageOut::writeByte().

void GameHandler::deletePendingConnect ( Character character  ) 

Deletes a pending connection's data.

(Needed for TokenCollector)

Definition at line 659 of file gamehandler.cpp.

GameClient * GameHandler::getClientByNameSlow ( const std::string &  name  ) 

Gets the client associated to a character name.

This method is slow, so it should never be called for regular operations.

Definition at line 664 of file gamehandler.cpp.

References ConnectionHandler::clients, and Character::getName().

NetComputer * GameHandler::computerConnected ( ENetPeer *  peer  )  [protected, virtual]

Called when a computer connects to the server.

Initialize an object derived of NetComputer.

Implements ConnectionHandler.

Definition at line 59 of file gamehandler.cpp.

void GameHandler::computerDisconnected ( NetComputer  )  [protected, virtual]

Called when a computer reconnects to the server.

Called when a computer disconnects from the server.

Note: After returning from this method the NetComputer reference is no longer guaranteed to be valid.

Implements ConnectionHandler.

Definition at line 64 of file gamehandler.cpp.

References TokenCollector< Handler, Client, ServerData >::deletePendingClient(), and AccountConnection::sendCharacterData().


The documentation for this class was generated from the following files:

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5