|
|
|
|
@ -26,7 +26,7 @@ char selgame_Password[16] = "";
|
|
|
|
|
char selgame_Description[512]; |
|
|
|
|
std::string selgame_Title; |
|
|
|
|
bool selgame_enteringGame; |
|
|
|
|
int selgame_selectedGame; |
|
|
|
|
size_t selgame_selectedGame; |
|
|
|
|
bool selgame_endMenu; |
|
|
|
|
int *gdwPlayerId; |
|
|
|
|
_difficulty nDifficulty; |
|
|
|
|
@ -46,7 +46,7 @@ std::vector<std::unique_ptr<UiListItem>> vecSelGameDlgItems;
|
|
|
|
|
std::vector<std::unique_ptr<UiItemBase>> vecSelGameDialog; |
|
|
|
|
std::vector<GameInfo> Gamelist; |
|
|
|
|
uint32_t firstPublicGameInfoRequestSend = 0; |
|
|
|
|
unsigned HighlightedItem; |
|
|
|
|
size_t HighlightedItem; |
|
|
|
|
|
|
|
|
|
void selgame_FreeVectors() |
|
|
|
|
{ |
|
|
|
|
@ -175,7 +175,7 @@ void UiInitGameSelectionList(std::string_view search)
|
|
|
|
|
SDL_Rect rect6 = { (Sint16)(uiPosition.x + 449), (Sint16)(uiPosition.y + 427), 140, 35 }; |
|
|
|
|
vecSelGameDialog.push_back(std::make_unique<UiArtTextButton>(_("CANCEL"), &UiFocusNavigationEsc, rect6, UiFlags::AlignCenter | UiFlags::VerticalCenter | UiFlags::FontSize30 | UiFlags::ColorUiGold)); |
|
|
|
|
|
|
|
|
|
auto selectFn = [](int index) { |
|
|
|
|
auto selectFn = [](size_t index) { |
|
|
|
|
// UiListItem::m_value could be different from
|
|
|
|
|
// the index if packet encryption is disabled
|
|
|
|
|
int itemValue = vecSelGameDlgItems[index]->m_value; |
|
|
|
|
@ -183,7 +183,7 @@ void UiInitGameSelectionList(std::string_view search)
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (!search.empty()) { |
|
|
|
|
for (unsigned i = 0; i < vecSelGameDlgItems.size(); i++) { |
|
|
|
|
for (size_t i = 0; i < vecSelGameDlgItems.size(); i++) { |
|
|
|
|
int gameIndex = vecSelGameDlgItems[i]->m_value - 3; |
|
|
|
|
if (gameIndex < 0) |
|
|
|
|
continue; |
|
|
|
|
@ -206,11 +206,10 @@ void selgame_GameSelection_Init()
|
|
|
|
|
UiInitGameSelectionList(""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_GameSelection_Focus(int value) |
|
|
|
|
void selgame_GameSelection_Focus(size_t value) |
|
|
|
|
{ |
|
|
|
|
const auto index = static_cast<unsigned>(value); |
|
|
|
|
HighlightedItem = index; |
|
|
|
|
const UiListItem &item = *vecSelGameDlgItems[index]; |
|
|
|
|
HighlightedItem = value; |
|
|
|
|
const UiListItem &item = *vecSelGameDlgItems[value]; |
|
|
|
|
switch (item.m_value) { |
|
|
|
|
case 0: |
|
|
|
|
CopyUtf8(selgame_Description, _("Create a new game with a difficulty setting of your choice."), sizeof(selgame_Description)); |
|
|
|
|
@ -290,7 +289,7 @@ bool UpdateHeroLevel(_uiheroinfo *pInfo)
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_GameSelection_Select(int value) |
|
|
|
|
void selgame_GameSelection_Select(size_t value) |
|
|
|
|
{ |
|
|
|
|
selgame_enteringGame = true; |
|
|
|
|
selgame_selectedGame = value; |
|
|
|
|
@ -384,7 +383,7 @@ void selgame_GameSelection_Esc()
|
|
|
|
|
selgame_endMenu = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Diff_Focus(int value) |
|
|
|
|
void selgame_Diff_Focus(size_t value) |
|
|
|
|
{ |
|
|
|
|
switch (vecSelGameDlgItems[value]->m_value) { |
|
|
|
|
case DIFF_NORMAL: |
|
|
|
|
@ -421,7 +420,7 @@ bool IsDifficultyAllowed(int value)
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Diff_Select(int value) |
|
|
|
|
void selgame_Diff_Select(size_t value) |
|
|
|
|
{ |
|
|
|
|
if (selhero_isMultiPlayer && !IsDifficultyAllowed(vecSelGameDlgItems[value]->m_value)) { |
|
|
|
|
selgame_GameSelection_Select(selgame_selectedGame); |
|
|
|
|
@ -510,7 +509,7 @@ void selgame_GameSpeedSelection()
|
|
|
|
|
UiInitList(selgame_Speed_Focus, selgame_Speed_Select, selgame_Speed_Esc, vecSelGameDialog, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Speed_Focus(int value) |
|
|
|
|
void selgame_Speed_Focus(size_t value) |
|
|
|
|
{ |
|
|
|
|
switch (vecSelGameDlgItems[value]->m_value) { |
|
|
|
|
case 20: |
|
|
|
|
@ -538,7 +537,7 @@ void selgame_Speed_Esc()
|
|
|
|
|
selgame_GameSelection_Select(selgame_selectedGame); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Speed_Select(int value) |
|
|
|
|
void selgame_Speed_Select(size_t value) |
|
|
|
|
{ |
|
|
|
|
nTickRate = vecSelGameDlgItems[value]->m_value; |
|
|
|
|
|
|
|
|
|
@ -550,7 +549,7 @@ void selgame_Speed_Select(int value)
|
|
|
|
|
selgame_Password_Init(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Password_Init(int /*value*/) |
|
|
|
|
void selgame_Password_Init(size_t /*value*/) |
|
|
|
|
{ |
|
|
|
|
memset(&selgame_Password, 0, sizeof(selgame_Password)); |
|
|
|
|
|
|
|
|
|
@ -602,7 +601,7 @@ static bool IsGameCompatibleWithErrorMessage(const GameData &data)
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void selgame_Password_Select(int /*value*/) |
|
|
|
|
void selgame_Password_Select(size_t /*value*/) |
|
|
|
|
{ |
|
|
|
|
char *gamePassword = nullptr; |
|
|
|
|
if (selgame_selectedGame == 0) |
|
|
|
|
|