mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 14:54:30 +01:00
Get custom drop downs working
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <dukglue/dukglue.h>
|
||||
#include "../interface/Console.h"
|
||||
#include "../interface/InteractiveConsole.h"
|
||||
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRCT2::Scripting
|
||||
type = GetParkMessageType(message["type"].as_string());
|
||||
text = message["text"].as_string();
|
||||
}
|
||||
news_item_add_to_queue_raw(type, text.c_str(), -1);
|
||||
news_item_add_to_queue_raw(type, text.c_str(), static_cast<uint32>(-1));
|
||||
}
|
||||
catch (const std::exception&)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ namespace OpenRCT2::Scripting
|
||||
private:
|
||||
uint8 GetParkMessageType(const std::string& key)
|
||||
{
|
||||
static constexpr auto keys = {
|
||||
static auto keys = {
|
||||
"attraction",
|
||||
"peep_on_attraction",
|
||||
"peep",
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
std::string type_get()
|
||||
{
|
||||
if (tile_element_get_type(_element) == TILE_ELEMENT_TYPE_PATH)
|
||||
if (_element->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||
{
|
||||
return "footpath";
|
||||
}
|
||||
@@ -65,7 +65,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
_count++;
|
||||
}
|
||||
while (!tile_element_is_last_for_tile(element++));
|
||||
while (!(element++)->IsLastForTile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user