Browse Source

Enum for dlgresult

pull/25/head
Anders Jenbo 7 years ago
parent
commit
0e0d41376f
  1. 6
      Source/mainmenu.cpp
  2. 8
      Stub/DiabloUI/selhero.cpp
  3. 7
      enums.h

6
Source/mainmenu.cpp

@ -35,7 +35,7 @@ int __stdcall mainmenu_select_hero_dialog(
BOOL *multi)
{
BOOL hero_is_created = TRUE;
int dlgresult = 0;
int dlgresult = NEW_GAME;
if (gbMaxPlayers == 1) {
if (!UiSelHeroSingDialog(
pfile_ui_set_hero_infos,
@ -48,7 +48,7 @@ int __stdcall mainmenu_select_hero_dialog(
TermMsg("Unable to display SelHeroSing");
if (dlgresult == 2)
if (dlgresult == LOAD_GAME)
gbLoadGame = TRUE;
else
gbLoadGame = FALSE;
@ -63,7 +63,7 @@ int __stdcall mainmenu_select_hero_dialog(
gszHero)) {
TermMsg("Can't load multiplayer dialog");
}
if (dlgresult == 4) {
if (dlgresult == EXIT_MENU) {
SErrSetLastError(1223);
return 0;
}

8
Stub/DiabloUI/selhero.cpp

@ -251,7 +251,7 @@ BOOL __stdcall UiSelHeroSingDialog(
break;
}
*dlgresult = 4;
*dlgresult = EXIT_MENU;
endMenu = true;
break;
case SDLK_BACKSPACE:
@ -281,6 +281,8 @@ BOOL __stdcall UiSelHeroSingDialog(
case SINGLEPLAYER_LOAD:
if (SelectedItem == SelectedItemMax) {
SetMenu(SINGLEPLAYER_CLASSES);
} else {
*dlgresult = LOAD_GAME;
}
break;
case SINGLEPLAYER_CLASSES:
@ -365,7 +367,7 @@ BOOL __stdcall UiSelHeroSingDialog(
const char *test_name = chr_name_str;
if (!StartNewGame) {
*dlgresult = 2; // This means load game
*dlgresult = LOAD_GAME;
}
strcpy(name, test_name);
}
@ -420,7 +422,7 @@ BOOL __stdcall UiSelHeroMultDialog(
break;
}
*dlgresult = 4;
*dlgresult = EXIT_MENU;
return TRUE;
case SDLK_UP:
SelectedItem--;

7
enums.h

@ -2267,6 +2267,13 @@ typedef enum menus
CREDIT,
} menus;
typedef enum dlgresults
{
NEW_GAME = 0,
LOAD_GAME = 2,
EXIT_MENU = 4,
} dlgresults;
typedef enum panel_button_id {
PANBTN_CHARINFO = 0,
PANBTN_QLOG = 1,

Loading…
Cancel
Save