Worked around the PlayerNames to decrease game-time scoreboard updates.

This commit is contained in:
Charles Lohr
2004-08-29 17:15:10 +00:00
parent 44a7d9cefa
commit be7eccbae3
2 changed files with 26 additions and 2 deletions
+20 -1
View File
@@ -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;i<NumberPlayers;i++)
ColumnData += m_packet.ReadNT() + "\n";
ColumnData += m_PlayerNames[m_packet.Read1()] + "\n";
break;
case 1:
ColumnData = "Combo\n";
@@ -555,6 +557,23 @@ void NetworkSyncManager::ProcessInput()
SCREENMAN->SendMessageToTopScreen( 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<PlayersInThisPacket; i++)
{
int PStatus = m_packet.Read1();
if ( PStatus > 0 )
m_ActivePlayers++;
m_PlayerStatus.push_back( PStatus );
m_PlayerNames.push_back( m_packet.ReadNT() );
}
}
break;
}
m_packet.ClearPacket();
}
+6 -1
View File
@@ -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 <int> m_PlayerStatus;
vector <CString> m_PlayerNames;
//Used togeather for
bool ChangedScoreboard(int Column); //If scoreboard changed since this function last called, then true.