Browse Source

generate at least one resource / creature

Laserlicht 1 year ago
parent
commit
977d8e041a
2 changed files with 7 additions and 1 deletions
  1. 4 1
      lib/mapObjects/CGTownInstance.cpp
  2. 3 0
      lib/mapObjects/MiscObjects.cpp

+ 4 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -1269,7 +1269,10 @@ int GrowthInfo::totalGrowth() const
 	for(const Entry &entry : entries)
 		ret += entry.count;
 
-	return ret * percent / 100;
+	auto retCalc = ret * percent / 100;
+	if(retCalc == 0 && ret > 0) //generate at least one
+		retCalc = 1;
+	return retCalc;
 }
 
 void CGTownInstance::fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &stack) const

+ 3 - 0
lib/mapObjects/MiscObjects.cpp

@@ -199,6 +199,9 @@ ui32 CGMine::defaultResProduction() const
 ui32 CGMine::getProducedQuantity() const
 {
 	auto * playerSettings = cb->getPlayerSettings(getOwner());
+	auto ret = producedQuantity * playerSettings->handicap.percentIncome / 100;
+	if(ret == 0 && producedQuantity > 0) // create at least 1 resource
+		ret = 1;
 	return producedQuantity * playerSettings->handicap.percentIncome / 100;
 }