1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Get custom drop downs working

Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
This commit is contained in:
Ted John
2018-03-25 23:27:19 +01:00
parent 918022da3e
commit 7047dec1d9
9 changed files with 221 additions and 50 deletions

View File

@@ -21,10 +21,14 @@
#include <fstream>
#include <memory>
#include <fcntl.h>
#include <sys/inotify.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef _WIN32
#else
#include <fcntl.h>
#include <sys/inotify.h>
#include <sys/types.h>
#include <unistd.h>
#endif
using namespace OpenRCT2::Scripting;
@@ -95,6 +99,8 @@ void Plugin::Update()
void Plugin::EnableHotReload()
{
#ifdef _WIN32
#else
auto fd = inotify_init();
if (fd >= 0)
{
@@ -114,12 +120,15 @@ void Plugin::EnableHotReload()
close(fd);
}
}
#endif
}
bool Plugin::ShouldHotReload()
{
if (_hotReloadEnabled)
{
#ifdef _WIN32
#else
std::vector<char> eventData;
eventData.resize(1024);
@@ -134,6 +143,7 @@ bool Plugin::ShouldHotReload()
}
offset += sizeof(inotify_event) + e->len;
}
#endif
}
return false;
}
@@ -142,8 +152,11 @@ void Plugin::DisableHotReload()
{
if (_hotReloadEnabled)
{
#ifdef _WIN32
#else
inotify_rm_watch(_hotReloadData.FileDesc, _hotReloadData.WatchDesc);
close(_hotReloadData.FileDesc);
#endif
_hotReloadData = HotReloadData();
_hotReloadEnabled = false;
}