mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 23:37:31 +07:00
Fixed bug where production from cutting down forests could apply to perpetual constructions (#4694)
This commit is contained in:
parent
96aad7b087
commit
5324eb96b5
@ -24,7 +24,7 @@ import kotlin.math.roundToInt
|
||||
* City constructions manager.
|
||||
*
|
||||
* @property cityInfo the city it refers to
|
||||
* @property currentConstructionFromQueue the name of the construction is currently worked, default = "Monument"
|
||||
* @property currentConstructionFromQueue the name of the construction is currently worked
|
||||
* @property currentConstructionIsUserSet a flag indicating if the [currentConstructionFromQueue] has been set by the user or by the AI
|
||||
* @property constructionQueue a list of constructions names enqueued
|
||||
*/
|
||||
@ -100,8 +100,7 @@ class CityConstructions {
|
||||
// all non-local uniques with this placeholderText from other cities belong to wonders,
|
||||
// while the local uniques with this placeholderText are from buildings, but this is in no
|
||||
// way a given. In reality, there should be functions getBuildingStats and getWonderStats,
|
||||
// to solve this, with getStats merely adding these two together. Implementing this is on
|
||||
// my ToDoList, but this PR is already large enough as it is.
|
||||
// to solve this, with getStats merely adding these two together.
|
||||
for (unique in cityInfo.getLocalMatchingUniques("[] per [] population []")
|
||||
.filter { cityInfo.matchesFilter(it.params[2])}
|
||||
) {
|
||||
@ -215,7 +214,7 @@ class CityConstructions {
|
||||
// if the construction name is the same as the current construction, it isn't the first
|
||||
return constructionQueueIndex == constructionQueue.indexOfFirst { it == name }
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal fun getConstruction(constructionName: String): IConstruction {
|
||||
val gameBasics = cityInfo.getRuleset()
|
||||
@ -297,6 +296,11 @@ class CityConstructions {
|
||||
}
|
||||
|
||||
fun addProductionPoints(productionToAdd: Int) {
|
||||
val construction = getConstruction(currentConstructionFromQueue)
|
||||
if (construction is PerpetualConstruction) {
|
||||
productionOverflow += productionToAdd
|
||||
return
|
||||
}
|
||||
if (!inProgressConstructions.containsKey(currentConstructionFromQueue))
|
||||
inProgressConstructions[currentConstructionFromQueue] = 0
|
||||
inProgressConstructions[currentConstructionFromQueue] = inProgressConstructions[currentConstructionFromQueue]!! + productionToAdd
|
||||
|
Loading…
Reference in New Issue
Block a user