From 4be14d77f4fa1aa761bafe927428b288f6503fef Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Thu, 30 Nov 2023 18:13:11 +0100 Subject: [PATCH] Fix Unit rename popup offering up the icon's virtual codepoint (#10620) * Fix Unit rename popup offering up the icon's virtual codepoint * Fix City rename popup offering up the icon's virtual codepoint --- .../src/com/unciv/ui/screens/pickerscreens/CityRenamePopup.kt | 3 +-- .../src/com/unciv/ui/screens/pickerscreens/UnitRenamePopup.kt | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/ui/screens/pickerscreens/CityRenamePopup.kt b/core/src/com/unciv/ui/screens/pickerscreens/CityRenamePopup.kt index 2852a20105..6eea41c74a 100644 --- a/core/src/com/unciv/ui/screens/pickerscreens/CityRenamePopup.kt +++ b/core/src/com/unciv/ui/screens/pickerscreens/CityRenamePopup.kt @@ -10,7 +10,7 @@ class CityRenamePopup(val screen: BaseScreen, val city: City, val actionOnClose: AskTextPopup( screen, label = "Please enter a new name for your city", - defaultText = city.name.tr(), + defaultText = city.name.tr(hideIcons = true), validate = { it != "" }, actionOnOk = { text -> city.name = text @@ -20,4 +20,3 @@ class CityRenamePopup(val screen: BaseScreen, val city: City, val actionOnClose: } } - diff --git a/core/src/com/unciv/ui/screens/pickerscreens/UnitRenamePopup.kt b/core/src/com/unciv/ui/screens/pickerscreens/UnitRenamePopup.kt index 0b243e8420..20a25c46f6 100644 --- a/core/src/com/unciv/ui/screens/pickerscreens/UnitRenamePopup.kt +++ b/core/src/com/unciv/ui/screens/pickerscreens/UnitRenamePopup.kt @@ -2,10 +2,10 @@ package com.unciv.ui.screens.pickerscreens import com.unciv.logic.map.mapunit.MapUnit import com.unciv.models.translations.tr +import com.unciv.ui.components.extensions.surroundWithCircle import com.unciv.ui.images.ImageGetter import com.unciv.ui.popups.AskTextPopup import com.unciv.ui.screens.basescreen.BaseScreen -import com.unciv.ui.components.extensions.surroundWithCircle class UnitRenamePopup(val screen: BaseScreen, val unit: MapUnit, val actionOnClose: ()->Unit) { init { @@ -13,7 +13,7 @@ class UnitRenamePopup(val screen: BaseScreen, val unit: MapUnit, val actionOnClo screen, label = "Choose name for [${unit.baseUnit.name}]", icon = ImageGetter.getUnitIcon(unit.name).surroundWithCircle(80f), - defaultText = unit.instanceName ?: unit.baseUnit.name.tr(), + defaultText = unit.instanceName ?: unit.baseUnit.name.tr(hideIcons = true), validate = { it != unit.name }, actionOnOk = { userInput -> //If the user inputs an empty string, clear the unit instanceName so the base name is used