From 55d6591cfa5ecef6dadcb75ef4924d32e510f32f Mon Sep 17 00:00:00 2001 From: Ilya Orlov Date: Thu, 18 Oct 2018 01:36:37 +0300 Subject: [PATCH] xrEngine: fix dirty hack for processing of priority --- src/xrEngine/pure.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xrEngine/pure.h b/src/xrEngine/pure.h index 72794e30df0..9530338db36 100644 --- a/src/xrEngine/pure.h +++ b/src/xrEngine/pure.h @@ -2,11 +2,11 @@ #include "xrCommon/xr_vector.h" // messages -#define REG_PRIORITY_LOW 0x11111111ul -#define REG_PRIORITY_NORMAL 0x22222222ul -#define REG_PRIORITY_HIGH 0x33333333ul -#define REG_PRIORITY_CAPTURE 0x7ffffffful -#define REG_PRIORITY_INVALID 0xfffffffful +#define REG_PRIORITY_LOW 0x11111111 +#define REG_PRIORITY_NORMAL 0x22222222 +#define REG_PRIORITY_HIGH 0x33333333 +#define REG_PRIORITY_CAPTURE 0x7fffffff +#define REG_PRIORITY_INVALID 0x80000000 // -2147483648, lowest for int struct IPure { @@ -35,7 +35,7 @@ DECLARE_MESSAGE(ScreenResolutionChanged); struct MessageObject { IPure* Object; - unsigned long Prio; + int Prio; }; template @@ -49,7 +49,7 @@ class MessageRegistry void Clear() { messages.clear(); } - constexpr void Add(T* object, unsigned long priority = REG_PRIORITY_NORMAL) + constexpr void Add(T* object, const int priority = REG_PRIORITY_NORMAL) { Add({ object, priority }); } @@ -112,7 +112,7 @@ class MessageRegistry { if (!messages.empty()) { std::sort(std::begin(messages), std::end(messages), - [](const auto& a, const auto& b) { return a.Prio < b.Prio; }); + [](const auto& a, const auto& b) { return a.Prio > b.Prio; }); } while (!messages.empty() && messages.back().Prio == REG_PRIORITY_INVALID)