mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 07:31:21 +02:00
masterserver should be able to check the routersetup now ( important part is still uncommented )
This commit is contained in:
@@ -26,7 +26,7 @@ using namespace Shared::Platform;
|
|||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
const string mailString= "contact_game@glest.org";
|
const string mailString= "contact_game@glest.org";
|
||||||
const string glestVersionString= "v3.3.5-alpha1";
|
const string glestVersionString= "v3.3.5-dev";
|
||||||
|
|
||||||
string getCrashDumpFileName(){
|
string getCrashDumpFileName(){
|
||||||
return "glest" + glestVersionString + ".dmp";
|
return "glest" + glestVersionString + ".dmp";
|
||||||
|
@@ -57,10 +57,16 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||||||
needToSetChangedGameSettings = false;
|
needToSetChangedGameSettings = false;
|
||||||
needToRepublishToMasterserver = false;
|
needToRepublishToMasterserver = false;
|
||||||
needToBroadcastServerSettings = false;
|
needToBroadcastServerSettings = false;
|
||||||
|
showMasterserverError = false;
|
||||||
|
masterServererErrorToShow = "---";
|
||||||
lastSetChangedGameSettings = time(NULL);
|
lastSetChangedGameSettings = time(NULL);
|
||||||
lastMasterserverPublishing = time(NULL);
|
lastMasterserverPublishing = time(NULL);
|
||||||
soundConnectionCount=0;
|
soundConnectionCount=0;
|
||||||
|
|
||||||
|
mainMessageBox.init(lang.get("Ok"));
|
||||||
|
mainMessageBox.setEnabled(false);
|
||||||
|
mainMessageBoxState=0;
|
||||||
|
|
||||||
vector<string> teamItems, controlItems, results;
|
vector<string> teamItems, controlItems, results;
|
||||||
|
|
||||||
//create
|
//create
|
||||||
@@ -250,8 +256,18 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
CoreData &coreData= CoreData::getInstance();
|
CoreData &coreData= CoreData::getInstance();
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
||||||
|
if(mainMessageBox.getEnabled()){
|
||||||
if(buttonReturn.mouseClick(x,y)){
|
int button= 1;
|
||||||
|
if(mainMessageBox.mouseClick(x, y, button))
|
||||||
|
{
|
||||||
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
if(button==1)
|
||||||
|
{
|
||||||
|
mainMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(buttonReturn.mouseClick(x,y)){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
@@ -423,7 +439,9 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
|
void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
|
||||||
|
if (mainMessageBox.getEnabled()) {
|
||||||
|
mainMessageBox.mouseMove(x, y);
|
||||||
|
}
|
||||||
buttonReturn.mouseMove(x, y);
|
buttonReturn.mouseMove(x, y);
|
||||||
buttonPlayNow.mouseMove(x, y);
|
buttonPlayNow.mouseMove(x, y);
|
||||||
|
|
||||||
@@ -444,8 +462,12 @@ void MenuStateCustomGame::render(){
|
|||||||
try {
|
try {
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
|
|
||||||
|
if(mainMessageBox.getEnabled()){
|
||||||
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
renderer.renderButton(&buttonReturn);
|
renderer.renderButton(&buttonReturn);
|
||||||
renderer.renderButton(&buttonPlayNow);
|
renderer.renderButton(&buttonPlayNow);
|
||||||
|
|
||||||
@@ -480,6 +502,7 @@ void MenuStateCustomGame::render(){
|
|||||||
renderer.renderLabel(&labelPublishServer);
|
renderer.renderLabel(&labelPublishServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(const std::exception &ex) {
|
catch(const std::exception &ex) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
@@ -500,6 +523,17 @@ void MenuStateCustomGame::update()
|
|||||||
int currentConnectionCount=0;
|
int currentConnectionCount=0;
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
|
|
||||||
|
if(showMasterserverError)
|
||||||
|
{
|
||||||
|
if(masterServererErrorToShow=="wrong router setup")
|
||||||
|
{
|
||||||
|
masterServererErrorToShow=lang.get(" wrong router setup");
|
||||||
|
}
|
||||||
|
showMasterserverError=true;
|
||||||
|
listBoxPublishServer.setSelectedItemIndex(1);
|
||||||
|
mainMessageBoxState=1;
|
||||||
|
showMessageBox( masterServererErrorToShow, lang.get("ErrorFromMasterserver"), false);
|
||||||
|
}
|
||||||
|
|
||||||
// handle setting changes from clients
|
// handle setting changes from clients
|
||||||
SwitchSetupRequest** switchSetupRequests=serverInterface->getSwitchSetupRequests();
|
SwitchSetupRequest** switchSetupRequests=serverInterface->getSwitchSetupRequests();
|
||||||
@@ -777,6 +811,13 @@ void MenuStateCustomGame::simpleTask() {
|
|||||||
printf("the request is:\n%s\n",request.c_str());
|
printf("the request is:\n%s\n",request.c_str());
|
||||||
|
|
||||||
std::string serverInfo = SystemFlags::getHTTP(request);
|
std::string serverInfo = SystemFlags::getHTTP(request);
|
||||||
|
printf("the result is:\n'%s'\n",serverInfo.c_str());
|
||||||
|
// uncomment to enable router setup check of this server
|
||||||
|
// if(serverInfo!="OK")
|
||||||
|
// {
|
||||||
|
// showMasterserverError=true;
|
||||||
|
// masterServererErrorToShow=serverInfo;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
if(needToBroadcastServerSettings)
|
if(needToBroadcastServerSettings)
|
||||||
{
|
{
|
||||||
@@ -1027,4 +1068,20 @@ void MenuStateCustomGame::keyPress(char c)
|
|||||||
chatManager.keyPress(c);
|
chatManager.keyPress(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuStateCustomGame::showMessageBox(const string &text, const string &header, bool toggle){
|
||||||
|
if(!toggle){
|
||||||
|
mainMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mainMessageBox.getEnabled()){
|
||||||
|
mainMessageBox.setText(text);
|
||||||
|
mainMessageBox.setHeader(header);
|
||||||
|
mainMessageBox.setEnabled(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mainMessageBox.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -51,6 +51,10 @@ private:
|
|||||||
GraphicLabel labelPublishServer;
|
GraphicLabel labelPublishServer;
|
||||||
GraphicListBox listBoxPublishServer;
|
GraphicListBox listBoxPublishServer;
|
||||||
|
|
||||||
|
GraphicMessageBox mainMessageBox;
|
||||||
|
int mainMessageBoxState;
|
||||||
|
|
||||||
|
|
||||||
bool needToSetChangedGameSettings;
|
bool needToSetChangedGameSettings;
|
||||||
time_t lastSetChangedGameSettings;
|
time_t lastSetChangedGameSettings;
|
||||||
time_t lastMasterserverPublishing;
|
time_t lastMasterserverPublishing;
|
||||||
@@ -62,6 +66,9 @@ private:
|
|||||||
bool parentMenuIsMs;
|
bool parentMenuIsMs;
|
||||||
bool soundConnectionCount;
|
bool soundConnectionCount;
|
||||||
|
|
||||||
|
bool showMasterserverError;
|
||||||
|
string masterServererErrorToShow;
|
||||||
|
|
||||||
Console console;
|
Console console;
|
||||||
ChatManager chatManager;
|
ChatManager chatManager;
|
||||||
|
|
||||||
@@ -90,6 +97,7 @@ private:
|
|||||||
void updateNetworkSlots();
|
void updateNetworkSlots();
|
||||||
void publishToMasterserver();
|
void publishToMasterserver();
|
||||||
void returnToParentMenu();
|
void returnToParentMenu();
|
||||||
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -134,9 +134,11 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
|
|||||||
|
|
||||||
mainMessageBox.init(lang.get("Ok"));
|
mainMessageBox.init(lang.get("Ok"));
|
||||||
mainMessageBox.setEnabled(false);
|
mainMessageBox.setEnabled(false);
|
||||||
lastRefreshTimer= time(NULL);
|
|
||||||
mainMessageBoxState=0;
|
mainMessageBoxState=0;
|
||||||
|
|
||||||
|
lastRefreshTimer= time(NULL);
|
||||||
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
labelTitle.init(330, 700);
|
labelTitle.init(330, 700);
|
||||||
labelTitle.setText(lang.get("AvailableServers"));
|
labelTitle.setText(lang.get("AvailableServers"));
|
||||||
|
Reference in New Issue
Block a user