Skip to content

Commit

Permalink
Avoid console warnings on dialog init w/o diabdat
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm authored and AJenbo committed Oct 3, 2019
1 parent b536d0e commit ea4358f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions SourceX/DiabloUI/dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,19 @@ void Init(const char *text, const char *caption, bool error)
{
strcpy(dialogText, text);
if (caption == nullptr) {
LoadMaskedArt(error ? "ui_art\\srpopup.pcx" : "ui_art\\spopup.pcx", &dialogArt);
if (diabdat_mpq != nullptr) {
LoadMaskedArt(error ? "ui_art\\srpopup.pcx" : "ui_art\\spopup.pcx", &dialogArt);
} else {
StubArt(&dialogArt, DIALOG_ART_S.rect.w, DIALOG_ART_S.rect.h, DEFAULT_BG_DIALOG_IDX);
}
dialogItems = OK_DIALOG;
dialogItemsSize = size(OK_DIALOG);
} else {
LoadMaskedArt(error ? "ui_art\\lrpopup.pcx" : "ui_art\\lpopup.pcx", &dialogArt);
if (diabdat_mpq != nullptr) {
LoadMaskedArt(error ? "ui_art\\lrpopup.pcx" : "ui_art\\lpopup.pcx", &dialogArt);
} else {
StubArt(&dialogArt, DIALOG_ART_L.rect.w, DIALOG_ART_L.rect.h, DEFAULT_BG_DIALOG_IDX);
}
strcpy(dialogCaption, caption);
dialogItems = OK_DIALOG_WITH_CAPTION;
dialogItemsSize = size(OK_DIALOG_WITH_CAPTION);
Expand All @@ -124,8 +132,6 @@ void Init(const char *text, const char *caption, bool error)
if (diabdat_mpq == nullptr) {
ShowCursor(true);
LoadFallbackPalette();
const auto dlg_rect = (caption == nullptr ? DIALOG_ART_S.rect : DIALOG_ART_L.rect);
StubArt(&dialogArt, dlg_rect.w, dlg_rect.h, DEFAULT_BG_DIALOG_IDX);
const auto &btn = dialogItems[dialogItemsSize - 1].button;
StubArt(btn.art, btn.rect.w, btn.rect.h, DEFAULT_BG_BUTTON_IDX);
}
Expand Down

0 comments on commit ea4358f

Please sign in to comment.