From ea362a448b4281748870f7b0244780b9531f8813 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 17 Mar 2022 23:12:45 +0200 Subject: [PATCH] Fixed rejection reason texts not showing the instance's text - see #6131 --- core/src/com/unciv/logic/city/IConstruction.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/city/IConstruction.kt b/core/src/com/unciv/logic/city/IConstruction.kt index fc6bc7695c..739edc2ec9 100644 --- a/core/src/com/unciv/logic/city/IConstruction.kt +++ b/core/src/com/unciv/logic/city/IConstruction.kt @@ -97,7 +97,11 @@ class RejectionReasons: HashSet() { } fun getMostImportantRejectionReason(): String? { - return orderOfErrorMessages.firstOrNull { contains(it) }?.errorMessage + for (rejectionReason in orderOfErrorMessages) { + val rejectionReasonInstance = firstOrNull { it.rejectionReason == rejectionReason } + if (rejectionReasonInstance != null) return rejectionReasonInstance.errorMessage + } + return null } // Used for constant variables in the functions above