mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-03 12:54:43 +07:00
Resolved #10005 - Great person points for units not in ruleset are ignored, and warned against
This commit is contained in:
parent
713c5968b8
commit
5585dfa470
@ -364,6 +364,10 @@ class City : IsPartOfGameInfoSerialization {
|
||||
val gppCounter = Counter<String>()
|
||||
for (entry in getGreatPersonPointsForNextTurn().values)
|
||||
gppCounter.add(entry)
|
||||
// Remove all "gpp" values that are not valid units
|
||||
for (key in gppCounter.keys.toSet())
|
||||
if (key !in getRuleset().units)
|
||||
gppCounter.remove(key)
|
||||
return gppCounter
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,11 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
lines.add("${building.name} is buildable and therefore should either have an explicit cost or reference an existing tech!",
|
||||
RulesetErrorSeverity.Warning)
|
||||
|
||||
for (gpp in building.greatPersonPoints)
|
||||
if (gpp.key !in ruleset.units)
|
||||
lines.add("Building ${building.name} has greatPersonPoints for ${gpp.key}, which is not a unit in the ruleset!",
|
||||
RulesetErrorSeverity.Warning)
|
||||
|
||||
checkUniques(building, lines, rulesetInvariant, tryFixUnknownUniques)
|
||||
|
||||
}
|
||||
@ -234,6 +239,13 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
checkUniques(building, lines, rulesetSpecific, tryFixUnknownUniques)
|
||||
}
|
||||
|
||||
for (specialist in ruleset.specialists.values){
|
||||
for (gpp in specialist.greatPersonPoints)
|
||||
if (gpp.key !in ruleset.units)
|
||||
lines.add("Specialist ${specialist.name} has greatPersonPoints for ${gpp.key}, which is not a unit in the ruleset!",
|
||||
RulesetErrorSeverity.Warning)
|
||||
}
|
||||
|
||||
for (resource in ruleset.tileResources.values) {
|
||||
if (resource.revealedBy != null && !ruleset.technologies.containsKey(resource.revealedBy!!))
|
||||
lines += "${resource.name} revealed by tech ${resource.revealedBy} which does not exist!"
|
||||
|
@ -99,7 +99,7 @@ class ResourceTests {
|
||||
fun testImprovementProvidesResourceEvenWithoutTech() {
|
||||
val tile = game.tileMap[1,1]
|
||||
val improvement = game.createTileImprovement("Provides [1] [Coal]", "Consumes [1] [Silver]")
|
||||
tile.changeImprovement(improvement.name)
|
||||
tile.changeImprovement(improvement.name, civInfo)
|
||||
Assert.assertTrue(civInfo.getCivResourcesByName()["Coal"] == 1)
|
||||
Assert.assertTrue(civInfo.getCivResourcesByName()["Silver"] == -1)
|
||||
}
|
||||
@ -109,7 +109,7 @@ class ResourceTests {
|
||||
fun testImprovementProvidesResourceWithUniqueBonuses() {
|
||||
val tile = game.tileMap[1,1]
|
||||
val improvement = game.createTileImprovement("Provides [1] [Coal]")
|
||||
tile.changeImprovement(improvement.name)
|
||||
tile.changeImprovement(improvement.name, civInfo)
|
||||
Assert.assertTrue(civInfo.getCivResourcesByName()["Coal"] == 1)
|
||||
|
||||
val doubleCoal = game.createBuilding("Double quantity of [Coal] produced")
|
||||
|
Loading…
Reference in New Issue
Block a user