Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Core/GameEngine/Include/GameNetwork/DisconnectManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class DisconnectManager

void init();
void update(ConnectionManager *conMgr);
#if defined(GENERALS_ONLINE)
time_t getTimeOfDisconnectScreenOn() const { return m_timeOfDisconnectScreenOn; }
#endif

void processDisconnectCommand(NetCommandRef *ref, ConnectionManager *conMgr);
void allCommandsReady(UnsignedInt frame, ConnectionManager *conMgr, Bool waitForPacketRouter = TRUE);
Expand Down
3 changes: 3 additions & 0 deletions Core/GameEngine/Source/GameNetwork/DisconnectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ Int DisconnectManager::getPingsReceived()


void DisconnectManager::updateDisconnectStatus(ConnectionManager *conMgr) {
#if defined(GENERALS_ONLINE)
TheDisconnectMenu->updateTwoPlayerVoteButtonState(conMgr);
#endif
for (Int i = 0; i < MAX_SLOTS; ++i) {
if (conMgr->isPlayerConnected(i)) {
Int slot = translatedSlotPosition(i, conMgr->getLocalPlayerID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class DisconnectMenu {
void removePlayer(Int slot, UnicodeString playerName);
void voteForPlayer(Int slot);
void updateVotes(Int slot, Int votes);
#if defined(GENERALS_ONLINE)
void updateTwoPlayerVoteButtonState(ConnectionManager* conMgr);
#endif

protected:
DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,19 @@ void DisconnectMenu::updateVotes(Int slot, Int votes) {
GadgetStaticTextSetText(control, unistr);
}
}

#if defined(GENERALS_ONLINE)
// Wait 10 seconds after the disconnect screen comes up before allowing the vote buttons to be enabled in 2 player situations
void DisconnectMenu::updateTwoPlayerVoteButtonState(ConnectionManager* conMgr) {
if (m_disconnectManager == nullptr || conMgr->getNumPlayers() != 2)
return;

Bool allowed = (timeGetTime() - m_disconnectManager->getTimeOfDisconnectScreenOn()) >= 10000;
for (Int i = 0; m_playerVoteButtonControlNames[i] != nullptr; ++i) {
NameKeyType id = TheNameKeyGenerator->nameToKey(m_playerVoteButtonControlNames[i]);
GameWindow* control = TheWindowManager->winGetWindowFromId(nullptr, id);
if (control != nullptr && control->winIsHidden() == FALSE)
control->winEnable(allowed);
}
}
#endif
Loading