Michael пре 2 година
родитељ
комит
079e8ba1ba
2 измењених фајлова са 22 додато и 23 уклоњено
  1. 19 20
      client/lobby/OptionsTab.cpp
  2. 3 3
      client/lobby/OptionsTab.h

+ 19 - 20
client/lobby/OptionsTab.cpp

@@ -424,10 +424,10 @@ OptionsTab::SelectionWindow::SelectionWindow(PlayerColor _color, SelType _type)
 	color = _color;
 	color = _color;
 	type = _type;
 	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;
 	initialHero = SEL->getStartInfo()->playerInfos.find(color)->second.hero;
 	initialBonus = SEL->getStartInfo()->playerInfos.find(color)->second.bonus;
 	initialBonus = SEL->getStartInfo()->playerInfos.find(color)->second.bonus;
-	selectedFraction = initialFraction;
+	selectedFaction = initialFaction;
 	selectedHero = initialHero;
 	selectedHero = initialHero;
 	selectedBonus = initialBonus;
 	selectedBonus = initialBonus;
 	allowedFactions = SEL->getPlayerInfo(color.getNum()).allowedFactions;
 	allowedFactions = SEL->getPlayerInfo(color.getNum()).allowedFactions;
@@ -440,7 +440,7 @@ OptionsTab::SelectionWindow::SelectionWindow(PlayerColor _color, SelType _type)
 	if(initialHero >= -1)
 	if(initialHero >= -1)
 		allowedBonus.push_back(0); // artifact
 		allowedBonus.push_back(0); // artifact
 	allowedBonus.push_back(1); // gold
 	allowedBonus.push_back(1); // gold
-	if(initialFraction >= 0)
+	if(initialFaction >= 0)
 		allowedBonus.push_back(2); // resource
 		allowedBonus.push_back(2); // resource
 
 
 	recreate();
 	recreate();
@@ -478,8 +478,8 @@ void OptionsTab::SelectionWindow::apply()
 
 
 void OptionsTab::SelectionWindow::setSelection()
 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)
 	if(selectedHero != initialHero)
 		CSH->setPlayerOption(LobbyChangePlayerOption::HERO_ID, selectedHero, color);
 		CSH->setPlayerOption(LobbyChangePlayerOption::HERO_ID, selectedHero, color);
@@ -506,7 +506,7 @@ void OptionsTab::SelectionWindow::recreate()
 			for(auto & elem : allowedHeroes)
 			for(auto & elem : allowedHeroes)
 			{
 			{
 				CHero * type = VLC->heroh->objects[elem];
 				CHero * type = VLC->heroh->objects[elem];
-				if(type->heroClass->faction == selectedFraction)
+				if(type->heroClass->faction == selectedFaction)
 				{
 				{
 					count++;
 					count++;
 				}
 				}
@@ -514,7 +514,7 @@ void OptionsTab::SelectionWindow::recreate()
 			elementsPerLine = floor(sqrt(count));
 			elementsPerLine = floor(sqrt(count));
 		}
 		}
 
 
-		amountLines = calcLines((type > SelType::TOWN) ? selectedFraction : static_cast<FactionID>(-1));
+		amountLines = calcLines((type > SelType::TOWN) ? selectedFaction : static_cast<FactionID>(-1));
 	}
 	}
 
 
 	int x = (elementsPerLine) * 57;
 	int x = (elementsPerLine) * 57;
@@ -526,7 +526,7 @@ void OptionsTab::SelectionWindow::recreate()
 	updateShadow();
 	updateShadow();
 
 
 	if(type == SelType::TOWN)
 	if(type == SelType::TOWN)
-		genContentCastles();
+		genContentFactions();
 	if(type == SelType::HERO)
 	if(type == SelType::HERO)
 		genContentHeroes();
 		genContentHeroes();
 	if(type == SelType::BONUS)
 	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;
 	int i = 1;
 
 
@@ -565,8 +565,8 @@ void OptionsTab::SelectionWindow::genContentCastles()
 	set.castle = -1;
 	set.castle = -1;
 	CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
 	CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
 	components.push_back(std::make_shared<CAnimImage>(helper.getImageName(), helper.getImageIndex(), 0, 6, 32 / 2));
 	components.push_back(std::make_shared<CAnimImage>(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<CPicture>("lobby/townBorderSmallActivated", 6, 32 / 2));
 		components.push_back(std::make_shared<CPicture>("lobby/townBorderSmallActivated", 6, 32 / 2));
 
 
 	for(auto & elem : allowedFactions)
 	for(auto & elem : allowedFactions)
@@ -580,8 +580,8 @@ void OptionsTab::SelectionWindow::genContentCastles()
 		CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
 		CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
 
 
 		components.push_back(std::make_shared<CAnimImage>(helper.getImageName(true), helper.getImageIndex(true), 0, x * 57, y * 63));
 		components.push_back(std::make_shared<CAnimImage>(helper.getImageName(true), helper.getImageIndex(true), 0, x * 57, y * 63));
-		components.push_back(std::make_shared<CPicture>(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<CPicture>(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);
 		factions.push_back(elem);
 
 
 		i++;
 		i++;
@@ -605,7 +605,7 @@ void OptionsTab::SelectionWindow::genContentHeroes()
 	{
 	{
 		CHero * type = VLC->heroh->objects[elem];
 		CHero * type = VLC->heroh->objects[elem];
 
 
-		if(type->heroClass->faction == selectedFraction)
+		if(type->heroClass->faction == selectedFaction)
 		{
 		{
 
 
 			int x = i % elementsPerLine;
 			int x = i % elementsPerLine;
@@ -641,11 +641,10 @@ void OptionsTab::SelectionWindow::genContentBonus()
 		components.push_back(std::make_shared<CAnimImage>(helper.getImageName(), helper.getImageIndex(), 0, x * 57 + 6, y * 63 + 32 / 2));
 		components.push_back(std::make_shared<CAnimImage>(helper.getImageName(), helper.getImageIndex(), 0, x * 57 + 6, y * 63 + 32 / 2));
 		drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::WHITE , helper.getName());
 		drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::WHITE , helper.getName());
 		if(selectedBonus == elem)
 		if(selectedBonus == elem)
-			if(elem == set.RESOURCE && selectedFraction >= 0)
-			{
-				components.push_back(std::make_shared<CPicture>("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<CPicture>("lobby/townBorderSmallActivated", x * 57 + 6, y * 63 + 32 / 2));
+			drawOutlinedText(x * 57 + 29, y * 63 + 56, Colors::YELLOW , helper.getName());
+		}
 
 
 		i++;
 		i++;
 	}
 	}
@@ -678,7 +677,7 @@ void OptionsTab::SelectionWindow::clickReleased(const Point & cursorPosition) {
 		}
 		}
 
 
 		if(set.castle != -2)
 		if(set.castle != -2)
-			selectedFraction = set.castle;
+			selectedFaction = set.castle;
 	}
 	}
 	if(type == SelType::HERO)
 	if(type == SelType::HERO)
 	{
 	{

+ 3 - 3
client/lobby/OptionsTab.h

@@ -108,10 +108,10 @@ public:
 		std::vector<FactionID> factions;
 		std::vector<FactionID> factions;
 		std::vector<HeroTypeID> heroes;
 		std::vector<HeroTypeID> heroes;
 
 
-		FactionID initialFraction;
+		FactionID initialFaction;
 		HeroTypeID initialHero;
 		HeroTypeID initialHero;
 		int initialBonus;
 		int initialBonus;
-		FactionID selectedFraction;
+		FactionID selectedFaction;
 		HeroTypeID selectedHero;
 		HeroTypeID selectedHero;
 		int selectedBonus;
 		int selectedBonus;
 
 
@@ -120,7 +120,7 @@ public:
 		std::vector<int> allowedBonus;
 		std::vector<int> allowedBonus;
 
 
 		void genContentGrid(int lines);
 		void genContentGrid(int lines);
-		void genContentCastles();
+		void genContentFactions();
 		void genContentHeroes();
 		void genContentHeroes();
 		void genContentBonus();
 		void genContentBonus();