Browse Source

Merge pull request #4481 from Laserlicht/fix_hota

fix for 8th creature
Ivan Savenko 1 year ago
parent
commit
3e605253db
2 changed files with 10 additions and 1 deletions
  1. 2 1
      client/windows/CCastleInterface.cpp
  2. 8 0
      lib/constants/EntityIdentifiers.h

+ 2 - 1
client/windows/CCastleInterface.cpp

@@ -1894,8 +1894,9 @@ const CBuilding * CFortScreen::RecruitArea::getMyBuilding()
 	{
 		if (town->hasBuilt(myID))
 			build = town->town->buildings.at(myID);
-		myID.advance(town->town->creatures.size());
+		BuildingID::advanceDwelling(myID);
 	}
+
 	return build;
 }
 

+ 8 - 0
lib/constants/EntityIdentifiers.h

@@ -352,6 +352,14 @@ public:
 		return (dwelling - DWELL_FIRST) / (GameConstants::CREATURES_PER_TOWN - 1);
 	}
 
+	static void advanceDwelling(BuildingIDBase & dwelling)
+	{
+		if(dwelling != BuildingIDBase::DWELL_LVL_8)
+			dwelling.advance(GameConstants::CREATURES_PER_TOWN - 1);
+		else
+			dwelling.advance(1);
+	}
+
 	bool IsSpecialOrGrail() const
 	{
 		return num == SPECIAL_1 || num == SPECIAL_2 || num == SPECIAL_3 || num == SPECIAL_4 || num == GRAIL;