Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
DisconnectManager Class Reference

#include <DisconnectManager.h>

Public Member Functions

 DisconnectManager ()
 
virtual ~DisconnectManager ()
 
void init ()
 
void update (ConnectionManager *conMgr)
 
void processDisconnectCommand (NetCommandRef *ref, ConnectionManager *conMgr)
 
void allCommandsReady (UnsignedInt frame, ConnectionManager *conMgr, Bool waitForPacketRouter=TRUE)
 
void nextFrame (UnsignedInt frame, ConnectionManager *conMgr)
 
Bool allowedToContinue ()
 Allow the next frame to go through?
 
void playerHasAdvancedAFrame (Int slot, UnsignedInt frame)
 this player has advanced to that frame.
 
void voteForPlayerDisconnect (Int slot, ConnectionManager *conMgr)
 
UnsignedInt getPingFrame ()
 
Int getPingsSent ()
 
Int getPingsRecieved ()
 

Protected Member Functions

void sendKeepAlive (ConnectionManager *conMgr)
 
void populateDisconnectScreen (ConnectionManager *conMgr)
 
Int translatedSlotPosition (Int slot, Int localSlot)
 
Int untranslatedSlotPosition (Int slot, Int localSlot)
 
void resetPlayerTimeouts (ConnectionManager *conMgr)
 
void resetPlayerTimeout (Int slot)
 
void resetPacketRouterTimeout ()
 
void updateDisconnectStatus (ConnectionManager *conMgr)
 
void disconnectPlayer (Int slot, ConnectionManager *conMgr)
 
void sendDisconnectCommand (Int slot, ConnectionManager *conMgr)
 
void sendVoteCommand (Int slot, ConnectionManager *conMgr)
 
void updateWaitForPacketRouter (ConnectionManager *conMgr)
 
void recalculatePacketRouterIndex (ConnectionManager *conMgr)
 
Bool allOnSameFrame (ConnectionManager *conMgr)
 returns true if all players are stuck on the same frame.
 
Bool isLocalPlayerNextPacketRouter (ConnectionManager *conMgr)
 returns true if the local player is next in line to be the packet router with all the players that have timed out being taken out of the picture.
 
Bool hasPlayerTimedOut (Int slot)
 returns true if this player has timed out.
 
void sendPlayerDestruct (Int slot, ConnectionManager *conMgr)
 send a destruct player network message.
 
Bool isPlayerVotedOut (Int slot, ConnectionManager *conMgr)
 returns true if this player has been voted out.
 
Bool isPlayerInGame (Int slot, ConnectionManager *conMgr)
 returns true if the player has neither timed out or been voted out.
 
UnsignedInt getMaxDisconnectFrame ()
 returns the highest frame that people have got to.
 
Int countVotesForPlayer (Int slot)
 return the number of disconnect votes a player has.
 
void resetPlayersVotes (Int playerID, UnsignedInt frame, ConnectionManager *conMgr)
 reset the votes for this player.
 
void turnOnScreen (ConnectionManager *conMgr)
 This gets called when the disconnect screen is first turned on.
 
void processDisconnectKeepAlive (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processDisconnectPlayer (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processPacketRouterQuery (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processPacketRouterAck (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processDisconnectVote (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processDisconnectFrame (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void processDisconnectScreenOff (NetCommandMsg *msg, ConnectionManager *conMgr)
 
void applyDisconnectVote (Int slot, UnsignedInt frame, Int castingSlot, ConnectionManager *conMgr)
 

Protected Attributes

UnsignedInt m_lastFrame
 
time_t m_lastFrameTime
 
DisconnectStateType m_disconnectState
 
UnsignedInt m_packetRouterFallback [MAX_SLOTS]
 
UnsignedInt m_currentPacketRouterIndex
 
time_t m_lastKeepAliveSendTime
 
time_t m_playerTimeouts [MAX_SLOTS - 1]
 
time_t m_packetRouterTimeout
 
DisconnectVoteStruct m_playerVotes [MAX_SLOTS][MAX_SLOTS]
 
UnsignedInt m_disconnectFrames [MAX_SLOTS]
 
Bool m_disconnectFramesReceived [MAX_SLOTS]
 
Bool m_haveNotifiedOtherPlayersOfCurrentFrame
 
time_t m_timeOfDisconnectScreenOn
 
Int m_pingsSent
 
Int m_pingsRecieved
 
UnsignedInt m_pingFrame
 

Detailed Description

Definition at line 48 of file DisconnectManager.h.

Constructor & Destructor Documentation

◆ DisconnectManager()

DisconnectManager::DisconnectManager ( )

Definition at line 44 of file DisconnectManager.cpp.

◆ ~DisconnectManager()

DisconnectManager::~DisconnectManager ( )
virtual

Definition at line 73 of file DisconnectManager.cpp.

Member Function Documentation

◆ allCommandsReady()

void DisconnectManager::allCommandsReady ( UnsignedInt frame,
ConnectionManager * conMgr,
Bool waitForPacketRouter = TRUE )

Definition at line 435 of file DisconnectManager.cpp.

◆ allOnSameFrame()

Bool DisconnectManager::allOnSameFrame ( ConnectionManager * conMgr)
protected

returns true if all players are stuck on the same frame.

Definition at line 645 of file DisconnectManager.cpp.

◆ allowedToContinue()

Bool DisconnectManager::allowedToContinue ( )

Allow the next frame to go through?

Definition at line 453 of file DisconnectManager.cpp.

◆ applyDisconnectVote()

void DisconnectManager::applyDisconnectVote ( Int slot,
UnsignedInt frame,
Int castingSlot,
ConnectionManager * conMgr )
protected

Definition at line 418 of file DisconnectManager.cpp.

◆ countVotesForPlayer()

Int DisconnectManager::countVotesForPlayer ( Int slot)
protected

return the number of disconnect votes a player has.

Definition at line 776 of file DisconnectManager.cpp.

◆ disconnectPlayer()

void DisconnectManager::disconnectPlayer ( Int slot,
ConnectionManager * conMgr )
protected

Definition at line 546 of file DisconnectManager.cpp.

◆ getMaxDisconnectFrame()

UnsignedInt DisconnectManager::getMaxDisconnectFrame ( )
protected

returns the highest frame that people have got to.

Definition at line 740 of file DisconnectManager.cpp.

◆ getPingFrame()

UnsignedInt DisconnectManager::getPingFrame ( )

Definition at line 187 of file DisconnectManager.cpp.

◆ getPingsRecieved()

Int DisconnectManager::getPingsRecieved ( )

Definition at line 197 of file DisconnectManager.cpp.

◆ getPingsSent()

Int DisconnectManager::getPingsSent ( )

Definition at line 192 of file DisconnectManager.cpp.

◆ hasPlayerTimedOut()

Bool DisconnectManager::hasPlayerTimedOut ( Int slot)
protected

returns true if this player has timed out.

Definition at line 691 of file DisconnectManager.cpp.

◆ init()

void DisconnectManager::init ( )

Definition at line 76 of file DisconnectManager.cpp.

◆ isLocalPlayerNextPacketRouter()

Bool DisconnectManager::isLocalPlayerNextPacketRouter ( ConnectionManager * conMgr)
protected

returns true if the local player is next in line to be the packet router with all the players that have timed out being taken out of the picture.

Definition at line 667 of file DisconnectManager.cpp.

◆ isPlayerInGame()

Bool DisconnectManager::isPlayerInGame ( Int slot,
ConnectionManager * conMgr )
protected

returns true if the player has neither timed out or been voted out.

Definition at line 750 of file DisconnectManager.cpp.

◆ isPlayerVotedOut()

Bool DisconnectManager::isPlayerVotedOut ( Int slot,
ConnectionManager * conMgr )
protected

returns true if this player has been voted out.

Definition at line 727 of file DisconnectManager.cpp.

◆ nextFrame()

void DisconnectManager::nextFrame ( UnsignedInt frame,
ConnectionManager * conMgr )

Definition at line 429 of file DisconnectManager.cpp.

◆ playerHasAdvancedAFrame()

void DisconnectManager::playerHasAdvancedAFrame ( Int slot,
UnsignedInt frame )

this player has advanced to that frame.

Definition at line 768 of file DisconnectManager.cpp.

◆ populateDisconnectScreen()

void DisconnectManager::populateDisconnectScreen ( ConnectionManager * conMgr)
protected

Definition at line 476 of file DisconnectManager.cpp.

◆ processDisconnectCommand()

void DisconnectManager::processDisconnectCommand ( NetCommandRef * ref,
ConnectionManager * conMgr )

Definition at line 270 of file DisconnectManager.cpp.

◆ processDisconnectFrame()

void DisconnectManager::processDisconnectFrame ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 357 of file DisconnectManager.cpp.

◆ processDisconnectKeepAlive()

void DisconnectManager::processDisconnectKeepAlive ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 289 of file DisconnectManager.cpp.

◆ processDisconnectPlayer()

void DisconnectManager::processDisconnectPlayer ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 297 of file DisconnectManager.cpp.

◆ processDisconnectScreenOff()

void DisconnectManager::processDisconnectScreenOff ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 397 of file DisconnectManager.cpp.

◆ processDisconnectVote()

void DisconnectManager::processDisconnectVote ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 344 of file DisconnectManager.cpp.

◆ processPacketRouterAck()

void DisconnectManager::processPacketRouterAck ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

< set it to screen on so that the next call to AllCommandsReady can set up everything for the next frame properly.

Definition at line 322 of file DisconnectManager.cpp.

◆ processPacketRouterQuery()

void DisconnectManager::processPacketRouterQuery ( NetCommandMsg * msg,
ConnectionManager * conMgr )
protected

Definition at line 304 of file DisconnectManager.cpp.

◆ recalculatePacketRouterIndex()

void DisconnectManager::recalculatePacketRouterIndex ( ConnectionManager * conMgr)
protected

Definition at line 636 of file DisconnectManager.cpp.

◆ resetPacketRouterTimeout()

void DisconnectManager::resetPacketRouterTimeout ( )
protected

Definition at line 527 of file DisconnectManager.cpp.

◆ resetPlayersVotes()

void DisconnectManager::resetPlayersVotes ( Int playerID,
UnsignedInt frame,
ConnectionManager * conMgr )
protected

reset the votes for this player.

Definition at line 792 of file DisconnectManager.cpp.

◆ resetPlayerTimeout()

void DisconnectManager::resetPlayerTimeout ( Int slot)
protected

Definition at line 523 of file DisconnectManager.cpp.

◆ resetPlayerTimeouts()

void DisconnectManager::resetPlayerTimeouts ( ConnectionManager * conMgr)
protected

Definition at line 513 of file DisconnectManager.cpp.

◆ sendDisconnectCommand()

void DisconnectManager::sendDisconnectCommand ( Int slot,
ConnectionManager * conMgr )
protected

Definition at line 583 of file DisconnectManager.cpp.

◆ sendKeepAlive()

void DisconnectManager::sendKeepAlive ( ConnectionManager * conMgr)
protected

Definition at line 460 of file DisconnectManager.cpp.

◆ sendPlayerDestruct()

void DisconnectManager::sendPlayerDestruct ( Int slot,
ConnectionManager * conMgr )
protected

send a destruct player network message.

Definition at line 706 of file DisconnectManager.cpp.

◆ sendVoteCommand()

void DisconnectManager::sendVoteCommand ( Int slot,
ConnectionManager * conMgr )
protected

Definition at line 608 of file DisconnectManager.cpp.

◆ translatedSlotPosition()

Int DisconnectManager::translatedSlotPosition ( Int slot,
Int localSlot )
protected

Definition at line 489 of file DisconnectManager.cpp.

◆ turnOnScreen()

void DisconnectManager::turnOnScreen ( ConnectionManager * conMgr)
protected

This gets called when the disconnect screen is first turned on.

Definition at line 531 of file DisconnectManager.cpp.

◆ untranslatedSlotPosition()

Int DisconnectManager::untranslatedSlotPosition ( Int slot,
Int localSlot )
protected

Definition at line 501 of file DisconnectManager.cpp.

◆ update()

void DisconnectManager::update ( ConnectionManager * conMgr)
Todo
: plug in some better measure here

Definition at line 102 of file DisconnectManager.cpp.

◆ updateDisconnectStatus()

void DisconnectManager::updateDisconnectStatus ( ConnectionManager * conMgr)
protected

Definition at line 203 of file DisconnectManager.cpp.

◆ updateWaitForPacketRouter()

void DisconnectManager::updateWaitForPacketRouter ( ConnectionManager * conMgr)
protected

Definition at line 254 of file DisconnectManager.cpp.

◆ voteForPlayerDisconnect()

void DisconnectManager::voteForPlayerDisconnect ( Int slot,
ConnectionManager * conMgr )

Definition at line 623 of file DisconnectManager.cpp.

Member Data Documentation

◆ m_currentPacketRouterIndex

UnsignedInt DisconnectManager::m_currentPacketRouterIndex
protected

Definition at line 111 of file DisconnectManager.h.

◆ m_disconnectFrames

UnsignedInt DisconnectManager::m_disconnectFrames[MAX_SLOTS]
protected

Definition at line 121 of file DisconnectManager.h.

◆ m_disconnectFramesReceived

Bool DisconnectManager::m_disconnectFramesReceived[MAX_SLOTS]
protected

Definition at line 122 of file DisconnectManager.h.

◆ m_disconnectState

DisconnectStateType DisconnectManager::m_disconnectState
protected

Definition at line 108 of file DisconnectManager.h.

◆ m_haveNotifiedOtherPlayersOfCurrentFrame

Bool DisconnectManager::m_haveNotifiedOtherPlayersOfCurrentFrame
protected

Definition at line 123 of file DisconnectManager.h.

◆ m_lastFrame

UnsignedInt DisconnectManager::m_lastFrame
protected

Definition at line 106 of file DisconnectManager.h.

◆ m_lastFrameTime

time_t DisconnectManager::m_lastFrameTime
protected

Definition at line 107 of file DisconnectManager.h.

◆ m_lastKeepAliveSendTime

time_t DisconnectManager::m_lastKeepAliveSendTime
protected

Definition at line 113 of file DisconnectManager.h.

◆ m_packetRouterFallback

UnsignedInt DisconnectManager::m_packetRouterFallback[MAX_SLOTS]
protected

Definition at line 110 of file DisconnectManager.h.

◆ m_packetRouterTimeout

time_t DisconnectManager::m_packetRouterTimeout
protected

Definition at line 116 of file DisconnectManager.h.

◆ m_pingFrame

UnsignedInt DisconnectManager::m_pingFrame
protected

Definition at line 128 of file DisconnectManager.h.

◆ m_pingsRecieved

Int DisconnectManager::m_pingsRecieved
protected

Definition at line 127 of file DisconnectManager.h.

◆ m_pingsSent

Int DisconnectManager::m_pingsSent
protected

Definition at line 126 of file DisconnectManager.h.

◆ m_playerTimeouts

time_t DisconnectManager::m_playerTimeouts[MAX_SLOTS - 1]
protected

Definition at line 115 of file DisconnectManager.h.

◆ m_playerVotes

DisconnectVoteStruct DisconnectManager::m_playerVotes[MAX_SLOTS][MAX_SLOTS]
protected

Definition at line 118 of file DisconnectManager.h.

◆ m_timeOfDisconnectScreenOn

time_t DisconnectManager::m_timeOfDisconnectScreenOn
protected

Definition at line 125 of file DisconnectManager.h.


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