mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 10:15:36 +01:00
Get custom drop downs working
Co-authored-by: Hielke Morsink <hielke.morsink@gmail.com>
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linenoise.hpp>
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../platform/Platform2.h"
|
||||
#include "../scripting/ScriptEngine.h"
|
||||
#include "../thirdparty/linenoise.hpp"
|
||||
#include "InteractiveConsole.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
@@ -67,7 +67,8 @@ extern widget_identifier gCurrentTextBox;
|
||||
using WidgetFlags = uint32;
|
||||
namespace WIDGET_FLAGS
|
||||
{
|
||||
const uint32 TEXT_IS_STRING = 1 << 0;
|
||||
const WidgetFlags TEXT_IS_STRING = 1 << 0;
|
||||
const WidgetFlags IS_ENABLED = 1 << 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
src/openrct2/thirdparty/dukglue/dukglue.h
vendored
9
src/openrct2/thirdparty/dukglue/dukglue.h
vendored
@@ -1,7 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4267) // conversion from a to b, possible loss of data
|
||||
#pragma warning(disable : 4505) // unreferenced local function has been removed
|
||||
#pragma warning(disable : 4702) // unreachable code
|
||||
|
||||
#include "register_function.h"
|
||||
#include "register_class.h"
|
||||
#include "register_property.h"
|
||||
#include "public_util.h"
|
||||
#include "dukvalue.h"
|
||||
#include "dukvalue.h"
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
Reference in New Issue
Block a user