MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / onMouseUp

Method onMouseUp

src/openrct2-ui/windows/SavePrompt.cpp:143–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141 }
142
143 void onMouseUp(WidgetIndex widgetIndex) override
144 {
145 if (gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesigner
146 || gLegacyScene == LegacyScene::trackDesignsManager)
147 {
148 switch (widgetIndex)
149 {
150 case WQIDX_OK:
151 GameLoadOrQuitNoSavePrompt();
152 break;
153 case WQIDX_CLOSE:
154 case WQIDX_CANCEL:
155 close();
156 break;
157 }
158 return;
159 }
160
161 switch (widgetIndex)
162 {
163 case WIDX_SAVE:
164 {
165 std::unique_ptr<Intent> intent;
166
167 if (isInEditorMode())
168 {
169 intent = std::make_unique<Intent>(WindowClass::loadsave);
170 intent->PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save);
171 intent->PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape);
172 intent->PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioOptions.name);
173 }
174 else
175 {
176 intent = CreateSaveGameAsIntent();
177 }
178 close();
179 intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(WindowSavePromptCallback));
180 ContextOpenIntent(intent.get());
181 break;
182 }
183 case WIDX_DONT_SAVE:
184 GameLoadOrQuitNoSavePrompt();
185 return;
186 case WIDX_CLOSE:
187 case WIDX_CANCEL:
188 close();
189 return;
190 }
191 }
192
193 void onDraw(Drawing::RenderTarget& rt) override
194 {

Callers

nothing calls this directly

Calls 6

isInEditorModeFunction · 0.85
CreateSaveGameAsIntentFunction · 0.85
ContextOpenIntentFunction · 0.85
getMethod · 0.65
PutExtraMethod · 0.45

Tested by

no test coverage detected