1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Removed ARRAY_COUNT in favor of std::size

This commit is contained in:
Ivan Savenko
2023-04-11 01:29:36 +03:00
parent 506c3d29bc
commit 644f0f4b32
12 changed files with 21 additions and 25 deletions

View File

@@ -433,7 +433,7 @@ void CSpellWindow::keyPressed(const SDL_Keycode & key)
int index = -1;
while(schoolsOrder[++index] != selectedTab);
index += (down ? 1 : -1);
vstd::abetween<int>(index, 0, ARRAY_COUNT(schoolsOrder) - 1);
vstd::abetween<int>(index, 0, std::size(schoolsOrder) - 1);
if(selectedTab != schoolsOrder[index])
selectSchool(schoolsOrder[index]);
break;
@@ -463,8 +463,8 @@ void CSpellWindow::keyPressed(const SDL_Keycode & key)
static const SDL_Keycode spellSelectors[] = {SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_0, SDLK_MINUS, SDLK_EQUALS};
int index = -1;
while(++index < ARRAY_COUNT(spellSelectors) && spellSelectors[index] != hlpKey);
if(index >= ARRAY_COUNT(spellSelectors))
while(++index < std::size(spellSelectors) && spellSelectors[index] != hlpKey);
if(index >= std::size(spellSelectors))
return;
//try casting spell