From f957dee357b31c5195e2d74c633d3abf6f828996 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 2 Nov 2020 23:00:45 +0200 Subject: [PATCH] Can no longer see other players' IDs in a multiplayer game through the new game screen Moved the building mod check to all mods, not only ruleset mods --- changelog.md | 4 +++- core/src/com/unciv/models/ruleset/Ruleset.kt | 7 +++++-- core/src/com/unciv/models/simulation/Utils.kt | 20 +++++++++---------- .../translations/TranslationFileWriter.kt | 4 ---- .../cityscreen/SpecialistAllocationTable.kt | 2 +- .../ui/newgamescreen/PlayerPickerTable.kt | 3 +++ 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/changelog.md b/changelog.md index 2211957998..b59def9069 100644 --- a/changelog.md +++ b/changelog.md @@ -6,10 +6,12 @@ AI can no longer raze capital cities Stats unique can no longer crash badly defined mods -Added mod check for unit promotions and upgrades +Added mod check for unit promotions and upgrades, and building costs "Unable to capture cities" unique prevents the unit from conquering/capturing a city - By givehub99 +Translation updates + ## 3.11.8 Improved performance, especially in the City screen diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 6b73fa778c..c1f485c93e 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -228,6 +228,11 @@ class Ruleset { } } + for(building in buildings.values){ + if (building.requiredTech == null && building.cost == 0) + lines += "${building.name} must either have an explicit cost or reference an existing tech!" + } + if (!modOptions.isBaseRuleset) return lines.joinToString("\n") @@ -256,8 +261,6 @@ class Ruleset { lines += "${building.name} requires resource ${building.requiredResource} which does not exist!" if (building.replaces != null && !buildings.containsKey(building.replaces!!)) lines += "${building.name} replaces ${building.replaces} which does not exist!" - if (building.requiredTech == null && building.cost == 0) - lines += "${building.name} must either have an explicit cost or reference an existing tech!" } for (resource in tileResources.values) { diff --git a/core/src/com/unciv/models/simulation/Utils.kt b/core/src/com/unciv/models/simulation/Utils.kt index 589ded251e..82f7174323 100644 --- a/core/src/com/unciv/models/simulation/Utils.kt +++ b/core/src/com/unciv/models/simulation/Utils.kt @@ -13,16 +13,16 @@ class MutableInt(var value: Int = 0) { } fun formatDuration(d: Duration): String { - var d = d - val days = d.toDays() - d = d.minusDays(days) - val hours = d.toHours() - d = d.minusHours(hours) - val minutes = d.toMinutes() - d = d.minusMinutes(minutes) - val seconds = d.seconds - d = d.minusSeconds(seconds) - val millis = d.toMillis() + var newDuration = d + val days = newDuration.toDays() + newDuration = newDuration.minusDays(days) + val hours = newDuration.toHours() + newDuration = newDuration.minusHours(hours) + val minutes = newDuration.toMinutes() + newDuration = newDuration.minusMinutes(minutes) + val seconds = newDuration.seconds + newDuration = newDuration.minusSeconds(seconds) + val millis = newDuration.toMillis() return (if (days == 0L) "" else "$days"+"d ") + (if (hours == 0L) "" else "$hours"+"h ") + (if (minutes == 0L) "" else "$minutes"+"m ") + diff --git a/core/src/com/unciv/models/translations/TranslationFileWriter.kt b/core/src/com/unciv/models/translations/TranslationFileWriter.kt index 3596ac31ea..cc2bd933a1 100644 --- a/core/src/com/unciv/models/translations/TranslationFileWriter.kt +++ b/core/src/com/unciv/models/translations/TranslationFileWriter.kt @@ -83,10 +83,6 @@ object TranslationFileWriter { val existingTranslationKeys = HashSet() for (line in linesFromTemplates) { - if(line.contains("G&K")) { - val x = line.length - } - if (!line.contains(" = ")) { // small hack to insert empty lines if (line.startsWith(specialNewLineCode)) { diff --git a/core/src/com/unciv/ui/cityscreen/SpecialistAllocationTable.kt b/core/src/com/unciv/ui/cityscreen/SpecialistAllocationTable.kt index 15f9d2e2c5..9a1ff2cb64 100644 --- a/core/src/com/unciv/ui/cityscreen/SpecialistAllocationTable.kt +++ b/core/src/com/unciv/ui/cityscreen/SpecialistAllocationTable.kt @@ -18,7 +18,7 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa continue val newSpecialists = cityInfo.population.getNewSpecialists() val assignedSpecialists = newSpecialists[specialistName]!! - val maxSpecialists = cityInfo.population.getMaxSpecialists()[specialistName]!! + val maxSpecialists = amount if (cityScreen.canChangeState) add(getUnassignButton(assignedSpecialists, specialistName)) add(getAllocationTable(assignedSpecialists, maxSpecialists, specialistName)).pad(10f) diff --git a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt index e76a3e829e..8bcc2daeae 100644 --- a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt @@ -44,6 +44,9 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters: var noRandom = false init { + for (player in gameParameters.players) + player.playerId = "" // This is to stop people from getting other users' IDs and cheating with them in multiplayer games + top() add("Civilizations".toLabel(fontSize = 24)).padBottom(20f).row() add(ScrollPane(playerListTable).apply { setOverscroll(false, false) }).width(civBlocksWidth)