Fixed sync problem when the client is also the server. Fixed disply of player2's name

during chat.
This commit is contained in:
Josh Allen
2004-08-28 16:47:05 +00:00
parent 810c039181
commit 94fca63fa4
2 changed files with 14 additions and 5 deletions
+8 -1
View File
@@ -401,9 +401,16 @@ void NetworkSyncManager::StartRequest(short position)
while (dontExit)
{
//Keep the server going during the loop.
if (isLanServer)
LANserver->ServerUpdate();
m_packet.ClearPacket();
if (NetPlayerClient->ReadPack((char *)&m_packet, NETMAXBUFFERSIZE)<1)
dontExit=false; // Also allow exit if there is a problem on the socket
if (isLanServer == false)
dontExit=false; // Also allow exit if there is a problem on the socket
// Only do if we are not the server, otherwise the sync
// gets hosed up due to non blocking mode.
if (m_packet.Read1() == (128+3))
dontExit=false;
//Only allow passing on Start request.
+6 -4
View File
@@ -151,6 +151,7 @@ void StepManiaLanServer::Hello(PacketFunctions &Packet, int clientNum) {
void GameClient::StyleUpdate(PacketFunctions &Packet) {
int playernumber = 0;
Player[0].name = Player[1].name = "";
twoPlayers = Packet.Read1()-1;
for (int x = 0; x < twoPlayers+1; x++) {
playernumber = Packet.Read1();
@@ -384,10 +385,10 @@ void StepManiaLanServer::RelayChat(PacketFunctions &Packet, int clientNum) {
message += Client[clientNum].Player[0].name;
if (Client[clientNum].twoPlayers) {
message += "/";
message += Client[clientNum].Player[1].name;
}
if (Client[clientNum].twoPlayers)
message += "&";
message += Client[clientNum].Player[1].name;
message += ": ";
message += Packet.ReadNT();
@@ -506,6 +507,7 @@ void GameClient::CheckConnection() {
if (clientSocket.IsError()) {
clientSocket.close();
Used = false;
Player[0].name = Player[1].name = "";
}
}