mirror of
https://github.com/glest/glest-source.git
synced 2025-08-31 19:51:44 +02:00
- fixed problem where custom menu was setting broadcast to master server when loading last game from commandline even though publish was not enabled.
This commit is contained in:
@@ -728,10 +728,10 @@ int glestMain(int argc, char** argv){
|
|||||||
|
|
||||||
//parse command line
|
//parse command line
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SERVER]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SERVER]) == true) {
|
||||||
program->initServer(mainWindow);
|
program->initServer(mainWindow,false,true);
|
||||||
}
|
}
|
||||||
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME])) == true) {
|
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_AUTOSTART_LASTGAME])) == true) {
|
||||||
program->initServer(mainWindow,true);
|
program->initServer(mainWindow,true,false);
|
||||||
}
|
}
|
||||||
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_CLIENT])) == true) {
|
else if(hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_CLIENT])) == true) {
|
||||||
int foundParamIndIndex = -1;
|
int foundParamIndIndex = -1;
|
||||||
|
@@ -141,13 +141,13 @@ void Program::initNormal(WindowGl *window){
|
|||||||
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__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initServer(WindowGl *window, bool autostart) {
|
void Program::initServer(WindowGl *window, bool autostart,bool openNetworkSlots) {
|
||||||
MainMenu* mainMenu= NULL;
|
MainMenu* mainMenu= NULL;
|
||||||
|
|
||||||
init(window);
|
init(window);
|
||||||
mainMenu= new MainMenu(this);
|
mainMenu= new MainMenu(this);
|
||||||
setState(mainMenu);
|
setState(mainMenu);
|
||||||
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, true, false, autostart));
|
mainMenu->setState(new MenuStateCustomGame(this, mainMenu, openNetworkSlots, false, autostart));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::initClient(WindowGl *window, const Ip &serverIp) {
|
void Program::initClient(WindowGl *window, const Ip &serverIp) {
|
||||||
|
@@ -132,7 +132,7 @@ public:
|
|||||||
static Program *getInstance() {return singleton;}
|
static Program *getInstance() {return singleton;}
|
||||||
|
|
||||||
void initNormal(WindowGl *window);
|
void initNormal(WindowGl *window);
|
||||||
void initServer(WindowGl *window,bool autostart=false);
|
void initServer(WindowGl *window,bool autostart=false,bool openNetworkSlots=false);
|
||||||
void initClient(WindowGl *window, const Ip &serverIp);
|
void initClient(WindowGl *window, const Ip &serverIp);
|
||||||
void initScenario(WindowGl *window, string autoloadScenarioName);
|
void initScenario(WindowGl *window, string autoloadScenarioName);
|
||||||
|
|
||||||
|
@@ -590,7 +590,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
labelMapInfo.setText(mapInfo.desc);
|
labelMapInfo.setText(mapInfo.desc);
|
||||||
updateControlers();
|
updateControlers();
|
||||||
updateNetworkSlots();
|
updateNetworkSlots();
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -600,7 +603,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxFogOfWar.mouseClick(x, y)) {
|
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxFogOfWar.mouseClick(x, y)) {
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -610,7 +616,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxAllowObservers.mouseClick(x, y)) {
|
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxAllowObservers.mouseClick(x, y)) {
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
reloadFactions(true);
|
reloadFactions(true);
|
||||||
|
|
||||||
@@ -622,7 +631,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxEnableObserverMode.mouseClick(x, y)) {
|
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxEnableObserverMode.mouseClick(x, y)) {
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -632,7 +644,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxPathFinderType.mouseClick(x, y)) {
|
else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxPathFinderType.mouseClick(x, y)) {
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -658,7 +673,9 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
else if(listBoxTileset.mouseClick(x, y)){
|
else if(listBoxTileset.mouseClick(x, y)){
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
|
|
||||||
needToRepublishToMasterserver = true;
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
needToSetChangedGameSettings = true;
|
needToSetChangedGameSettings = true;
|
||||||
@@ -674,7 +691,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
labelMapInfo.setText(mapInfo.desc);
|
labelMapInfo.setText(mapInfo.desc);
|
||||||
updateControlers();
|
updateControlers();
|
||||||
updateNetworkSlots();
|
updateNetworkSlots();
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -686,7 +706,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
reloadFactions(false);
|
reloadFactions(false);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -714,7 +737,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
*/
|
*/
|
||||||
else if(listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxNetworkPauseGameForLaggedClients.mouseClick(x, y)){
|
else if(listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxNetworkPauseGameForLaggedClients.mouseClick(x, y)){
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
needToSetChangedGameSettings = true;
|
needToSetChangedGameSettings = true;
|
||||||
@@ -771,14 +797,20 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
}
|
}
|
||||||
updateNetworkSlots();
|
updateNetworkSlots();
|
||||||
|
|
||||||
needToRepublishToMasterserver = true;
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true) {
|
if(hasNetworkGameSettings() == true) {
|
||||||
needToSetChangedGameSettings = true;
|
needToSetChangedGameSettings = true;
|
||||||
lastSetChangedGameSettings = time(NULL);
|
lastSetChangedGameSettings = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(listBoxFactions[i].mouseClick(x, y)) {
|
else if(listBoxFactions[i].mouseClick(x, y)) {
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -797,7 +829,10 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
else {
|
else {
|
||||||
lastSelectedTeamIndex[i] = -1;
|
lastSelectedTeamIndex[i] = -1;
|
||||||
}
|
}
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -837,7 +872,10 @@ void MenuStateCustomGame::RestoreLastGameSettings() {
|
|||||||
serverInterface->setGameSettings(&gameSettings,false);
|
serverInterface->setGameSettings(&gameSettings,false);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
MutexSafeWrapper safeMutex(&masterServerThreadAccessor);
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
needToRepublishToMasterserver = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
@@ -1500,8 +1538,10 @@ void MenuStateCustomGame::update() {
|
|||||||
bool republishToMaster = (difftime(time(NULL),lastMasterserverPublishing) >= 5);
|
bool republishToMaster = (difftime(time(NULL),lastMasterserverPublishing) >= 5);
|
||||||
|
|
||||||
if(republishToMaster == true) {
|
if(republishToMaster == true) {
|
||||||
needToRepublishToMasterserver = true;
|
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
lastMasterserverPublishing = time(NULL);
|
needToRepublishToMasterserver = true;
|
||||||
|
lastMasterserverPublishing = time(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool callPublishNow = (listBoxPublishServer.getEditable() &&
|
bool callPublishNow = (listBoxPublishServer.getEditable() &&
|
||||||
@@ -2075,7 +2115,10 @@ GameSettings MenuStateCustomGame::loadGameSettingsFromFile(std::string fileName)
|
|||||||
|
|
||||||
updateControlers();
|
updateControlers();
|
||||||
updateNetworkSlots();
|
updateNetworkSlots();
|
||||||
needToRepublishToMasterserver = true;
|
|
||||||
|
//if(listBoxPublishServer.getSelectedItemIndex() == 0) {
|
||||||
|
// needToRepublishToMasterserver = true;
|
||||||
|
//}
|
||||||
|
|
||||||
if(hasNetworkGameSettings() == true)
|
if(hasNetworkGameSettings() == true)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user