(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
authorDarkvater
Thu, 01 Feb 2007 22:54:04 +0000
changeset 6150 648233476115
parent 6149 44aedfd50791
child 6151 4b5e33f35bbe
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
src/genworld.h
src/genworld_gui.cpp
src/intro_gui.cpp
--- a/src/genworld.h	Thu Feb 01 22:30:35 2007 +0000
+++ b/src/genworld.h	Thu Feb 01 22:54:04 2007 +0000
@@ -90,5 +90,6 @@
 void ShowGenerateWorldProgress(void);
 void StartNewGameWithoutGUI(uint seed);
 void ShowCreateScenario(void);
+void StartScenarioEditor(void);
 
 #endif /* GENWORLD_H */
--- a/src/genworld_gui.cpp	Thu Feb 01 22:30:35 2007 +0000
+++ b/src/genworld_gui.cpp	Thu Feb 01 22:54:04 2007 +0000
@@ -144,24 +144,21 @@
 {   WIDGETS_END},
 };
 
-static void StartGeneratingLandscape(glwp_modes mode)
+void StartGeneratingLandscape(glwp_modes mode)
 {
-	DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
-	DeleteWindowByClass(WC_INDUSTRY_VIEW);
-	DeleteWindowByClass(WC_TOWN_VIEW);
-	DeleteWindowByClass(WC_LAND_INFO);
+	DeleteAllNonVitalWindows();
 
-	/* Copy all XXX_newgame to XXX */
+	/* Copy all XXX_newgame to XXX when coming from outside the editor */
 	UpdatePatches();
+	_opt = _opt_newgame;
 	_opt_ptr = &_opt;
-	*_opt_ptr = _opt_newgame;
 	ResetGRFConfig(true);
 
 	SndPlayFx(SND_15_BEEP);
 	switch (mode) {
 		case GLWP_GENERATE:  _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND    : SM_NEWGAME;         break;
 		case GLWP_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
-		case GLWP_SCENARIO: break;
+		case GLWP_SCENARIO:  _switch_mode = SM_EDITOR; break;
 		default: NOT_REACHED();
 	}
 }
@@ -513,6 +510,11 @@
 	_ShowGenerateLandscape(GLWP_HEIGHTMAP);
 }
 
+void StartScenarioEditor(void)
+{
+	StartGeneratingLandscape(GLWP_SCENARIO);
+}
+
 void StartNewGameWithoutGUI(uint seed)
 {
 	/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
--- a/src/intro_gui.cpp	Thu Feb 01 22:30:35 2007 +0000
+++ b/src/intro_gui.cpp	Thu Feb 01 22:54:04 2007 +0000
@@ -67,7 +67,7 @@
 		case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
 		case 4: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
 		case 5: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
-		case 6: _switch_mode = SM_EDITOR; break;
+		case 6: StartScenarioEditor(); break;
 		case 7:
 			if (!_network_available) {
 				ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);