![]() |
![]() ![]() |
Apocalypse mirror
Sourceforge mirror |
News | Info | Characters | Arenas | Screenshots | Forums | Download | ||||
Developer: | Making of | Character-HOWTO | AI Design | Submit a Character | |||
Documentation: | Main Page | Modules | Class Hierarchy | Class List | File List |
#include <MortalNetworkImpl.h>
Inheritance diagram for CMortalNetworkImpl:
Public Member Functions | |
CMortalNetworkImpl () | |
virtual | ~CMortalNetworkImpl () |
bool | Start (const char *a_pcServerName) |
void | Stop () |
bool | IsConnectionAlive () |
void | Update () |
const char * | GetLastError () |
bool | IsMaster () |
const char * | GetRemoteUsername () |
void | SendMsg (const char *a_pcMsg) |
bool | IsMsgAvailable () |
const char * | GetMsg () |
bool | IsRemoteFighterAvailable (FighterEnum a_enFighter) |
FighterEnum | GetRemoteFighter () |
bool | IsRemoteSideReady () |
void | SendFighter (FighterEnum a_enFighter) |
void | SendReady () |
void | SendGameParams (int a_iGameSpeed, int a_iGameTime, int a_iHitPoints, int a_iBackgroundNumber) |
SGameParams | GetGameParams () |
bool | SynchStartRound () |
void | SendGameData (const char *a_pcGameData) |
const char * | GetLatestGameData () |
void | SendKeystroke (int a_iTime, int a_iKey, bool a_bPressed) |
bool | GetKeystroke (int &a_riOutTime, int &a_riOutKey, bool &a_rbPressed) |
void | SendGameTick (int a_iGameTick) |
int | GetGameTick () |
void | SendHurryup (int a_iHurryUpCode) |
int | GetHurryup () |
void | SendRoundOver (int a_iWhoWon, bool a_bGameOver) |
int | GetWhoWon () |
bool | IsRoundOver () |
bool | IsGameOver () |
Protected Types | |
enum | TNetworkState { NS_DISCONNECTED, NS_CHARACTER_SELECTION, NS_IN_GAME } |
Protected Member Functions | |
void | SendRawData (char a_cID, const void *a_pData, int a_iLength) |
All sent data must go through this method. | |
void | ReceiveMsg (void *a_pData, int a_iLength) |
void | ReceiveRemoteUserName (void *a_pData, int a_iLength) |
void | ReceiveGameData (void *a_pData, int a_iLength) |
void | ReceiveKeystroke (void *a_pData, int a_iLength) |
void | ReceiveFighter (void *a_pData, int a_iLength) |
void | ReceiveReady (void *a_pData, int a_iLength) |
void | ReceiveRoundOver (void *a_pData, int a_iLength) |
void | ReceiveGameTick (void *a_pData, int a_iLength) |
void | ReceiveHurryup (void *a_pData, int a_iLength) |
void | ReceiveRemoteFighterAvailable (void *a_pData, int a_iLength) |
void | ReceiveRemoteFighterQuery (void *a_pData, int a_iLength) |
void | ReceiveGameParams (void *a_pData, int a_iLength) |
Protected Attributes | |
bool | m_bNetworkAvailable |
Is the networking API initialized correctly? | |
TNetworkState | m_enState |
The current state. | |
bool | m_bServer |
We are the server side. | |
bool | m_bMaster |
We are the master side. (Initially the server side). | |
TCPsocket | m_poSocket |
The TCP/IP network socket. | |
SDLNet_SocketSet | m_poSocketSet |
SDLNet construct for watching the socket. | |
char | m_acIncomingBuffer [2048] |
Received data goes here. | |
int | m_iIncomingBufferSize |
How much of the buffer is filled? | |
std::string | m_sLastError |
The last error message from SDLNet. | |
TStringList | m_asMsgs |
Incoming chatlines. | |
std::string | m_sRemoteUserName |
TIntList | m_aiAvailableRemoteFighters |
FighterEnum | m_enRemoteFighter |
bool | m_bRemoteReady |
SGameParams | m_oGameParams |
std::string | m_sLatestGameData |
TIntList | m_aiKeyTimes |
TIntList | m_aiKeystrokes |
TIntList | m_abKeystrokes |
bool | m_bRoundOver |
int | m_iWhoWon |
bool | m_bGameOver |
int | m_iGameTick |
int | m_iHurryupCode |
bool | m_bSynchQueryResponse |
SUMMARY OF MESSAGES:
I <version> <username> - Introduction sent both ways on connection. U <text> - Remote user's name M <text> - Incoming Msg text.
S - Ready for the next round (synch). G <text> - Update on the game backend data. T <number> <number> - Update the game time and game phase. K <number> <bool> - Key # up/down H <number> - Hurryup and other special messages O <number> <bool> - The round is over (who won, are there more rounds).
F <number> - I have switched to fighter X. R - I have chosen a fighter. Q <number> - Is fighter X available? A <number> - Fighter A is available. P <number> x3 - Game parameters
|
|
|
|
|
|
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
All sent data must go through this method. It ensures the well-formed header for the data. The header itself looks like this: ID char Length Uint16 Reserved char This is followed by as many bytes as the Length is. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
Implements CMortalNetwork. |
|
|
|
Received data goes here.
|
|
|
|
|
|
|
|
Incoming chatlines.
|
|
|
|
We are the master side. (Initially the server side).
|
|
Is the networking API initialized correctly?
|
|
|
|
|
|
We are the server side.
|
|
|
|
|
|
The current state.
|
|
|
|
|
|
How much of the buffer is filled?
|
|
|
|
|
|
The TCP/IP network socket.
|
|
SDLNet construct for watching the socket.
|
|
The last error message from SDLNet.
|
|
|
|
|