From cd92f66c3a7d05ad0245bb69662d8c9586f5b0c1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 20 Feb 2022 19:53:19 +0200 Subject: [PATCH] Resolved ANR when copying game data to clipboard --- core/src/com/unciv/ui/saves/SaveGameScreen.kt | 14 ++++---- docs/uniques.md | 34 +++++++++---------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/core/src/com/unciv/ui/saves/SaveGameScreen.kt b/core/src/com/unciv/ui/saves/SaveGameScreen.kt index 64a6452521..0d8c34354d 100644 --- a/core/src/com/unciv/ui/saves/SaveGameScreen.kt +++ b/core/src/com/unciv/ui/saves/SaveGameScreen.kt @@ -39,12 +39,14 @@ class SaveGameScreen(val gameInfo: GameInfo) : PickerScreen(disableScroll = true val copyJsonButton = "Copy to clipboard".toTextButton() copyJsonButton.onClick { - try { - val json = Json().toJson(gameInfo) - val base64Gzip = Gzip.zip(json) - Gdx.app.clipboard.contents = base64Gzip - } catch (OOM: OutOfMemoryError) { - // you don't get a special toast, this isn't nearly common enough, this is a total edge-case + thread(name="Copy to clipboard") { // the Gzip rarely leads to ANRs + try { + val json = Json().toJson(gameInfo) + val base64Gzip = Gzip.zip(json) + Gdx.app.clipboard.contents = base64Gzip + } catch (OOM: OutOfMemoryError) { + // you don't get a special toast, this isn't nearly common enough, this is a total edge-case + } } } newSave.add(copyJsonButton).row() diff --git a/docs/uniques.md b/docs/uniques.md index a24c0bead1..113b4c8e29 100644 --- a/docs/uniques.md +++ b/docs/uniques.md @@ -1526,12 +1526,7 @@ Applicable to: Conditional ## Deprecated uniques - "[stats] from every Wonder" - Deprecated as of 3.19.1, replace with "[stats] from every [Wonder]" - "[stats] from every [buildingFilter] in cities where this religion has at least [amount] followers" - Deprecated as of 3.19.3, replace with "[stats] from every [buildingFilter] " - - "+[amount]% [stat] from every [tileFilter/specialist/buildingName]" - Deprecated as of 3.18.17, replace with "[+amount]% [stat] from every [tileFilter/specialist/buildingName]" - - "+[amount]% yield from every [tileFilter]" - Deprecated as of 3.18.17, replace with "[+amount]% Yield from every [tileFilter]" - "+25% Production towards any buildings that already exist in the Capital" - Deprecated as of 3.19.3, replace with "[+25]% Production towards any buildings that already exist in the Capital" - - "City-State Influence degrades [amount]% slower" - Deprecated as of 3.18.17, replace with "[-amount]% City-State Influence degradation" - - "Quantity of Resources gifted by City-States increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% resources gifted by City-States" - - "Happiness from Luxury Resources gifted by City-States increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% Happiness from luxury resources gifted by City-States" - "[amount]% of food is carried over after population increases" - Deprecated as of 3.19.2, replace with "[amount]% Food is carried over after population increases [in this city]" - "[amount]% of food is carried over [cityFilter] after population increases" - Deprecated as of 3.19.2, replace with "[amount]% Food is carried over after population increases [cityFilter]" - "[amount]% Culture cost of natural border growth [cityFilter]" - Deprecated as of 3.19.2, replace with "[amount]% Culture cost of natural border growth [cityFilter]" @@ -1539,18 +1534,6 @@ Applicable to: Conditional - "[amount]% cost of natural border growth" - Deprecated as of 3.19.1, replace with "[amount]% Culture cost of natural border growth [in all cities]" - "-[amount]% Gold cost of acquiring tiles [cityFilter]" - Deprecated as of 3.19.1, replace with "[-amount]% Gold cost of acquiring tiles [cityFilter]" - "[stat] cost of purchasing [baseUnitFilter] units in cities [amount]%" - Deprecated as of 3.19.3, replace with "[stat] cost of purchasing [baseUnitFilter] units [amount]%" - - "Maintenance on roads & railroads reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% maintenance on road & railroads" - - "-[amount]% maintenance cost for buildings [cityFilter]" - Deprecated as of 3.18.17, replace with "[-amount]% maintenance cost for buildings [cityFilter]" - - "+[amount] happiness from each type of luxury resource" - Deprecated as of 3.18.17, replace with "[+amount] Happiness from each type of luxury resource" - - "Culture cost of adopting new Policies reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% Culture cost of adopting new Policies" - - "[amount]% Culture cost of adopting new policies" - Deprecated as of 3.19.1, replace with "[amount]% Culture cost of adopting new Policies" - - "Defensive buildings in all cities are 25% more effective" - Deprecated as of 3.18.17, replace with "[+25]% City Strength from defensive buildings" - - "[amount]% Strength for [mapUnitFilter] units which have another [mapUnitFilter] unit in an adjacent tile" - Deprecated as of 3.18.17, replace with "[amount]% Strength " - - "Gold cost of upgrading [baseUnitFilter] units reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% Gold cost of upgrading " - - "Double gold from Great Merchant trade missions" - Deprecated as of 3.18.17, replace with "[+100]% Gold from Great Merchant trade missions" - - "Golden Age length increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% Golden Age length" - - "+[amount]% Defensive Strength for cities" - Deprecated as of 3.18.17, replace with "[+amount]% Strength for cities " - - "[amount]% Attacking Strength for cities" - Deprecated as of 3.18.17, replace with "[+amount]% Strength for cities " - "+[amount]% attacking strength for cities with garrisoned units" - Deprecated as of 3.19.1, replace with "[+amount]% Strength for cities " - "Can embark and move over Coasts and Oceans immediately" - Deprecated as of 3.19.9, replace with "Enables embarkation for land units ", "Enables embarked units to enter ocean tiles " - "Population loss from nuclear attacks -[amount]%" - Deprecated as of 3.19.2, replace with "Population loss from nuclear attacks [-amount]% [in this city]" @@ -1559,6 +1542,23 @@ Applicable to: Conditional - "Melee units pay no movement cost to pillage" - Deprecated as of 3.18.17, replace with "No movement cost to pillage " - "Heal adjacent units for an additional 15 HP per turn" - Deprecated as of 3.19.3, replace with "All adjacent units heal [+15] HP when healing" - "+[amount]% attack strength to all [mapUnitFilter] units for [amount2] turns" - Deprecated as of 3.19.8, replace with "[+amount]% Strength " + - "Golden Age length increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% Golden Age length" + - "+[amount]% Defensive Strength for cities" - Deprecated as of 3.18.17, replace with "[+amount]% Strength for cities " + - "[amount]% Attacking Strength for cities" - Deprecated as of 3.18.17, replace with "[+amount]% Strength for cities " + - "[amount]% Strength for [mapUnitFilter] units which have another [mapUnitFilter] unit in an adjacent tile" - Deprecated as of 3.18.17, replace with "[amount]% Strength " + - "Gold cost of upgrading [baseUnitFilter] units reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% Gold cost of upgrading " + - "Double gold from Great Merchant trade missions" - Deprecated as of 3.18.17, replace with "[+100]% Gold from Great Merchant trade missions" + - "Defensive buildings in all cities are 25% more effective" - Deprecated as of 3.18.17, replace with "[+25]% City Strength from defensive buildings" + - "Maintenance on roads & railroads reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% maintenance on road & railroads" + - "-[amount]% maintenance cost for buildings [cityFilter]" - Deprecated as of 3.18.17, replace with "[-amount]% maintenance cost for buildings [cityFilter]" + - "+[amount] happiness from each type of luxury resource" - Deprecated as of 3.18.17, replace with "[+amount] Happiness from each type of luxury resource" + - "Culture cost of adopting new Policies reduced by [amount]%" - Deprecated as of 3.18.17, replace with "[-amount]% Culture cost of adopting new Policies" + - "[amount]% Culture cost of adopting new policies" - Deprecated as of 3.19.1, replace with "[amount]% Culture cost of adopting new Policies" + - "Quantity of Resources gifted by City-States increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% resources gifted by City-States" + - "City-State Influence degrades [amount]% slower" - Deprecated as of 3.18.17, replace with "[-amount]% City-State Influence degradation" + - "Happiness from Luxury Resources gifted by City-States increased by [amount]%" - Deprecated as of 3.18.17, replace with "[+amount]% Happiness from luxury resources gifted by City-States" + - "+[amount]% [stat] from every [tileFilter/specialist/buildingName]" - Deprecated as of 3.18.17, replace with "[+amount]% [stat] from every [tileFilter/specialist/buildingName]" + - "+[amount]% yield from every [tileFilter]" - Deprecated as of 3.18.17, replace with "[+amount]% Yield from every [tileFilter]" - "[stats] per turn from cities before [tech/policy]" - Deprecated as of 3.18.14, replace with "[stats] [in all cities] " OR "[stats] [in all cities] " - "[mapUnitFilter] units gain [amount]% more Experience from combat" - Deprecated as of 3.18.12, replace with "[amount]% XP gained from combat " - "[amount]% maintenance costs for [mapUnitFilter] units" - Deprecated as of 3.18.14, replace with "[amount]% maintenance costs "