MULTIPLAY Class Reference

#include <multiplay.h>

Collaboration diagram for MULTIPLAY:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MULTIPLAY ()
 ~MULTIPLAY ()
void UpdateSettings ()
bool Connect (string host)
void Disconnect ()
bool Host ()
void Update (double inc)
void Send (double inc)
int NumConnected ()
int MyNum ()
bool Server ()
void AddRecord (string newdofunction, float newval, int newstate)
CARSTATEGetCurState (int idx)
double GetTime (int idx)
bool StateToLoad (int idx)
void ClearStateToLoad (int idx)
CARSTATEGetLoadState (int idx)
void ReceiveState ()
bool TickCar (int idx)
bool NOOPTick (int idx)
int NumFuncs (int idx)
FUNCTION_MEMORYGetFuncMem (int i)
int GetTxRate ()
int GetRxRate ()
float GetLatency (int player)

Public Attributes

bool in_menu

Private Member Functions

bool Connected ()
bool ExchangeWorldInfo ()
int AddToData (void *dest, void *source, int len, int start)
int GetFromData (void *source, void *dest, int len, int start)
REPLAY_PACKETGetPacketArray (int idx)
bool PacketArrayValid (int idx)
double GetPacketArrayTime (int idx)
void QueuePacket ()
void SendPacketArray ()
void ReceivePacketArray ()
void UpdateFuncmem (int idx)
void ProcessPacket (PBUFFER *p)
void SendState ()
void ReadState (Uint8 *s, int slot)
int WriteVector (Vamos_Geometry::Three_Vector wv, Uint8 *dest, int start)
int WriteMatrix (Vamos_Geometry::Three_Matrix wv, Uint8 *dest, int start)
int ReadVector (Vamos_Geometry::Three_Vector &wv, Uint8 *source, int start)
int ReadMatrix (Vamos_Geometry::Three_Matrix &wv, Uint8 *source, int start)
void UpdateStats ()

Private Attributes

int remote_players
int remote_playernum
FUNCTION_MEMORYfuncmems [MAX_PLAYERS]
int fnums [MAX_PLAYERS]
double timeindex [MAX_PLAYERS]
CARSTATE curstates [MAX_PLAYERS]
CARSTATE loadstates [MAX_PLAYERS]
bool loadstatenow [MAX_PLAYERS]
REPLAY_PACKETpacketarrays [MAX_PLAYERS]
int numpackets [MAX_PLAYERS]
double nooptime [MAX_PLAYERS]
bool noopvalid [MAX_PLAYERS]
bool tickthisframe [MAX_PLAYERS]
bool nooptick [MAX_PLAYERS]
int curpackets [MAX_PLAYERS]
int tx
int rx
int port
CARSTATE dbgstate [MAX_STATES]
int dbgnumstates
REPLAY_PACKET dbgpacket [MAX_PACKETS]
int dbgnumpackets

Detailed Description

Definition at line 84 of file multiplay.h.


Constructor & Destructor Documentation

MULTIPLAY::MULTIPLAY  ) 
 

Definition at line 27 of file multiplay.cpp.

References fnums, funcmems, MAX_PLAYERS, NULL, remote_playernum, and remote_players.

MULTIPLAY::~MULTIPLAY  ) 
 

Definition at line 314 of file multiplay.cpp.

References funcmems, MAX_PLAYERS, NULL, and packetarrays.


Member Function Documentation

void MULTIPLAY::AddRecord string  newdofunction,
float  newval,
int  newstate
 

Definition at line 575 of file multiplay.cpp.

References FUNCTION_MEMORY::active, fnums, GetFuncMem(), FUNCTION_MEMORY::held, MP_DISABLEADDRECORD, FUNCTION_MEMORY::newval, NULL, NumConnected(), and timeindex.

int MULTIPLAY::AddToData void *  dest,
void *  source,
int  len,
int  start
[private]
 

Definition at line 552 of file multiplay.cpp.

Referenced by ExchangeWorldInfo(), SendPacketArray(), WriteMatrix(), and WriteVector().

void MULTIPLAY::ClearStateToLoad int  idx  )  [inline]
 

Definition at line 166 of file multiplay.h.

References loadstatenow.

bool MULTIPLAY::Connect string  host  ) 
 

Definition at line 73 of file multiplay.cpp.

References MESSAGEQ::AddMessage(), REPLAY::BuildFuncMem(), MESSAGEQ::Clear(), NET::Connect(), dbgnumpackets, dbgnumstates, Disconnect(), ExchangeWorldInfo(), fnums, funcmems, loadstatenow, loadstates, MAX_PLAYERS, mq1, net, nooptick, nooptime, noopvalid, numpackets, port, remote_players, replay, Server(), tickthisframe, CARSTATE::time, and timeindex.

bool MULTIPLAY::Connected  )  [inline, private]
 

Definition at line 87 of file multiplay.h.

References NET::Connected(), and net.

Referenced by Disconnect(), and Send().

void MULTIPLAY::Disconnect  ) 
 

Definition at line 276 of file multiplay.cpp.

References Connected(), dbgnumpackets, dbgnumstates, dbgpacket, dbgstate, NET::Disconnect(), GetFuncMem(), MAX_PLAYERS, MP_RECORD, MP_REMOTE_RECORD, net, NumFuncs(), remote_playernum, remote_players, replay, timeindex, REPLAY::WriteHeader(), and REPLAY::WritePackets().

Referenced by Connect(), and Host().

bool MULTIPLAY::ExchangeWorldInfo  )  [private]
 

Definition at line 331 of file multiplay.cpp.

References AddToData(), CONTROL_WORLDINFO, FUNCTION_CHARS, REPLAY::Get_FuncNetControl(), GAMESTATE::GetCarName(), GAMESTATE::GetCarPaint(), GetFuncMem(), GAMESTATE::GetTrackName(), NumConnected(), replay, and state.

Referenced by Connect().

CARSTATE* MULTIPLAY::GetCurState int  idx  )  [inline]
 

Definition at line 161 of file multiplay.h.

References curstates.

Referenced by SendState().

int MULTIPLAY::GetFromData void *  source,
void *  dest,
int  len,
int  start
[private]
 

Definition at line 564 of file multiplay.cpp.

Referenced by ProcessPacket(), ReadMatrix(), ReadState(), ReadVector(), ReceivePacketArray(), and ReceiveState().

FUNCTION_MEMORY* MULTIPLAY::GetFuncMem int  i  )  [inline]
 

Definition at line 175 of file multiplay.h.

References funcmems.

Referenced by AddRecord(), Disconnect(), ExchangeWorldInfo(), QueuePacket(), ReceiveState(), SendState(), and UpdateFuncmem().

float MULTIPLAY::GetLatency int  player  ) 
 

Definition at line 1379 of file multiplay.cpp.

References NumConnected(), and timeindex.

CARSTATE* MULTIPLAY::GetLoadState int  idx  )  [inline]
 

Definition at line 167 of file multiplay.h.

References loadstates.

REPLAY_PACKET* MULTIPLAY::GetPacketArray int  idx  )  [inline, private]
 

Definition at line 107 of file multiplay.h.

References packetarrays.

Referenced by GetPacketArrayTime(), QueuePacket(), ReceivePacketArray(), SendPacketArray(), and UpdateFuncmem().

double MULTIPLAY::GetPacketArrayTime int  idx  )  [private]
 

Definition at line 1305 of file multiplay.cpp.

References FrameTime(), GetPacketArray(), MP_DEBUG, numpackets, PACKET_ARRAY_FREQUENCY, and REPLAY_PACKET::time.

Referenced by SendPacketArray().

int MULTIPLAY::GetRxRate  ) 
 

Definition at line 1374 of file multiplay.cpp.

References NETSTAT_UPDATE_FREQUENCY, and rx.

Referenced by VAMOSWORLD::DrawHUD().

double MULTIPLAY::GetTime int  idx  )  [inline]
 

Definition at line 162 of file multiplay.h.

References timeindex.

int MULTIPLAY::GetTxRate  ) 
 

Definition at line 1369 of file multiplay.cpp.

References NETSTAT_UPDATE_FREQUENCY, and tx.

Referenced by VAMOSWORLD::DrawHUD().

bool MULTIPLAY::Host  ) 
 

Definition at line 111 of file multiplay.cpp.

References REPLAY::BuildFuncMem(), NET::Connect(), Disconnect(), fnums, funcmems, net, port, remote_playernum, and replay.

int MULTIPLAY::MyNum  )  [inline]
 

Definition at line 158 of file multiplay.h.

References remote_playernum.

Referenced by SelectCar().

bool MULTIPLAY::NOOPTick int  idx  )  [inline]
 

Definition at line 172 of file multiplay.h.

References nooptick.

int MULTIPLAY::NumConnected  ) 
 

Definition at line 546 of file multiplay.cpp.

References remote_players.

Referenced by AddRecord(), VAMOSWORLD::DrawHUD(), ExchangeWorldInfo(), GetLatency(), MainPause(), SelectCar(), and Update().

int MULTIPLAY::NumFuncs int  idx  )  [inline]
 

Definition at line 174 of file multiplay.h.

References fnums.

Referenced by Disconnect().

bool MULTIPLAY::PacketArrayValid int  idx  )  [inline, private]
 

Definition at line 109 of file multiplay.h.

References numpackets.

void MULTIPLAY::ProcessPacket PBUFFER p  )  [private]
 

Definition at line 618 of file multiplay.cpp.

References PBUFFER::data, REPLAY::Get_FuncStateInfo(), GetFromData(), PBUFFER::len, NET_DEBUG, and replay.

void MULTIPLAY::QueuePacket  )  [private]
 

Definition at line 1044 of file multiplay.cpp.

References CHAR_FUNCNUM, CHAR_STATE, REPLAY_PACKET::chardata, GetFuncMem(), GetPacketArray(), FUNCTION_MEMORY::newval, numpackets, timeindex, and REPLAY_PACKET::val.

Referenced by Send().

int MULTIPLAY::ReadMatrix Vamos_Geometry::Three_Matrix wv,
Uint8 *  source,
int  start
[private]
 

Definition at line 854 of file multiplay.cpp.

References GetFromData().

void MULTIPLAY::ReadState Uint8 *  s,
int  slot
[private]
 

Definition at line 773 of file multiplay.cpp.

References CARSTATE::fnum, CARSTATE::funcmem, REPLAY::Get_FuncStateInfo(), GetFromData(), loadstates, NET_DEBUG, NULL, and replay.

Referenced by ReceiveState().

int MULTIPLAY::ReadVector Vamos_Geometry::Three_Vector wv,
Uint8 *  source,
int  start
[private]
 

Definition at line 841 of file multiplay.cpp.

References GetFromData().

void MULTIPLAY::ReceivePacketArray  )  [private]
 

Definition at line 1160 of file multiplay.cpp.

References PBUFFER::Clear(), curpackets, PBUFFER::data, dbgnumpackets, dbgpacket, FrameTime(), REPLAY::Get_FuncPacketArray(), NET::GetBuffer(), GetFromData(), NET::GetMaxBuffers(), GetPacketArray(), MP_RECORD, MP_REMOTE_RECORD, net, NET_DEBUG, numpackets, PACKET_ARRAY_FREQUENCY, replay, REPLAY_PACKET::time, timeindex, and PBUFFER::Valid().

void MULTIPLAY::ReceiveState  ) 
 

Definition at line 901 of file multiplay.cpp.

References FUNCTION_MEMORY_SYNC::active, FUNCTION_MEMORY::active, PBUFFER::Clear(), CARSTATE::CopyFrom(), PBUFFER::data, dbgnumstates, dbgstate, FrameTime(), CARSTATE::funcmem, REPLAY::Get_FuncStateInfo(), NET::GetBuffer(), GetFromData(), GetFuncMem(), NET::GetMaxBuffers(), FUNCTION_MEMORY_SYNC::held, FUNCTION_MEMORY::held, FUNCTION_MEMORY_SYNC::lastupdateat, FUNCTION_MEMORY::lastupdateat, loadstatenow, loadstates, MP_RECORD, MP_REMOTE_RECORD, net, NET_DEBUG, FUNCTION_MEMORY_SYNC::newval, FUNCTION_MEMORY::newval, ReadState(), replay, STATE_FREQUENCY, CARSTATE::time, timeindex, and PBUFFER::Valid().

void MULTIPLAY::Send double  inc  ) 
 

Definition at line 875 of file multiplay.cpp.

References Connected(), in_menu, MP_DBGDEEP, MP_DISABLESEND, QueuePacket(), SendPacketArray(), SendState(), and timeindex.

Referenced by Update().

void MULTIPLAY::SendPacketArray  )  [private]
 

Definition at line 1095 of file multiplay.cpp.

References AddToData(), dbgnumpackets, dbgpacket, FrameTime(), REPLAY::Get_FuncNoop(), REPLAY::Get_FuncPacketArray(), GetPacketArray(), GetPacketArrayTime(), MAX_PACKET_SIZE, MP_RECORD, MP_REMOTE_RECORD, net, NET_DEBUG, numpackets, PACKET_ARRAY_FREQUENCY, replay, NET::Send(), and timeindex.

Referenced by Send().

void MULTIPLAY::SendState  )  [private]
 

Definition at line 654 of file multiplay.cpp.

References FUNCTION_MEMORY::active, FUNCTION_MEMORY_SYNC::active, curstates, CARSTATE::fnum, fnums, FrameTime(), CARSTATE::funcmem, GetCurState(), GetFuncMem(), FUNCTION_MEMORY::held, FUNCTION_MEMORY_SYNC::held, FUNCTION_MEMORY::lastupdateat, FUNCTION_MEMORY_SYNC::lastupdateat, net, NET_DEBUG, FUNCTION_MEMORY::newval, FUNCTION_MEMORY_SYNC::newval, NULL, NET::NumBufferedPackets(), STATE_FREQUENCY, CARSTATE::time, and timeindex.

Referenced by Send().

bool MULTIPLAY::Server  ) 
 

Definition at line 68 of file multiplay.cpp.

References net, and NET::Server().

Referenced by Connect().

bool MULTIPLAY::StateToLoad int  idx  )  [inline]
 

Definition at line 165 of file multiplay.h.

References loadstatenow.

bool MULTIPLAY::TickCar int  idx  )  [inline]
 

Definition at line 171 of file multiplay.h.

References MP_DISABLETICK, and tickthisframe.

Referenced by VAMOSWORLD::PhysUpdate().

void MULTIPLAY::Update double  inc  ) 
 

Definition at line 123 of file multiplay.cpp.

References MP_DBGDEEP, NULL, NumConnected(), PACKET_ARRAY_SIZE, and packetarrays.

void MULTIPLAY::UpdateFuncmem int  idx  )  [private]
 

Definition at line 1326 of file multiplay.cpp.

References FUNCTION_MEMORY::active, CHAR_FUNCNUM, CHAR_STATE, REPLAY_PACKET::chardata, curpackets, FrameTime(), FUNCTION_MEMORY::func_name, GetFuncMem(), GetPacketArray(), FUNCTION_MEMORY::held, FUNCTION_MEMORY::newval, NULL, numpackets, timeindex, and REPLAY_PACKET::val.

void MULTIPLAY::UpdateSettings  ) 
 

Definition at line 63 of file multiplay.cpp.

References SETTINGS::Get(), port, and settings.

void MULTIPLAY::UpdateStats  )  [private]
 

Definition at line 1389 of file multiplay.cpp.

References NET::ClearStats(), FrameTime(), NET::GetRxBytes(), NET::GetTxBytes(), net, NETSTAT_UPDATE_FREQUENCY, rx, timeindex, and tx.

int MULTIPLAY::WriteMatrix Vamos_Geometry::Three_Matrix  wv,
Uint8 *  dest,
int  start
[private]
 

Definition at line 751 of file multiplay.cpp.

References AddToData().

int MULTIPLAY::WriteVector Vamos_Geometry::Three_Vector  wv,
Uint8 *  dest,
int  start
[private]
 

Definition at line 738 of file multiplay.cpp.

References AddToData().


Member Data Documentation

int MULTIPLAY::curpackets[MAX_PLAYERS] [private]
 

Definition at line 117 of file multiplay.h.

Referenced by ReceivePacketArray(), and UpdateFuncmem().

CARSTATE MULTIPLAY::curstates[MAX_PLAYERS] [private]
 

Definition at line 99 of file multiplay.h.

Referenced by GetCurState(), and SendState().

int MULTIPLAY::dbgnumpackets [private]
 

Definition at line 146 of file multiplay.h.

Referenced by Connect(), Disconnect(), ReceivePacketArray(), and SendPacketArray().

int MULTIPLAY::dbgnumstates [private]
 

Definition at line 144 of file multiplay.h.

Referenced by Connect(), Disconnect(), and ReceiveState().

REPLAY_PACKET MULTIPLAY::dbgpacket[MAX_PACKETS] [private]
 

Definition at line 145 of file multiplay.h.

Referenced by Disconnect(), ReceivePacketArray(), and SendPacketArray().

CARSTATE MULTIPLAY::dbgstate[MAX_STATES] [private]
 

Definition at line 143 of file multiplay.h.

Referenced by Disconnect(), and ReceiveState().

int MULTIPLAY::fnums[MAX_PLAYERS] [private]
 

Definition at line 93 of file multiplay.h.

Referenced by AddRecord(), Connect(), Host(), MULTIPLAY(), NumFuncs(), and SendState().

FUNCTION_MEMORY* MULTIPLAY::funcmems[MAX_PLAYERS] [private]
 

Definition at line 92 of file multiplay.h.

Referenced by Connect(), GetFuncMem(), Host(), MULTIPLAY(), and ~MULTIPLAY().

bool MULTIPLAY::in_menu
 

Definition at line 163 of file multiplay.h.

Referenced by Send().

bool MULTIPLAY::loadstatenow[MAX_PLAYERS] [private]
 

Definition at line 104 of file multiplay.h.

Referenced by ClearStateToLoad(), Connect(), ReceiveState(), and StateToLoad().

CARSTATE MULTIPLAY::loadstates[MAX_PLAYERS] [private]
 

Definition at line 100 of file multiplay.h.

Referenced by Connect(), GetLoadState(), ReadState(), and ReceiveState().

bool MULTIPLAY::nooptick[MAX_PLAYERS] [private]
 

Definition at line 116 of file multiplay.h.

Referenced by Connect(), and NOOPTick().

double MULTIPLAY::nooptime[MAX_PLAYERS] [private]
 

Definition at line 113 of file multiplay.h.

Referenced by Connect().

bool MULTIPLAY::noopvalid[MAX_PLAYERS] [private]
 

Definition at line 114 of file multiplay.h.

Referenced by Connect().

int MULTIPLAY::numpackets[MAX_PLAYERS] [private]
 

Definition at line 112 of file multiplay.h.

Referenced by Connect(), GetPacketArrayTime(), PacketArrayValid(), QueuePacket(), ReceivePacketArray(), SendPacketArray(), and UpdateFuncmem().

REPLAY_PACKET* MULTIPLAY::packetarrays[MAX_PLAYERS] [private]
 

Definition at line 106 of file multiplay.h.

Referenced by GetPacketArray(), Update(), and ~MULTIPLAY().

int MULTIPLAY::port [private]
 

Definition at line 140 of file multiplay.h.

Referenced by Connect(), Host(), and UpdateSettings().

int MULTIPLAY::remote_playernum [private]
 

Definition at line 90 of file multiplay.h.

Referenced by Disconnect(), Host(), MULTIPLAY(), and MyNum().

int MULTIPLAY::remote_players [private]
 

Definition at line 89 of file multiplay.h.

Referenced by Connect(), Disconnect(), MULTIPLAY(), and NumConnected().

int MULTIPLAY::rx [private]
 

Definition at line 138 of file multiplay.h.

Referenced by GetRxRate(), and UpdateStats().

bool MULTIPLAY::tickthisframe[MAX_PLAYERS] [private]
 

Definition at line 115 of file multiplay.h.

Referenced by Connect(), and TickCar().

double MULTIPLAY::timeindex[MAX_PLAYERS] [private]
 

Definition at line 98 of file multiplay.h.

Referenced by AddRecord(), Connect(), Disconnect(), GetLatency(), GetTime(), QueuePacket(), ReceivePacketArray(), ReceiveState(), Send(), SendPacketArray(), SendState(), UpdateFuncmem(), and UpdateStats().

int MULTIPLAY::tx [private]
 

Definition at line 138 of file multiplay.h.

Referenced by GetTxRate(), and UpdateStats().


The documentation for this class was generated from the following files:
Generated on Thu Oct 19 04:12:06 2006 by  doxygen 1.4.6