diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-31 19:53:51 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-03-31 19:53:51 +0200 |
commit | 1a658958d658a5e308b30c2e89aaa3aae223bbad (patch) | |
tree | 0f2d0870e80e8528caf57d859165b760e8464c4d /core | |
parent | 0d0eef8091803608cf6f9d12d194d5b1c7de334f (diff) | |
download | RustAndDust-1a658958d658a5e308b30c2e89aaa3aae223bbad.zip RustAndDust-1a658958d658a5e308b30c2e89aaa3aae223bbad.tar.gz |
Ctrl: add private Event getEvent()
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Ctrl.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index f7a3ae8..01a3748 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -164,14 +164,20 @@ public abstract class Ctrl implements Disposable // EVENTS + private Event getEvent() + { + Event evt = freeEvents.pop(); + if (evt == null) + evt = new Event(); + return evt; + } + public void postDone() { post(StateType.DONE); } public void postAbort() { post(StateType.ABORT); } public void post(StateType stateType) { - Event evt = freeEvents.pop(); - if (evt == null) - evt = new Event(); + Event evt = getEvent(); evt.type = Event.Type.STATE_CHANGE; evt.data = stateType; events.enqueue(evt); @@ -179,9 +185,7 @@ public abstract class Ctrl implements Disposable public void postAnswer(Hud.OkCancelAction what, boolean status) { - Event evt = freeEvents.pop(); - if (evt == null) - evt = new Event(); + Event evt = getEvent(); evt.type = Event.Type.HUD_ANSWER; evt.data = what; evt.status = status; |