MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / loadsaveMenuDropdown

Function loadsaveMenuDropdown

src/OpenLoco/src/Ui/Windows/ToolbarTopAlt.cpp:112–189  ·  view source on GitHub ↗

0x0043D695

Source from the content-addressed store, hash-verified

110
111 // 0x0043D695
112 static void loadsaveMenuDropdown([[maybe_unused]] Window* window, [[maybe_unused]] WidgetIndex_t widgetIndex, int16_t itemIndex)
113 {
114 if (itemIndex == -1)
115 {
116 itemIndex = Dropdown::getHighlightedItem();
117 }
118
119 switch (itemIndex)
120 {
121 case 0:
122 // Load Landscape
123 {
124 GameCommands::LoadSaveQuitGameArgs args{};
125 args.loadQuitMode = LoadOrQuitMode::loadGamePrompt;
126 args.saveMode = GameCommands::LoadSaveQuitGameArgs::SaveMode::promptSave;
127 GameCommands::doCommand(args, GameCommands::Flags::apply);
128 }
129 break;
130
131 case 1:
132 {
133 if (Scenario::getOptions().editorStep == EditorController::Step::objectSelection)
134 {
135 if (!ObjectSelectionWindow::tryCloseWindow())
136 {
137 // Try close has failed so do not open save window!
138 return;
139 }
140 }
141 WindowManager::closeAllFloatingWindows();
142 ToolManager::toolCancel();
143
144 // Save Landscape
145 if (auto res = OpenLoco::Game::saveLandscapeOpen())
146 {
147 OpenLoco::Game::saveLandscape(*res);
148 Gfx::invalidateScreen();
149 }
150 break;
151 }
152
153 case 3:
154 About::open();
155 break;
156
157 case 4:
158 Options::open();
159 break;
160
161 case 5:
162 triggerScreenshotCountdown(10, ScreenshotType::regular);
163 break;
164
165 case 6:
166 triggerScreenshotCountdown(10, ScreenshotType::giant);
167 break;
168
169 case 8:

Callers 1

onDropdownFunction · 0.70

Calls 10

getHighlightedItemFunction · 0.85
tryCloseWindowFunction · 0.85
saveLandscapeOpenFunction · 0.85
saveLandscapeFunction · 0.85
invalidateScreenFunction · 0.85
toolCancelFunction · 0.70
openFunction · 0.70
doCommandFunction · 0.50
closeAllFloatingWindowsFunction · 0.50

Tested by

no test coverage detected