From fec68c872a5407e8d3a0440c801963fdb1096ec7 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Wed, 12 Jan 2011 19:42:25 +0000 Subject: [PATCH] Some changed external ports for ftp; switch ftp ports according to external port; Menu looks a bit more friendly(less fog) --- mk/linux/glest.ini | 2 +- source/glest_game/menu/menu_state_options.cpp | 13 ++++- source/glest_game/menu/menu_state_root.cpp | 48 ++++++++++--------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/mk/linux/glest.ini b/mk/linux/glest.ini index dde67376..7ff6a581 100644 --- a/mk/linux/glest.ini +++ b/mk/linux/glest.ini @@ -53,7 +53,7 @@ FontSizeAdjustment=0 Lang=english MaxLights=3 Masterserver=http://master.megaglest.org/ -MasterServerExternalPortList=61357,61358,61359,61360,61000,80,1080,8000,8080,443,21,22,25,110,143,587,993,995 +MasterServerExternalPortList=61357,61367,61377,61387,61397,80,1080,8000,8080,443,21,22,25,110,143,587,993,995 NetPlayerName=newbie NetworkConsistencyChecks=true PhotoMode=false diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index c3850c51..53490f3a 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -503,7 +503,17 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){ listBoxScreenModes.mouseClick(x, y); listFontSizeAdjustment.mouseClick(x, y); checkBoxFullscreenWindowed.mouseClick(x, y); - listBoxPublishServerExternalPort.mouseClick(x, y); + if(listBoxPublishServerExternalPort.mouseClick(x, y)){ + int selectedPort=strToInt(listBoxPublishServerExternalPort.getSelectedItem()); + if(selectedPort<10000){ + selectedPort=GameConstants::serverPort; + } + // use the following ports for ftp + char szBuf[1024]=""; + sprintf(szBuf,"%d - %d",selectedPort + 1, selectedPort + GameConstants::maxPlayers); + labelFTPServerPort.setText(intToStr(selectedPort)); + labelFTPServerDataPorts.setText(szBuf); + } checkBoxEnableFTP.mouseClick(x, y); checkBoxEnableFTPServer.mouseClick(x, y); @@ -680,6 +690,7 @@ void MenuStateOptions::saveConfig(){ CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f); config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem()); config.setString("MasterServerExternalPort", listBoxPublishServerExternalPort.getSelectedItem()); + config.setInt("FTPServerPort",config.getInt("MasterServerExternalPort")+1); config.setBool("EnableFTPXfer", checkBoxEnableFTP.getValue()); config.setBool("EnableFTPServer", checkBoxEnableFTPServer.getValue()); diff --git a/source/glest_game/menu/menu_state_root.cpp b/source/glest_game/menu/menu_state_root.cpp index 28db799e..b8058fe6 100644 --- a/source/glest_game/menu/menu_state_root.cpp +++ b/source/glest_game/menu/menu_state_root.cpp @@ -39,25 +39,37 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): { containerName = "MainMenu"; Lang &lang= Lang::getInstance(); - int i=375; + int yPos=440; + + labelVersion.registerGraphicComponent(containerName,"labelVersion"); + if(EndsWith(glestVersionString, "-dev") == false){ + labelVersion.init(525, yPos); + labelVersion.setText(glestVersionString); + } + else { + labelVersion.init(405, yPos); + labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); + } + + yPos-=55; buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame"); - buttonNewGame.init(425, i, 150); - i-=40; + buttonNewGame.init(425, yPos, 150); + yPos-=40; buttonJoinGame.registerGraphicComponent(containerName,"buttonJoinGame"); - buttonJoinGame.init(425, i, 150); - i-=40; + buttonJoinGame.init(425, yPos, 150); + yPos-=40; buttonMasterserverGame.registerGraphicComponent(containerName,"buttonMasterserverGame"); - buttonMasterserverGame.init(425, i, 150); - i-=40; + buttonMasterserverGame.init(425, yPos, 150); + yPos-=40; buttonOptions.registerGraphicComponent(containerName,"buttonOptions"); - buttonOptions.init(425, i, 150); - i-=40; + buttonOptions.init(425, yPos, 150); + yPos-=40; buttonAbout.registerGraphicComponent(containerName,"buttonAbout"); - buttonAbout.init(425, i , 150); - i-=40; + buttonAbout.init(425, yPos , 150); + yPos-=40; buttonExit.registerGraphicComponent(containerName,"buttonExit"); - buttonExit.init(425, i, 150); + buttonExit.init(425, yPos, 150); buttonNewGame.setText(lang.get("NewGame")); buttonJoinGame.setText(lang.get("JoinGame")); @@ -66,15 +78,6 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu): buttonAbout.setText(lang.get("About")); buttonExit.setText(lang.get("Exit")); - labelVersion.registerGraphicComponent(containerName,"labelVersion"); - if(EndsWith(glestVersionString, "-dev") == false){ - labelVersion.init(525, 420); - labelVersion.setText(glestVersionString); - } - else { - labelVersion.init(405, 420); - labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]"); - } //mesage box mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox"); mainMessageBox.init(lang.get("Yes"), lang.get("No")); @@ -150,9 +153,10 @@ void MenuStateRoot::render() { int w= 300; int h= 150; + int yPos=495; renderer.renderTextureQuad( - (metrics.getVirtualW()-w)/2, 475-h/2, w, h, + (metrics.getVirtualW()-w)/2, yPos-h/2, w, h, coreData.getLogoTexture(), GraphicComponent::getFade()); int maxLogoWidth=0;