modOptions propogation now works - mods can get by without having a Barbarians civilization!

This commit is contained in:
Yair Morgenstern 2020-04-19 00:24:50 +03:00
parent 745d48c2ae
commit 004bede4bb
3 changed files with 10 additions and 5 deletions

View file

@ -60,7 +60,7 @@ object GameStarter {
val availableCivNames = Stack<String>()
availableCivNames.addAll(ruleset.nations.filter { !it.value.isCityState() }.keys.shuffled())
availableCivNames.removeAll(newGameParameters.players.map { it.chosenCiv })
availableCivNames.remove(Constants.barbarianEncampment)
availableCivNames.remove(Constants.barbarians)
if(!newGameParameters.noBarbarians && ruleset.modOptions.barbarians!=Constants.disabled) {
val barbarianCivilization = CivilizationInfo(Constants.barbarians)

View file

@ -209,6 +209,9 @@ object RulesetCache :HashMap<String,Ruleset>() {
for (mod in loadedMods.sortedByDescending { it.modOptions.isBaseRuleset }) {
newRuleset.add(mod)
newRuleset.mods += mod.name
if(mod.modOptions.isBaseRuleset){
newRuleset.modOptions = mod.modOptions
}
}
newRuleset.updateBuildingCosts() // only after we've added all the mods can we calculate the building costs

View file

@ -196,8 +196,10 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay
fun reloadMods() {
ruleset.clear()
ruleset.add(RulesetCache.getComplexRuleset(newGameParameters.mods))
val newRuleset = RulesetCache.getComplexRuleset(newGameParameters.mods)
ruleset.add(newRuleset)
ruleset.mods += newGameParameters.mods
ruleset.modOptions = newRuleset.modOptions
ImageGetter.ruleset = ruleset
ImageGetter.setTextureRegionDrawables()