Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gamenetwork): print the disconnect timer's clock, not half of it

Olcay Seygane8098b3ae7c6
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/DisconnectManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/DisconnectManager.cpp
index 26ef54d66..804abaf90 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/DisconnectManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/DisconnectManager.cpp
@@ -236,7 +236,12 @@ void DisconnectManager::updateDisconnectStatus(ConnectionManager *conMgr) {
m_haveNotifiedOtherPlayersOfCurrentFrame = TRUE;
}
- DEBUG_LOG(("DisconnectManager::updateDisconnectStatus - curTime = %d, m_timeOfDisconnectScreenOn = %d, curTime - m_timeOfDisconnectScreenOn = %d\n", curTime, m_timeOfDisconnectScreenOn, curTime - m_timeOfDisconnectScreenOn));
+ /* time_t is eight bytes here and %d eats four, so these three used to print the low
+ half of curTime, the high half of curTime, and then curTime again - the screen-on
+ stamp read as a permanent 0 and the difference never moved. A log that lies costs
+ more than no log at all. */
+ DEBUG_LOG(("DisconnectManager::updateDisconnectStatus - curTime = %d, m_timeOfDisconnectScreenOn = %d, curTime - m_timeOfDisconnectScreenOn = %d\n",
+ (Int)curTime, (Int)m_timeOfDisconnectScreenOn, (Int)(curTime - m_timeOfDisconnectScreenOn)));
if (m_timeOfDisconnectScreenOn != 0) {
if ((curTime - m_timeOfDisconnectScreenOn) > TheGlobalData->m_networkDisconnectScreenNotifyTime) {