From 823f75e59239093a0947667ead7fbefa484cb851 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 12 Sep 2016 21:32:17 +0200 Subject: [PATCH] - fixed: UDMF user value lists need to be sorted for binary search to work but weren't. --- src/p_udmf.cpp | 5 +++++ src/r_defs.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0b054247e..c09debc51 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -309,6 +309,11 @@ void FUDMFKeys::Sort() FUDMFKey *FUDMFKeys::Find(FName key) { + if (!mSorted) + { + mSorted = true; + Sort(); + } int min = 0, max = Size()-1; while (min <= max) diff --git a/src/r_defs.h b/src/r_defs.h index f27ac2716..59b1fe0d3 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -220,6 +220,7 @@ struct FUDMFKey class FUDMFKeys : public TArray { + bool mSorted = false; public: void Sort(); FUDMFKey *Find(FName key);