diff --git a/src/ScreenNetEvaluation.cpp b/src/ScreenNetEvaluation.cpp index 30e04ab9c6..5ec9a66581 100644 --- a/src/ScreenNetEvaluation.cpp +++ b/src/ScreenNetEvaluation.cpp @@ -8,6 +8,7 @@ #include "Style.h" #include "ThemeManager.h" #include "NetworkSyncManager.h" +#include "InputEventPlus.h" static const int NUM_SCORE_DIGITS = 9; @@ -132,6 +133,17 @@ ScreenNetEvaluation::MenuDown(const InputEventPlus& input) return true; } +bool +ScreenNetEvaluation::Input(const InputEventPlus& input) +{ + // throw out "enter" inputs so players don't accidentally close the screen + // while talking about scores, force them to esc to the next screen -mina + if (input.DeviceI.button == KEY_ENTER) + return false; + + return Screen::Input(input); +} + void ScreenNetEvaluation::HandleScreenMessage(const ScreenMessage SM) { @@ -282,11 +294,24 @@ class LunaScreenNetEvaluation : public Luna lua_pushnil(L); return 1; } + static int GetCurrentPlayer(T* p, lua_State* L) + { + lua_pushnumber(L, p->m_iCurrentPlayer + 1); + return 1; + } + static int SelectPlayer(T* p, lua_State* L) + { + p->m_iCurrentPlayer = IArg(1) - 1; + p->UpdateStats(); + return 0; + } LunaScreenNetEvaluation() { ADD_METHOD(GetNumActivePlayers); ADD_METHOD(GetHighScore); ADD_METHOD(GetOptions); + ADD_METHOD(GetCurrentPlayer); + ADD_METHOD(SelectPlayer); } }; diff --git a/src/ScreenNetEvaluation.h b/src/ScreenNetEvaluation.h index 37e1b9903c..bf83d8a1ac 100644 --- a/src/ScreenNetEvaluation.h +++ b/src/ScreenNetEvaluation.h @@ -12,12 +12,12 @@ class ScreenNetEvaluation : public ScreenEvaluation // sm-ssc: int GetNumActivePlayers() { return m_iActivePlayers; } - + bool Input(const InputEventPlus& input) override; // Lua void PushSelf(lua_State* L) override; int m_iCurrentPlayer; - + void UpdateStats(); protected: bool MenuLeft(const InputEventPlus& input) override; bool MenuUp(const InputEventPlus& input) override; @@ -25,9 +25,6 @@ class ScreenNetEvaluation : public ScreenEvaluation bool MenuDown(const InputEventPlus& input) override; void HandleScreenMessage(ScreenMessage SM) override; void TweenOffScreen() override; - - void UpdateStats(); - private: // todo: Make this an AutoActor -aj Quad m_rectUsersBG;