updated masterserver logic to more properly handle success and error conditions.

This commit is contained in:
Mark Vejvoda
2010-05-17 05:38:07 +00:00
parent 5a57113cac
commit 5ea892ba1a
2 changed files with 15 additions and 9 deletions

View File

@@ -63,7 +63,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
lastMasterserverPublishing = time(NULL); lastMasterserverPublishing = time(NULL);
soundConnectionCount=0; soundConnectionCount=0;
mainMessageBox.init(lang.get("Ok")); mainMessageBox.init(lang.get("Ok"),lang.get("Return"));
mainMessageBox.setEnabled(false); mainMessageBox.setEnabled(false);
mainMessageBoxState=0; mainMessageBoxState=0;
@@ -265,6 +265,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
{ {
mainMessageBox.setEnabled(false); mainMessageBox.setEnabled(false);
} }
else if(button==2)
{
returnToParentMenu();
}
} }
} }
else if(buttonReturn.mouseClick(x,y)){ else if(buttonReturn.mouseClick(x,y)){
@@ -525,9 +529,9 @@ void MenuStateCustomGame::update()
if(showMasterserverError) if(showMasterserverError)
{ {
if(masterServererErrorToShow=="wrong router setup") if(EndsWith(masterServererErrorToShow, "wrong router setup") == true)
{ {
masterServererErrorToShow=lang.get(" wrong router setup"); masterServererErrorToShow=lang.get("wrong router setup");
} }
showMasterserverError=true; showMasterserverError=true;
listBoxPublishServer.setSelectedItemIndex(1); listBoxPublishServer.setSelectedItemIndex(1);
@@ -812,12 +816,13 @@ void MenuStateCustomGame::simpleTask() {
std::string serverInfo = SystemFlags::getHTTP(request); std::string serverInfo = SystemFlags::getHTTP(request);
printf("the result is:\n'%s'\n",serverInfo.c_str()); printf("the result is:\n'%s'\n",serverInfo.c_str());
// uncomment to enable router setup check of this server // uncomment to enable router setup check of this server
// if(serverInfo!="OK") //if(serverInfo!="OK")
// { if(EndsWith(serverInfo, "OK") == false)
// showMasterserverError=true; {
// masterServererErrorToShow=serverInfo; showMasterserverError=true;
// } masterServererErrorToShow=serverInfo;
}
} }
if(needToBroadcastServerSettings) if(needToBroadcastServerSettings)
{ {

View File

@@ -390,6 +390,7 @@ void MenuStateMasterserver::connectToServer(string ipString)
//config.setString("ServerIp", serverIp.getString()); //config.setString("ServerIp", serverIp.getString());
//config.save(); //config.save();
BaseThread::shutdownAndWait(updateFromMasterserverThread);
mainMenu->setState(new MenuStateConnectedGame(program, mainMenu,jmMasterserver)); mainMenu->setState(new MenuStateConnectedGame(program, mainMenu,jmMasterserver));
} }