From 2890faee0af6dce3748ecd76aaa7d025769bbc00 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 24 Feb 2020 17:40:36 +0000 Subject: [PATCH] Change plugin type to just local and remote --- src/openrct2/network/Network.cpp | 2 +- src/openrct2/scripting/Plugin.cpp | 10 ++++------ src/openrct2/scripting/Plugin.h | 11 +++-------- src/openrct2/scripting/ScriptEngine.cpp | 9 ++------- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 8ced55ee05..e603eda448 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -1483,7 +1483,7 @@ void Network::Server_Send_SCRIPTS(NetworkConnection& connection) const for (const auto& plugin : plugins) { const auto& metadata = plugin->GetMetadata(); - if (metadata.Type == OpenRCT2::Scripting::PluginType::ServerClient) + if (metadata.Type == OpenRCT2::Scripting::PluginType::Remote) { pluginsToSend.push_back(plugin); } diff --git a/src/openrct2/scripting/Plugin.cpp b/src/openrct2/scripting/Plugin.cpp index cb3fecd37f..9d4fcb5133 100644 --- a/src/openrct2/scripting/Plugin.cpp +++ b/src/openrct2/scripting/Plugin.cpp @@ -158,12 +158,10 @@ PluginMetadata Plugin::GetMetadata(const DukValue& dukMetadata) PluginType Plugin::ParsePluginType(const std::string_view& type) { - if (type == "server") - return PluginType::Server; - if (type == "client") - return PluginType::Client; - if (type == "server_client") - return PluginType::ServerClient; + if (type == "local") + return PluginType::Local; + if (type == "remote") + return PluginType::Remote; throw std::invalid_argument("Unknown plugin type."); } diff --git a/src/openrct2/scripting/Plugin.h b/src/openrct2/scripting/Plugin.h index f584c26560..f7f409207e 100644 --- a/src/openrct2/scripting/Plugin.h +++ b/src/openrct2/scripting/Plugin.h @@ -23,21 +23,16 @@ namespace OpenRCT2::Scripting enum class PluginType { /** - * Scripts that can run on any client with no impact on the game state. - */ - Client, - - /** - * Scripts that can run on servers with no impact on the game state and will not + * Scripts that can run on servers or clients with no impact on the game state and will not * be uploaded to clients. */ - Server, + Local, /** * Scripts that can run on servers and will be uploaded to clients with ability to * modify game state in certain contexts. */ - ServerClient, + Remote, }; struct PluginMetadata diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 796cb96e02..e40ed99f93 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -271,14 +271,9 @@ bool ScriptEngine::ShouldStartPlugin(const std::shared_ptr& plugin) { // Only client plugins and plugins downloaded from server should be started const auto& metadata = plugin->GetMetadata(); - if (metadata.Type == PluginType::Server) + if (metadata.Type == PluginType::Remote && plugin->HasPath()) { - LogPluginInfo(plugin, "Server plugin not started"); - return false; - } - else if (metadata.Type == PluginType::ServerClient && plugin->HasPath()) - { - LogPluginInfo(plugin, "Server / client plugin not started"); + LogPluginInfo(plugin, "Remote plugin not started"); return false; } }