diff --git a/src/openrct2-ui/input/KeyboardShortcut.cpp b/src/openrct2-ui/input/KeyboardShortcut.cpp index cd2452a16a..92c3558ba0 100644 --- a/src/openrct2-ui/input/KeyboardShortcut.cpp +++ b/src/openrct2-ui/input/KeyboardShortcut.cpp @@ -98,7 +98,7 @@ static void ShortcutCloseAllFloatingWindow() { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) window_close_all(); - else if (gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + else if (gS6Info.editor_step == EditorStep::LandscapeEditor) window_close_top(); } @@ -362,7 +362,7 @@ static void ShortcutAdjustLand() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { @@ -381,7 +381,7 @@ static void ShortcutAdjustWater() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { @@ -400,7 +400,7 @@ static void ShortcutBuildScenery() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { @@ -419,7 +419,7 @@ static void ShortcutBuildPaths() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { @@ -526,7 +526,7 @@ static void ShortcutShowMap() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) context_open_window(WC_MAP); } @@ -574,7 +574,7 @@ static void ShortcutClearScenery() if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { @@ -787,7 +787,7 @@ static void ShortcutAdvanceToNextTick() static void ShortcutOpenSceneryPicker() { if ((gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - || (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR)) + || (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && gS6Info.editor_step != EditorStep::LandscapeEditor)) return; rct_window* window_scenery = window_find_by_class(WC_SCENERY); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index ad638f49f0..c499a9b887 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -60,7 +60,7 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord return info; // - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) return info; info = get_map_coordinates_from_pos( @@ -250,7 +250,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor return info; // - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) return info; info = get_map_coordinates_from_pos(screenCoords, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER)); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index c41675dbd6..8795aa6ca3 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -126,7 +126,7 @@ rct_window* window_editor_bottom_toolbar_open() void window_editor_bottom_toolbar_jump_back_to_object_selection() { window_close_all(); - gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; + gS6Info.editor_step = EditorStep::ObjectSelection; gfx_invalidate_screen(); } @@ -139,7 +139,7 @@ void window_editor_bottom_toolbar_jump_back_to_landscape_editor() window_close_all(); set_all_scenery_items_invented(); scenery_set_default_placement_configuration(); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gS6Info.editor_step = EditorStep::LandscapeEditor; context_open_window(WC_MAP); gfx_invalidate_screen(); } @@ -152,7 +152,7 @@ static void window_editor_bottom_toolbar_jump_back_to_invention_list_set_up() { window_close_all(); context_open_window(WC_EDITOR_INVENTION_LIST); - gS6Info.editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP; + gS6Info.editor_step = EditorStep::InventionsListSetUp; gfx_invalidate_screen(); } @@ -164,7 +164,7 @@ void window_editor_bottom_toolbar_jump_back_to_options_selection() { window_close_all(); context_open_window(WC_EDITOR_SCENARIO_OPTIONS); - gS6Info.editor_step = EDITOR_STEP_OPTIONS_SELECTION; + gS6Info.editor_step = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -223,7 +223,7 @@ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up() { window_close_all(); context_open_window(WC_EDITOR_INVENTION_LIST); - gS6Info.editor_step = EDITOR_STEP_INVENTIONS_LIST_SET_UP; + gS6Info.editor_step = EditorStep::InventionsListSetUp; } else { @@ -241,7 +241,7 @@ void window_editor_bottom_toolbar_jump_forward_to_options_selection() { window_close_all(); context_open_window(WC_EDITOR_SCENARIO_OPTIONS); - gS6Info.editor_step = EDITOR_STEP_OPTIONS_SELECTION; + gS6Info.editor_step = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -253,7 +253,7 @@ void window_editor_bottom_toolbar_jump_forward_to_objective_selection() { window_close_all(); context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); - gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION; + gS6Info.editor_step = EditorStep::ObjectiveSelection; gfx_invalidate_screen(); } @@ -288,12 +288,12 @@ static void window_editor_bottom_toolbar_mouseup([[maybe_unused]] rct_window* w, if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) || (GetEntityListCount(EntityListId::Free) == MAX_SPRITES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED))) { - previous_button_mouseup_events[gS6Info.editor_step](); + previous_button_mouseup_events[EnumValue(gS6Info.editor_step)](); } } else if (widgetIndex == WIDX_NEXT_STEP_BUTTON) { - next_button_mouseup_events[gS6Info.editor_step](); + next_button_mouseup_events[EnumValue(gS6Info.editor_step)](); } } @@ -336,11 +336,11 @@ void window_editor_bottom_toolbar_invalidate(rct_window* w) } else { - if (gS6Info.editor_step == EDITOR_STEP_OBJECT_SELECTION) + if (gS6Info.editor_step == EditorStep::ObjectSelection) { hide_previous_step_button(); } - else if (gS6Info.editor_step == EDITOR_STEP_ROLLERCOASTER_DESIGNER) + else if (gS6Info.editor_step == EditorStep::RollercoasterDesigner) { hide_next_step_button(); } @@ -363,7 +363,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) bool drawPreviousButton = false; bool drawNextButton = false; - if (gS6Info.editor_step == EDITOR_STEP_OBJECT_SELECTION) + if (gS6Info.editor_step == EditorStep::ObjectSelection) { drawNextButton = true; } @@ -395,7 +395,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom + w->windowPos.y, FilterPaletteID::Palette51); } - if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) { gfx_filter_rect( dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + w->windowPos.x, @@ -419,7 +419,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) INSET_RECT_F_30); } - if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) { gfx_fill_rect_inset( dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + 1 + w->windowPos.x, @@ -435,8 +435,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) + w->windowPos.x; int16_t stateY = w->height - 0x0C + w->windowPos.y; gfx_draw_string_centred( - dpi, EditorStepNames[gS6Info.editor_step], { stateX, stateY }, NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, - nullptr); + dpi, EditorStepNames[EnumValue(gS6Info.editor_step)], { stateX, stateY }, + NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, nullptr); if (drawPreviousButton) { @@ -460,7 +460,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) + w->windowPos.x; int16_t textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->windowPos.y; - rct_string_id stringId = EditorStepNames[gS6Info.editor_step - 1]; + rct_string_id stringId = EditorStepNames[EnumValue(gS6Info.editor_step) - 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; @@ -468,7 +468,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr); } - if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) { gfx_draw_sprite( dpi, SPR_NEXT, @@ -490,7 +490,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) + w->windowPos.x; int16_t textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->windowPos.y; - rct_string_id stringId = EditorStepNames[gS6Info.editor_step + 1]; + rct_string_id stringId = EditorStepNames[EnumValue(gS6Info.editor_step) + 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 60476832bf..814a95d0eb 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1271,7 +1271,7 @@ static void window_editor_object_selection_manage_tracks() set_every_ride_type_invented(); set_every_ride_entry_invented(); - gS6Info.editor_step = EDITOR_STEP_TRACK_DESIGNS_MANAGER; + gS6Info.editor_step = EditorStep::DesignsManager; int32_t entry_index = 0; for (; object_entry_get_chunk(ObjectType::Ride, entry_index) == nullptr; entry_index++) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index d13ea911a6..e764c72dee 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -1059,7 +1059,7 @@ static void window_loadsave_select(rct_window* w, const char* path) save_path(&gConfigGeneral.last_save_scenario_directory, pathBuffer); int32_t parkFlagsBackup = gParkFlags; gParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; - gS6Info.editor_step = 255; + gS6Info.editor_step = EditorStep::Invalid; safe_strcpy(gScenarioFileName, pathBuffer, sizeof(gScenarioFileName)); int32_t success = scenario_save(pathBuffer, gConfigGeneral.save_plugin_data ? 3 : 2); gParkFlags = parkFlagsBackup; @@ -1073,7 +1073,7 @@ static void window_loadsave_select(rct_window* w, const char* path) else { context_show_error(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); - gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION; + gS6Info.editor_step = EditorStep::ObjectiveSelection; window_loadsave_invoke_callback(MODAL_RESULT_FAIL, pathBuffer); } break; diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index af006e5949..c03c263091 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -683,20 +683,20 @@ static void window_top_toolbar_invalidate(rct_window* w) window_top_toolbar_widgets[WIDX_NEWS].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_NETWORK].type = WindowWidgetType::Empty; - if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) + if (gS6Info.editor_step != EditorStep::LandscapeEditor) { window_top_toolbar_widgets[WIDX_LAND].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_WATER].type = WindowWidgetType::Empty; } - if (gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if (gS6Info.editor_step != EditorStep::RollercoasterDesigner) { window_top_toolbar_widgets[WIDX_RIDES].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; } - if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if (gS6Info.editor_step != EditorStep::LandscapeEditor && gS6Info.editor_step != EditorStep::RollercoasterDesigner) { window_top_toolbar_widgets[WIDX_MAP].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; @@ -3285,7 +3285,7 @@ static void top_toolbar_init_map_menu(rct_window* w, rct_widget* widget) auto i = 0; gDropdownItemsFormat[i++] = STR_SHORTCUT_SHOW_MAP; gDropdownItemsFormat[i++] = STR_EXTRA_VIEWPORT; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && gS6Info.editor_step == EditorStep::LandscapeEditor) { gDropdownItemsFormat[i++] = STR_MAPGEN_WINDOW_TITLE; } @@ -3313,7 +3313,7 @@ static void top_toolbar_init_map_menu(rct_window* w, rct_widget* widget) static void top_toolbar_map_menu_dropdown(int16_t dropdownIndex) { int32_t customStartIndex = 3; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && gS6Info.editor_step == EditorStep::LandscapeEditor) { customStartIndex++; } diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 2a5264d769..0ef3d751de 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -82,7 +82,7 @@ namespace Editor object_list_load(); OpenRCT2::GetContext()->GetGameState()->InitAll(150); gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; - gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; + gS6Info.editor_step = EditorStep::ObjectSelection; gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gS6Info.category = SCENARIO_CATEGORY_OTHER; viewport_init_all(); @@ -137,7 +137,7 @@ namespace Editor climate_reset(gClimate); gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; - gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION; + gS6Info.editor_step = EditorStep::ObjectiveSelection; gS6Info.category = SCENARIO_CATEGORY_OTHER; viewport_init_all(); News::InitQueue(); @@ -160,7 +160,7 @@ namespace Editor object_list_load(); OpenRCT2::GetContext()->GetGameState()->InitAll(150); SetAllLandOwned(); - gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; + gS6Info.editor_step = EditorStep::ObjectSelection; viewport_init_all(); rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -181,7 +181,7 @@ namespace Editor object_list_load(); OpenRCT2::GetContext()->GetGameState()->InitAll(150); SetAllLandOwned(); - gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; + gS6Info.editor_step = EditorStep::ObjectSelection; viewport_init_all(); rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); @@ -240,7 +240,7 @@ namespace Editor load_from_sv4(path); ClearMapForEditing(true); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gS6Info.editor_step = EditorStep::LandscapeEditor; gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); @@ -254,7 +254,7 @@ namespace Editor load_from_sc4(path); ClearMapForEditing(false); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gS6Info.editor_step = EditorStep::LandscapeEditor; gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); @@ -283,7 +283,7 @@ namespace Editor ClearMapForEditing(loadedFromSave); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gS6Info.editor_step = EditorStep::LandscapeEditor; gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); @@ -380,7 +380,7 @@ namespace Editor switch (gS6Info.editor_step) { - case EDITOR_STEP_OBJECT_SELECTION: + case EditorStep::ObjectSelection: if (window_find_by_class(WC_EDITOR_OBJECT_SELECTION)) { return; @@ -398,7 +398,7 @@ namespace Editor context_open_window(WC_EDITOR_OBJECT_SELECTION); break; - case EDITOR_STEP_INVENTIONS_LIST_SET_UP: + case EditorStep::InventionsListSetUp: if (window_find_by_class(WC_EDITOR_INVENTION_LIST)) { return; @@ -406,7 +406,7 @@ namespace Editor context_open_window(WC_EDITOR_INVENTION_LIST); break; - case EDITOR_STEP_OPTIONS_SELECTION: + case EditorStep::OptionsSelection: if (window_find_by_class(WC_EDITOR_SCENARIO_OPTIONS)) { return; @@ -414,7 +414,7 @@ namespace Editor context_open_window(WC_EDITOR_SCENARIO_OPTIONS); break; - case EDITOR_STEP_OBJECTIVE_SELECTION: + case EditorStep::ObjectiveSelection: if (window_find_by_class(WC_EDITOR_OBJECTIVE_OPTIONS)) { return; @@ -422,6 +422,12 @@ namespace Editor context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS); break; + case EditorStep::LandscapeEditor: + case EditorStep::SaveScenario: + case EditorStep::RollercoasterDesigner: + case EditorStep::DesignsManager: + case EditorStep::Invalid: + break; } } diff --git a/src/openrct2/Editor.h b/src/openrct2/Editor.h index 60a20a6ade..3faf90f33b 100644 --- a/src/openrct2/Editor.h +++ b/src/openrct2/Editor.h @@ -31,16 +31,17 @@ namespace Editor void SetSelectedObject(ObjectType objectType, size_t index, uint32_t flags); } // namespace Editor -enum RCT2_EDITOR_STEP +enum class EditorStep : uint8_t { - EDITOR_STEP_OBJECT_SELECTION, // 0 - EDITOR_STEP_LANDSCAPE_EDITOR, // 1 - EDITOR_STEP_INVENTIONS_LIST_SET_UP, // 2 - EDITOR_STEP_OPTIONS_SELECTION, // 3 - EDITOR_STEP_OBJECTIVE_SELECTION, // 4 - EDITOR_STEP_SAVE_SCENARIO, // 5 - EDITOR_STEP_ROLLERCOASTER_DESIGNER, // 6 - EDITOR_STEP_TRACK_DESIGNS_MANAGER // 7 + ObjectSelection, // 0 + LandscapeEditor, // 1 + InventionsListSetUp, // 2 + OptionsSelection, // 3 + ObjectiveSelection, // 4 + SaveScenario, // 5 + RollercoasterDesigner, // 6 + DesignsManager, // 7 + Invalid = 255, // 255 }; void editor_open_windows_for_current_step(); diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index d3318f30bf..beb0c068f3 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -399,14 +399,14 @@ void finish_object_selection() { set_every_ride_type_invented(); set_every_ride_entry_invented(); - gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER; + gS6Info.editor_step = EditorStep::RollercoasterDesigner; gfx_invalidate_screen(); } else { set_all_scenery_items_invented(); scenery_set_default_placement_configuration(); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gS6Info.editor_step = EditorStep::LandscapeEditor; gfx_invalidate_screen(); } } diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 0baaad4d34..c383dd51c3 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -351,7 +351,7 @@ void window_close_top() if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) + if (gS6Info.editor_step != EditorStep::LandscapeEditor) return; } @@ -1084,7 +1084,7 @@ void main_window_zoom(bool zoomIn, bool atCursor) { if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EditorStep::LandscapeEditor) { if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 4e509e22cb..e6db719ef3 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -342,7 +342,7 @@ private: auto context = OpenRCT2::GetContext(); context->GetObjectManager().UnloadAll(); context->GetGameState()->InitAll(mapSize); - gS6Info.editor_step = EDITOR_STEP_OBJECT_SELECTION; + gS6Info.editor_step = EditorStep::ObjectSelection; gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gS6Info.category = SCENARIO_CATEGORY_OTHER; } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 669d1d2392..18b786b7d2 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1984,7 +1984,7 @@ void Ride::UpdateAll() // Remove all rides if scenario editor if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { - if (gS6Info.editor_step <= EDITOR_STEP_INVENTIONS_LIST_SET_UP) + if (EnumValue(gS6Info.editor_step) <= EnumValue(EditorStep::InventionsListSetUp)) for (auto& ride : GetRideManager()) ride.Delete(); return; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 162fa950f7..7b5b781c95 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -915,7 +915,7 @@ bool Vehicle::SoundCanPlay() const if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return false; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) return false; if (sound1_id == OpenRCT2::Audio::SoundId::Null && sound2_id == OpenRCT2::Audio::SoundId::Null) @@ -1359,7 +1359,7 @@ void vehicle_update_all() if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) + if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EditorStep::RollercoasterDesigner) return; for (auto vehicle : EntityList(EntityListId::TrainHead)) diff --git a/src/openrct2/scenario/Scenario.h b/src/openrct2/scenario/Scenario.h index 054e45dff3..e4ac2d5254 100644 --- a/src/openrct2/scenario/Scenario.h +++ b/src/openrct2/scenario/Scenario.h @@ -27,6 +27,8 @@ using random_engine_t = Random::Rct2::Engine; +enum class EditorStep : uint8_t; + struct ParkLoadResult; #pragma pack(push, 1) @@ -51,7 +53,7 @@ assert_struct_size(rct_s6_header, 0x20); */ struct rct_s6_info { - uint8_t editor_step; + EditorStep editor_step; uint8_t category; // 0x01 uint8_t objective_type; // 0x02 uint8_t objective_arg_1; // 0x03