Fixed tests which broke due to console checking being dependant on UncivGame.Current

This commit is contained in:
Yair Morgenstern 2020-07-04 23:57:45 +03:00
parent d7cc0868fb
commit c94079c0a7
2 changed files with 5 additions and 5 deletions

View file

@ -183,11 +183,11 @@ class Ruleset {
* save all of the loaded rulesets somewhere for later use
* */
object RulesetCache :HashMap<String,Ruleset>() {
fun loadRulesets() {
for(ruleset in BaseRuleset.values()){
fun loadRulesets(consoleMode:Boolean=false) {
for (ruleset in BaseRuleset.values()) {
val fileName = "jsons/${ruleset.fullName}"
val fileHandle = if(UncivGame.Current.consoleMode) FileHandle(fileName)
else Gdx.files.internal(fileName)
val fileHandle = if (consoleMode) FileHandle(fileName)
else Gdx.files.internal(fileName)
this[ruleset.fullName] = Ruleset().apply { load(fileHandle) }
}

View file

@ -39,7 +39,7 @@ internal object ConsoleLauncher {
UncivGame.Current.simulateMaxTurns = 1000
UncivGame.Current.simulateUntilWin = true
RulesetCache.loadRulesets()
RulesetCache.loadRulesets(true)
val gameParameters = getGameParameters("China", "Greece")
val mapParameters = getMapParameters()