Skip to content

Commit

Permalink
xrEngine: fix dirty hack for processing of priority
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Nov 6, 2018
1 parent 425a91c commit 55d6591
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/xrEngine/pure.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -35,7 +35,7 @@ DECLARE_MESSAGE(ScreenResolutionChanged);
struct MessageObject
{
IPure* Object;
unsigned long Prio;
int Prio;
};

template<class T>
Expand All @@ -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 });
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 55d6591

Please sign in to comment.