Add isNetworking scripting function to disable some track object

This commit is contained in:
Benau 2018-07-08 11:57:37 +08:00
parent f0c376a41d
commit 0fa444fbbf

View File

@ -22,6 +22,7 @@
#include "input/device_manager.hpp" #include "input/device_manager.hpp"
#include "input/input_device.hpp" #include "input/input_device.hpp"
#include "input/input_manager.hpp" #include "input/input_manager.hpp"
#include "network/network_config.hpp"
#include "scriptengine/aswrappedcall.hpp" #include "scriptengine/aswrappedcall.hpp"
#include "scriptengine/script_engine.hpp" #include "scriptengine/script_engine.hpp"
#include "states_screens/dialogs/tutorial_message_dialog.hpp" #include "states_screens/dialogs/tutorial_message_dialog.hpp"
@ -154,6 +155,12 @@ namespace Scripting
{ {
Log::error("Script", "%s", log->c_str()); Log::error("Script", "%s", log->c_str());
} }
bool isNetworking()
{
return NetworkConfig::get()->isNetworking();
}
/** @}*/ /** @}*/
/** @}*/ /** @}*/
@ -239,6 +246,11 @@ namespace Scripting
mp ? WRAP_FN(logError) : asFUNCTION(logError), mp ? WRAP_FN(logError) : asFUNCTION(logError),
call_conv); assert(r >= 0); call_conv); assert(r >= 0);
r = engine->RegisterGlobalFunction("bool isNetworking()",
mp ? WRAP_FN(isNetworking) : asFUNCTION(isNetworking),
call_conv); assert(r >= 0);
} }
} }