mirror of
https://github.com/glest/glest-source.git
synced 2025-08-30 19:29:47 +02:00
Chat line is visible in custom game menu.
Network consistency always checks and gives better messages.
This commit is contained in:
@@ -47,8 +47,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||||||
vector<string> glestMaps, megaMaps, teamItems, controlItems;
|
vector<string> glestMaps, megaMaps, teamItems, controlItems;
|
||||||
|
|
||||||
//create
|
//create
|
||||||
buttonReturn.init(350, 140, 125);
|
buttonReturn.init(350, 180, 125);
|
||||||
buttonPlayNow.init(525, 140, 125);
|
buttonPlayNow.init(525, 180, 125);
|
||||||
|
|
||||||
//map listBox
|
//map listBox
|
||||||
findAll("maps/*.gbm", glestMaps, true, true);
|
findAll("maps/*.gbm", glestMaps, true, true);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
@@ -137,19 +137,25 @@ void ClientInterface::updateLobby()
|
|||||||
if(Socket::enableNetworkDebugInfo) printf("In [%s::%s] got NetworkMessageIntro\n",__FILE__,__FUNCTION__);
|
if(Socket::enableNetworkDebugInfo) printf("In [%s::%s] got NetworkMessageIntro\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
//check consistency
|
//check consistency
|
||||||
if(Config::getInstance().getBool("NetworkConsistencyChecks"))
|
|
||||||
{
|
|
||||||
if(networkMessageIntro.getVersionString() != getNetworkVersionString())
|
|
||||||
{
|
|
||||||
string sErr = "Server and client binary versions do not match [" + networkMessageIntro.getVersionString() + "]. You have to use the same binaries.";
|
|
||||||
printf("%s\n",sErr.c_str());
|
|
||||||
|
|
||||||
sendTextMessage("Server and client binary mismatch [" + networkMessageIntro.getVersionString() + "]",-1);
|
if(networkMessageIntro.getVersionString() != getNetworkVersionString())
|
||||||
|
{
|
||||||
|
string sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " +
|
||||||
|
networkMessageIntro.getVersionString() +
|
||||||
|
"\nClient: " + getNetworkVersionString();
|
||||||
|
printf("%s\n",sErr.c_str());
|
||||||
|
|
||||||
|
sendTextMessage("Server and client binary mismatch!!",-1);
|
||||||
|
sendTextMessage(" Server:" + networkMessageIntro.getVersionString(),-1);
|
||||||
|
sendTextMessage(" Client: "+ getNetworkVersionString(),-1);
|
||||||
|
if(Config::getInstance().getBool("NetworkConsistencyChecks"))
|
||||||
|
{// error message and disconnect only if checked
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//send intro message
|
//send intro message
|
||||||
NetworkMessageIntro sendNetworkMessageIntro(getNetworkVersionString(), getHostName(), -1);
|
NetworkMessageIntro sendNetworkMessageIntro(getNetworkVersionString(), getHostName(), -1);
|
||||||
|
|
||||||
@@ -474,18 +480,20 @@ void ClientInterface::waitUntilReady(Checksum* checksum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check checksum
|
//check checksum
|
||||||
if(Config::getInstance().getBool("NetworkConsistencyChecks"))
|
if(networkMessageReady.getChecksum() != checksum->getSum())
|
||||||
{
|
{
|
||||||
if(networkMessageReady.getChecksum() != checksum->getSum())
|
string sErr = "Checksum error, you don't have the same data as the server";
|
||||||
{
|
//throw runtime_error("Checksum error, you don't have the same data as the server");
|
||||||
string sErr = "Checksum error, you don't have the same data as the server";
|
sendTextMessage(sErr,-1);
|
||||||
//throw runtime_error("Checksum error, you don't have the same data as the server");
|
if(Config::getInstance().getBool("NetworkConsistencyChecks"))
|
||||||
sendTextMessage(sErr,-1);
|
{// error message and disconnect only if checked
|
||||||
DisplayErrorMessage(sErr);
|
DisplayErrorMessage(sErr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//delay the start a bit, so clients have nore room to get messages
|
//delay the start a bit, so clients have nore room to get messages
|
||||||
sleep(GameConstants::networkExtraLatency);
|
sleep(GameConstants::networkExtraLatency);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest (www.glest.org)
|
// This file is part of Glest (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
@@ -92,6 +92,12 @@ bool NetworkInterface::isConnected(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
||||||
|
|
||||||
|
if(closeSocket == true && getSocket() != NULL)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
if(pCB_DisplayMessage != NULL) {
|
if(pCB_DisplayMessage != NULL) {
|
||||||
pCB_DisplayMessage(sErr.c_str(), false);
|
pCB_DisplayMessage(sErr.c_str(), false);
|
||||||
}
|
}
|
||||||
@@ -99,10 +105,6 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
|||||||
throw runtime_error(sErr);
|
throw runtime_error(sErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(closeSocket == true && getSocket() != NULL)
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user