MCPcopy Create free account
hub / github.com/diasurgical/devilution / UiOkDialog

Function UiOkDialog

SourceX/DiabloUI/dialogs.cpp:261–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259} // namespace
260
261void UiOkDialog(const char *text, const char *caption, bool error, UiItem *render_behind, std::size_t render_behind_size)
262{
263 static bool inDialog = false;
264
265 if (!gbActive || inDialog) {
266 if (SDL_ShowCursor(SDL_ENABLE) <= -1) {
267 SDL_Log(SDL_GetError());
268 }
269#ifndef RUN_TESTS
270 if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, text, caption, NULL) <= -1) {
271 SDL_Log(SDL_GetError());
272#else
273 {
274#endif
275 SDL_Log(text);
276 SDL_Log(caption);
277 }
278 return;
279 }
280
281 inDialog = true;
282 Init(text, caption, error, render_behind_size > 0);
283 DialogLoop(dialogItems, dialogItemsSize, render_behind, render_behind_size);
284 Deinit();
285 inDialog = false;
286}
287
288void UiErrorOkDialog(const char *text, const char *caption, UiItem *render_behind, std::size_t render_behind_size)
289{
290 UiOkDialog(text, caption, /*error=*/true, render_behind, render_behind_size);
291}
292
293void UiErrorOkDialog(const char *text, const char *caption, bool error)
294{
295 UiOkDialog(text, caption, error, nullptr, 0);
296}
297
298void UiErrorOkDialog(const char *text, UiItem *render_behind, std::size_t render_behind_size)
299{
300 UiErrorOkDialog(text, nullptr, render_behind, render_behind_size);
301}
302
303} // namespace dvl

Callers 1

UiErrorOkDialogFunction · 0.85

Calls 5

SDL_LogFunction · 0.85
SDL_ShowSimpleMessageBoxFunction · 0.85
DialogLoopFunction · 0.85
DeinitFunction · 0.85
InitFunction · 0.70

Tested by

no test coverage detected