From 079e8ba1baf5c0ed9ef0254d0623370a9b720831 Mon Sep 17 00:00:00 2001 From: Michael <13953785+Laserlicht@users.noreply.github.com> Date: Mon, 14 Aug 2023 00:40:12 +0200 Subject: [PATCH] naming --- client/lobby/OptionsTab.cpp | 39 ++++++++++++++++++------------------- client/lobby/OptionsTab.h | 6 +++--- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/client/lobby/OptionsTab.cpp b/client/lobby/OptionsTab.cpp index 63508e312..4f752f4e2 100644 --- a/client/lobby/OptionsTab.cpp +++ b/client/lobby/OptionsTab.cpp @@ -424,10 +424,10 @@ OptionsTab::SelectionWindow::SelectionWindow(PlayerColor _color, SelType _type) color = _color; type = _type; - initialFraction = SEL->getStartInfo()->playerInfos.find(color)->second.castle; + initialFaction = SEL->getStartInfo()->playerInfos.find(color)->second.castle; initialHero = SEL->getStartInfo()->playerInfos.find(color)->second.hero; initialBonus = SEL->getStartInfo()->playerInfos.find(color)->second.bonus; - selectedFraction = initialFraction; + selectedFaction = initialFaction; selectedHero = initialHero; selectedBonus = initialBonus; allowedFactions = SEL->getPlayerInfo(color.getNum()).allowedFactions; @@ -440,7 +440,7 @@ OptionsTab::SelectionWindow::SelectionWindow(PlayerColor _color, SelType _type) if(initialHero >= -1) allowedBonus.push_back(0); // artifact allowedBonus.push_back(1); // gold - if(initialFraction >= 0) + if(initialFaction >= 0) allowedBonus.push_back(2); // resource recreate(); @@ -478,8 +478,8 @@ void OptionsTab::SelectionWindow::apply() void OptionsTab::SelectionWindow::setSelection() { - if(selectedFraction != initialFraction) - CSH->setPlayerOption(LobbyChangePlayerOption::TOWN_ID, selectedFraction, color); + if(selectedFaction != initialFaction) + CSH->setPlayerOption(LobbyChangePlayerOption::TOWN_ID, selectedFaction, color); if(selectedHero != initialHero) CSH->setPlayerOption(LobbyChangePlayerOption::HERO_ID, selectedHero, color); @@ -506,7 +506,7 @@ void OptionsTab::SelectionWindow::recreate() for(auto & elem : allowedHeroes) { CHero * type = VLC->heroh->objects[elem]; - if(type->heroClass->faction == selectedFraction) + if(type->heroClass->faction == selectedFaction) { count++; } @@ -514,7 +514,7 @@ void OptionsTab::SelectionWindow::recreate() elementsPerLine = floor(sqrt(count)); } - amountLines = calcLines((type > SelType::TOWN) ? selectedFraction : static_cast(-1)); + amountLines = calcLines((type > SelType::TOWN) ? selectedFaction : static_cast(-1)); } int x = (elementsPerLine) * 57; @@ -526,7 +526,7 @@ void OptionsTab::SelectionWindow::recreate() updateShadow(); if(type == SelType::TOWN) - genContentCastles(); + genContentFactions(); if(type == SelType::HERO) genContentHeroes(); if(type == SelType::BONUS) @@ -556,7 +556,7 @@ void OptionsTab::SelectionWindow::genContentGrid(int lines) } } -void OptionsTab::SelectionWindow::genContentCastles() +void OptionsTab::SelectionWindow::genContentFactions() { int i = 1; @@ -565,8 +565,8 @@ void OptionsTab::SelectionWindow::genContentCastles() set.castle = -1; CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN); components.push_back(std::make_shared(helper.getImageName(), helper.getImageIndex(), 0, 6, 32 / 2)); - drawOutlinedText(29, 56, (selectedFraction == -1) ? Colors::YELLOW : Colors::WHITE, helper.getName()); - if(selectedFraction == -1) + drawOutlinedText(29, 56, (selectedFaction == -1) ? Colors::YELLOW : Colors::WHITE, helper.getName()); + if(selectedFaction == -1) components.push_back(std::make_shared("lobby/townBorderSmallActivated", 6, 32 / 2)); for(auto & elem : allowedFactions) @@ -580,8 +580,8 @@ void OptionsTab::SelectionWindow::genContentCastles() CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN); components.push_back(std::make_shared(helper.getImageName(true), helper.getImageIndex(true), 0, x * 57, y * 63)); - components.push_back(std::make_shared(selectedFraction == elem ? "lobby/townBorderBigActivated" : "lobby/townBorderBig", x * 57, y * 63)); - drawOutlinedText(x * 57 + 29, y * 63 + 56, (selectedFraction == elem) ? Colors::YELLOW : Colors::WHITE, helper.getName()); + components.push_back(std::make_shared(selectedFaction == elem ? "lobby/townBorderBigActivated" : "lobby/townBorderBig", x * 57, y * 63)); + drawOutlinedText(x * 57 + 29, y * 63 + 56, (selectedFaction == elem) ? Colors::YELLOW : Colors::WHITE, helper.getName()); factions.push_back(elem); i++; @@ -605,7 +605,7 @@ void OptionsTab::SelectionWindow::genContentHeroes() { CHero * type = VLC->heroh->objects[elem]; - if(type->heroClass->faction == selectedFraction) + if(type->heroClass->faction == selectedFaction) { int x = i % elementsPerLine; @@ -641,11 +641,10 @@ void OptionsTab::SelectionWindow::genContentBonus() components.push_back(std::make_shared(helper.getImageName(), helper.getImageIndex(), 0, x * 57 + 6, y * 63 + 32 / 2)); drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::WHITE , helper.getName()); if(selectedBonus == elem) - if(elem == set.RESOURCE && selectedFraction >= 0) - { - components.push_back(std::make_shared("lobby/townBorderSmallActivated", x * 57 + 6, y * 63 + 32 / 2)); - drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::YELLOW , helper.getName()); - } + { + components.push_back(std::make_shared("lobby/townBorderSmallActivated", x * 57 + 6, y * 63 + 32 / 2)); + drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::YELLOW , helper.getName()); + } i++; } @@ -678,7 +677,7 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition) { } if(set.castle != -2) - selectedFraction = set.castle; + selectedFaction = set.castle; } if(type == SelType::HERO) { diff --git a/client/lobby/OptionsTab.h b/client/lobby/OptionsTab.h index 3a54826a3..4abf46ae5 100644 --- a/client/lobby/OptionsTab.h +++ b/client/lobby/OptionsTab.h @@ -108,10 +108,10 @@ public: std::vector factions; std::vector heroes; - FactionID initialFraction; + FactionID initialFaction; HeroTypeID initialHero; int initialBonus; - FactionID selectedFraction; + FactionID selectedFaction; HeroTypeID selectedHero; int selectedBonus; @@ -120,7 +120,7 @@ public: std::vector allowedBonus; void genContentGrid(int lines); - void genContentCastles(); + void genContentFactions(); void genContentHeroes(); void genContentBonus();