Files
OpenRCT2-Web/src/openrct2-ui/scripting/CustomMenu.cpp
T

40 lines
1.2 KiB
C++
Raw Normal View History

2020-02-11 21:26:05 +00:00
/*****************************************************************************
2020-04-22 16:06:29 +01:00
* Copyright (c) 2014-2020 OpenRCT2 developers
2020-02-11 21:26:05 +00:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
2020-02-23 12:55:48 +00:00
#ifdef __ENABLE_SCRIPTING__
# include "CustomMenu.h"
2020-02-11 21:26:05 +00:00
namespace OpenRCT2::Scripting
{
std::vector<CustomToolbarMenuItem> CustomMenuItems;
static void RemoveMenuItems(std::shared_ptr<Plugin> owner)
{
auto& menuItems = CustomMenuItems;
for (auto it = menuItems.begin(); it != menuItems.end();)
{
if (it->Owner == owner)
{
it = menuItems.erase(it);
}
else
{
it++;
}
}
}
void InitialiseCustomMenuItems(ScriptEngine& scriptEngine)
{
scriptEngine.SubscribeToPluginStoppedEvent([](std::shared_ptr<Plugin> plugin) -> void { RemoveMenuItems(plugin); });
}
} // namespace OpenRCT2::Scripting
2020-02-23 12:55:48 +00:00
#endif