From be7eccbae3442fb2f0392ee91784bdadc8f6627e Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Sun, 29 Aug 2004 17:15:10 +0000 Subject: [PATCH] Worked around the PlayerNames to decrease game-time scoreboard updates. --- stepmania/src/NetworkSyncManager.cpp | 21 ++++++++++++++++++++- stepmania/src/NetworkSyncManager.h | 7 ++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/stepmania/src/NetworkSyncManager.cpp b/stepmania/src/NetworkSyncManager.cpp index ba418e3eb8..b1a1723a36 100644 --- a/stepmania/src/NetworkSyncManager.cpp +++ b/stepmania/src/NetworkSyncManager.cpp @@ -62,6 +62,8 @@ NetworkSyncManager::NetworkSyncManager( LoadingWindow *ld ) useSMserver = false; m_startupStatus = 0; //By default, connection not tried. + m_ActivePlayers = 0; + StartUp(); } @@ -500,7 +502,7 @@ void NetworkSyncManager::ProcessInput() case 0: ColumnData = "Names\n"; for (i=0;iSendMessageToTopScreen( SM_ChangeSong ); } break; + case 9: + { + int ServerMaxPlayers=m_packet.Read1(); + int PlayersInThisPacket=m_packet.Read1(); + m_PlayerStatus.clear(); + m_PlayerNames.clear(); + m_ActivePlayers = 0; + for (int i=0; i 0 ) + m_ActivePlayers++; + m_PlayerStatus.push_back( PStatus ); + m_PlayerNames.push_back( m_packet.ReadNT() ); + } + } + break; } m_packet.ClearPacket(); } diff --git a/stepmania/src/NetworkSyncManager.h b/stepmania/src/NetworkSyncManager.h index 3defaac6ba..3336043433 100644 --- a/stepmania/src/NetworkSyncManager.h +++ b/stepmania/src/NetworkSyncManager.h @@ -5,8 +5,10 @@ #include "PlayerNumber.h" + class LoadingWindow; +#define NETMAXPLAYERS 32 const int NETPROTOCOLVERSION=1; const int NETMAXBUFFERSIZE=1020; //1024 - 4 bytes for EzSockets @@ -62,12 +64,15 @@ public: void DisplayStartupStatus(); //Used to note user if connect attempt was sucessful or not. - int m_playerLife[NUM_PLAYERS]; //Life + int m_playerLife[NUM_PLAYERS]; //Life (used for sending to server) void Update(float fDeltaTime); bool useSMserver; + int m_ActivePlayers; + vector m_PlayerStatus; + vector m_PlayerNames; //Used togeather for bool ChangedScoreboard(int Column); //If scoreboard changed since this function last called, then true.