-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for city level stockpiles to actually function #12710
base: master
Are you sure you want to change the base?
Changes from all commits
38d1b53
485499f
0a548a6
74a45cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,7 +435,8 @@ class CityConstructions : IsPartOfGameInfoSerialization { | |
for (unique in costUniques) { | ||
val amount = unique.params[0].toInt() | ||
val resourceName = unique.params[1] | ||
city.civ.gainStockpiledResource(resourceName, -amount) | ||
val resource = city.civ.gameInfo.ruleset.tileResources[resourceName] ?: continue | ||
city.gainStockpiledResource(resource, -amount) | ||
Comment on lines
+438
to
+439
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This, to me, indicates that the gainStockpiledResource(String) should do the resource lookup, and then call the gainStockpiledResource(Resource) function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not entirely ideal unless we decide to add additional logic here, since the counter itself only cares about the resource name (for the sake of serialization) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, if this is what's wanted, the actual thing is to delete the function for strings (I added it for clarity, but the counter is still public rn, actually). Currently, the city version for strings can already be safely deleted |
||
} | ||
|
||
if (construction !is Building) return | ||
|
@@ -705,7 +706,8 @@ class CityConstructions : IsPartOfGameInfoSerialization { | |
for (unique in costUniques) { | ||
val amount = unique.params[0].toInt() | ||
val resourceName = unique.params[1] | ||
city.civ.gainStockpiledResource(resourceName, -amount) | ||
val resource = city.civ.gameInfo.ruleset.tileResources[resourceName] ?: continue | ||
city.gainStockpiledResource(resource, -amount) | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do when it's civ-wide? Fall down to "civ.getReserve(stat)" below?
I'd rather this was explicit in the "stat is TileResource", that it become a "return when()" so we see that we treat all TileResources cases exhaustively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it like that originally, but wasn't sure if it should be explicit