(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode

This commit is contained in:
smatz 2010-01-18 12:53:01 +00:00
parent bcec00fdbd
commit 565ad802b1
1 changed files with 24 additions and 24 deletions

View File

@ -39,11 +39,11 @@
/** /**
* In what 'mode' the GenerateLandscapeWindowProc is. * In what 'mode' the GenerateLandscapeWindowProc is.
*/ */
enum glwp_modes { enum GenenerateLandscapeWindowMode {
GLWP_GENERATE, GLWM_GENERATE,
GLWP_HEIGHTMAP, GLWM_HEIGHTMAP,
GLWP_SCENARIO, GLWM_SCENARIO,
GLWP_END GLWM_END
}; };
extern void SwitchToMode(SwitchMode new_mode); extern void SwitchToMode(SwitchMode new_mode);
@ -291,7 +291,7 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
EndContainer(), EndContainer(),
}; };
static void StartGeneratingLandscape(glwp_modes mode) static void StartGeneratingLandscape(GenenerateLandscapeWindowMode mode)
{ {
DeleteAllNonVitalWindows(); DeleteAllNonVitalWindows();
@ -301,16 +301,16 @@ static void StartGeneratingLandscape(glwp_modes mode)
SndPlayFx(SND_15_BEEP); SndPlayFx(SND_15_BEEP);
switch (mode) { switch (mode) {
case GLWP_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break; case GLWM_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 GLWM_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
case GLWP_SCENARIO: _switch_mode = SM_EDITOR; break; case GLWM_SCENARIO: _switch_mode = SM_EDITOR; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
} }
static void LandscapeGenerationCallback(Window *w, bool confirmed) static void LandscapeGenerationCallback(Window *w, bool confirmed)
{ {
if (confirmed) StartGeneratingLandscape((glwp_modes)w->window_number); if (confirmed) StartGeneratingLandscape((GenenerateLandscapeWindowMode)w->window_number);
} }
static DropDownList *BuildMapsizeDropDown() static DropDownList *BuildMapsizeDropDown()
@ -341,7 +341,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
uint x; uint x;
uint y; uint y;
char name[64]; char name[64];
glwp_modes mode; GenenerateLandscapeWindowMode mode;
GenerateLandscapeWindow(const WindowDesc *desc, WindowNumber number = 0) : QueryStringBaseWindow(11) GenerateLandscapeWindow(const WindowDesc *desc, WindowNumber number = 0) : QueryStringBaseWindow(11)
{ {
@ -356,7 +356,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->caption = STR_NULL; this->caption = STR_NULL;
this->afilter = CS_NUMERAL; this->afilter = CS_NUMERAL;
this->mode = (glwp_modes)this->window_number; this->mode = (GenenerateLandscapeWindowMode)this->window_number;
} }
@ -474,7 +474,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
virtual void OnPaint() virtual void OnPaint()
{ {
/* You can't select smoothness / non-water borders if not terragenesis */ /* You can't select smoothness / non-water borders if not terragenesis */
if (mode == GLWP_GENERATE) { if (mode == GLWM_GENERATE) {
this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges); this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges);
@ -550,7 +550,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_GENERATE_BUTTON: // Generate case GLAND_GENERATE_BUTTON: // Generate
MakeNewgameSettingsLive(); MakeNewgameSettingsLive();
if (mode == GLWP_HEIGHTMAP && if (mode == GLWM_HEIGHTMAP &&
(this->x * 2 < (1U << _settings_newgame.game_creation.map_x) || (this->x * 2 < (1U << _settings_newgame.game_creation.map_x) ||
this->x / 2 > (1U << _settings_newgame.game_creation.map_x) || this->x / 2 > (1U << _settings_newgame.game_creation.map_x) ||
this->y * 2 < (1U << _settings_newgame.game_creation.map_y) || this->y * 2 < (1U << _settings_newgame.game_creation.map_y) ||
@ -773,7 +773,7 @@ static const WindowDesc _heightmap_load_desc(
_nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets) _nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)
); );
static void _ShowGenerateLandscape(glwp_modes mode) static void _ShowGenerateLandscape(GenenerateLandscapeWindowMode mode)
{ {
uint x = 0; uint x = 0;
uint y = 0; uint y = 0;
@ -783,14 +783,14 @@ static void _ShowGenerateLandscape(glwp_modes mode)
/* Always give a new seed if not editor */ /* Always give a new seed if not editor */
if (_game_mode != GM_EDITOR) _settings_newgame.game_creation.generation_seed = InteractiveRandom(); if (_game_mode != GM_EDITOR) _settings_newgame.game_creation.generation_seed = InteractiveRandom();
if (mode == GLWP_HEIGHTMAP) { if (mode == GLWM_HEIGHTMAP) {
/* If the function returns negative, it means there was a problem loading the heightmap */ /* If the function returns negative, it means there was a problem loading the heightmap */
if (!GetHeightmapDimensions(_file_to_saveload.name, &x, &y)) return; if (!GetHeightmapDimensions(_file_to_saveload.name, &x, &y)) return;
} }
GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>((mode == GLWP_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, mode); GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>((mode == GLWM_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, mode);
if (mode == GLWP_HEIGHTMAP) { if (mode == GLWM_HEIGHTMAP) {
w->x = x; w->x = x;
w->y = y; w->y = y;
strecpy(w->name, _file_to_saveload.title, lastof(w->name)); strecpy(w->name, _file_to_saveload.title, lastof(w->name));
@ -801,17 +801,17 @@ static void _ShowGenerateLandscape(glwp_modes mode)
void ShowGenerateLandscape() void ShowGenerateLandscape()
{ {
_ShowGenerateLandscape(GLWP_GENERATE); _ShowGenerateLandscape(GLWM_GENERATE);
} }
void ShowHeightmapLoad() void ShowHeightmapLoad()
{ {
_ShowGenerateLandscape(GLWP_HEIGHTMAP); _ShowGenerateLandscape(GLWM_HEIGHTMAP);
} }
void StartScenarioEditor() void StartScenarioEditor()
{ {
StartGeneratingLandscape(GLWP_SCENARIO); StartGeneratingLandscape(GLWM_SCENARIO);
} }
void StartNewGameWithoutGUI(uint seed) void StartNewGameWithoutGUI(uint seed)
@ -819,7 +819,7 @@ void StartNewGameWithoutGUI(uint seed)
/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */ /* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
_settings_newgame.game_creation.generation_seed = seed; _settings_newgame.game_creation.generation_seed = seed;
StartGeneratingLandscape(GLWP_GENERATE); StartGeneratingLandscape(GLWM_GENERATE);
} }
/** Widget numbers of the create scenario window. */ /** Widget numbers of the create scenario window. */
@ -933,7 +933,7 @@ struct CreateScenarioWindow : public Window
break; break;
case CSCEN_EMPTY_WORLD: // Empty world / flat world case CSCEN_EMPTY_WORLD: // Empty world / flat world
StartGeneratingLandscape(GLWP_SCENARIO); StartGeneratingLandscape(GLWM_SCENARIO);
break; break;
case CSCEN_RANDOM_WORLD: // Generate case CSCEN_RANDOM_WORLD: // Generate
@ -1082,7 +1082,7 @@ static const WindowDesc _create_scenario_desc(
void ShowCreateScenario() void ShowCreateScenario()
{ {
DeleteWindowByClass(WC_GENERATE_LANDSCAPE); DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
new CreateScenarioWindow(&_create_scenario_desc, GLWP_SCENARIO); new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
} }
enum GenerationProgressWindowWidgets { enum GenerationProgressWindowWidgets {