added some safety checks if user does not have masterserver setup properly

This commit is contained in:
Mark Vejvoda
2010-05-15 18:49:45 +00:00
parent 6548c42d38
commit 9ab6732f86

View File

@@ -138,8 +138,11 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
labelTitle.init(330, 700); labelTitle.init(330, 700);
labelTitle.setText(lang.get("AvailableServers")); labelTitle.setText(lang.get("AvailableServers"));
// bottom if(Config::getInstance().getString("Masterserver","") == "") {
labelTitle.setText("*** " + lang.get("AvailableServers"));
}
// bottom
buttonReturn.init(50, 70, 150); buttonReturn.init(50, 70, 150);
buttonCreateGame.init(300, 70, 150); buttonCreateGame.init(300, 70, 150);
buttonRefresh.init(550, 70, 150); buttonRefresh.init(550, 70, 150);
@@ -277,10 +280,12 @@ void MenuStateMasterserver::simpleTask() {
} }
void MenuStateMasterserver::updateServerInfo() { void MenuStateMasterserver::updateServerInfo() {
try {
needUpdateFromServer = false; needUpdateFromServer = false;
//MasterServerInfos masterServerInfos; //MasterServerInfos masterServerInfos;
clearServerLines(); clearServerLines();
if(Config::getInstance().getString("Masterserver","") != "") {
std::string serverInfo = SystemFlags::getHTTP(Config::getInstance().getString("Masterserver")+"showServersForGlest.php"); std::string serverInfo = SystemFlags::getHTTP(Config::getInstance().getString("Masterserver")+"showServersForGlest.php");
std::vector<std::string> serverList; std::vector<std::string> serverList;
@@ -314,8 +319,15 @@ void MenuStateMasterserver::updateServerInfo() {
serverLines.push_back(new ServerLine( masterServerInfo, i)); serverLines.push_back(new ServerLine( masterServerInfo, i));
} }
} }
}
//masterServerInfos.push_back(masterServerInfo); //masterServerInfos.push_back(masterServerInfo);
} }
catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d, error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error(e.what());
}
}
void MenuStateMasterserver::connectToServer(string ipString) void MenuStateMasterserver::connectToServer(string ipString)