From f816537992058e11879c5dbad6c6252d3bd03a80 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Fri, 3 Feb 2017 20:44:27 +0200 Subject: [PATCH] Setting Order directly (while the event handler is registered) will result in all sorts of broken behavior. Made readonly. --- src/events.cpp | 12 ++++++++++++ wadsrc/static/zscript/events.txt | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/events.cpp b/src/events.cpp index fe081f6c22..7102ef3b8d 100755 --- a/src/events.cpp +++ b/src/events.cpp @@ -468,6 +468,18 @@ DEFINE_FIELD_X(InputEvent, DInputEvent, KeyChar); DEFINE_FIELD_X(InputEvent, DInputEvent, MouseX); DEFINE_FIELD_X(InputEvent, DInputEvent, MouseY); +DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder) +{ + PARAM_SELF_PROLOGUE(DStaticEventHandler); + PARAM_INT(order); + + if (E_CheckHandler(self)) + return 0; + + self->Order = order; + return 0; +} + DEFINE_ACTION_FUNCTION(DEventHandler, Create) { PARAM_PROLOGUE; diff --git a/wadsrc/static/zscript/events.txt b/wadsrc/static/zscript/events.txt index 690b1a6daa..fe0d45e7de 100755 --- a/wadsrc/static/zscript/events.txt +++ b/wadsrc/static/zscript/events.txt @@ -314,7 +314,8 @@ class StaticEventHandler : Object native // this value will be queried on Register() to decide the relative order of this handler to every other. // this is most useful in UI systems. // default is 0. - native int Order; + native readonly int Order; + native void SetOrder(int order); // this value will be queried on user input to decide whether to send UiProcess to this handler. native bool IsUiProcessor; // this value determines whether mouse input is required.