diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index c3ede8522..f6a94e9a1 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -96,7 +96,7 @@ add_openmw_dir (mwbase ) add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer PlayerList LocalActor DedicatedActor ActorList ObjectList - Worldstate Cell CellController MechanicsHelper RecordHelper GUIController + Worldstate Cell CellController GUIController MechanicsHelper RecordHelper ScriptController ) add_openmw_dir (mwmp/GUI GUIChat GUILogin PlayerMarkerCollection GUIDialogList TextInputDialog diff --git a/apps/openmw/mwmp/ScriptController.cpp b/apps/openmw/mwmp/ScriptController.cpp new file mode 100644 index 000000000..3dd839f17 --- /dev/null +++ b/apps/openmw/mwmp/ScriptController.cpp @@ -0,0 +1,19 @@ +#include + +#include "../mwscript/interpretercontext.hpp" + +#include "ScriptController.hpp" + +unsigned short ScriptController::getPacketOriginFromContextType(unsigned short contextType) +{ + if (contextType == Interpreter::Context::CONSOLE) + return mwmp::CLIENT_CONSOLE; + else if (contextType == Interpreter::Context::DIALOGUE) + return mwmp::CLIENT_DIALOGUE; + else if (contextType == Interpreter::Context::SCRIPT_LOCAL) + return mwmp::CLIENT_SCRIPT_LOCAL; + else if (contextType == Interpreter::Context::SCRIPT_GLOBAL) + return mwmp::CLIENT_SCRIPT_GLOBAL; + + return mwmp::CLIENT_GAMEPLAY; +} diff --git a/apps/openmw/mwmp/ScriptController.hpp b/apps/openmw/mwmp/ScriptController.hpp new file mode 100644 index 000000000..4756e700c --- /dev/null +++ b/apps/openmw/mwmp/ScriptController.hpp @@ -0,0 +1,10 @@ +#ifndef OPENMW_SCRIPTCONTROLLER_HPP +#define OPENMW_SCRIPTCONTROLLER_HPP + +namespace ScriptController +{ + unsigned short getPacketOriginFromContextType(unsigned short contextType); +} + + +#endif //OPENMW_SCRIPTCONTROLLER_HPP