[Events]: User modern concurrency container (#1042)
This commit is contained in:
parent
d0bb7840cb
commit
57d04e5a59
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -17,7 +17,7 @@
|
|||||||
[submodule "deps/mongoose"]
|
[submodule "deps/mongoose"]
|
||||||
path = deps/mongoose
|
path = deps/mongoose
|
||||||
url = https://github.com/cesanta/mongoose.git
|
url = https://github.com/cesanta/mongoose.git
|
||||||
branch = 7.8
|
branch = 7.9
|
||||||
[submodule "deps/protobuf"]
|
[submodule "deps/protobuf"]
|
||||||
path = deps/protobuf
|
path = deps/protobuf
|
||||||
url = https://github.com/google/protobuf.git
|
url = https://github.com/google/protobuf.git
|
||||||
|
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 0a265e79a67d7bfcdca27f2ccb98ccb474677ec6
|
Subproject commit 4236405b90e051310aadda818e21c811e404b4d8
|
@ -21,6 +21,7 @@
|
|||||||
#include "Modules/Discovery.hpp"
|
#include "Modules/Discovery.hpp"
|
||||||
#include "Modules/Download.hpp"
|
#include "Modules/Download.hpp"
|
||||||
#include "Modules/Elevators.hpp"
|
#include "Modules/Elevators.hpp"
|
||||||
|
#include "Modules/Events.hpp"
|
||||||
#include "Modules/Exception.hpp"
|
#include "Modules/Exception.hpp"
|
||||||
#include "Modules/FastFiles.hpp"
|
#include "Modules/FastFiles.hpp"
|
||||||
#include "Modules/Friends.hpp"
|
#include "Modules/Friends.hpp"
|
||||||
|
@ -73,7 +73,6 @@ namespace Components
|
|||||||
|
|
||||||
#include "Modules/AssetHandler.hpp"
|
#include "Modules/AssetHandler.hpp"
|
||||||
#include "Modules/Dedicated.hpp"
|
#include "Modules/Dedicated.hpp"
|
||||||
#include "Modules/Events.hpp"
|
|
||||||
#include "Modules/FileSystem.hpp"
|
#include "Modules/FileSystem.hpp"
|
||||||
#include "Modules/Localization.hpp"
|
#include "Modules/Localization.hpp"
|
||||||
#include "Modules/Maps.hpp"
|
#include "Modules/Maps.hpp"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include "Bans.hpp"
|
#include "Bans.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Bots.hpp"
|
#include "Bots.hpp"
|
||||||
#include "ClanTags.hpp"
|
#include "ClanTags.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
#include "GSC/Script.hpp"
|
#include "GSC/Script.hpp"
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include "CardTitles.hpp"
|
#include "CardTitles.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "ServerCommands.hpp"
|
#include "ServerCommands.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include "Chat.hpp"
|
#include "Chat.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "PlayerName.hpp"
|
#include "PlayerName.hpp"
|
||||||
#include "TextRenderer.hpp"
|
#include "TextRenderer.hpp"
|
||||||
#include "Voice.hpp"
|
#include "Voice.hpp"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
#include "ClanTags.hpp"
|
#include "ClanTags.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "PlayerName.hpp"
|
#include "PlayerName.hpp"
|
||||||
#include "ServerCommands.hpp"
|
#include "ServerCommands.hpp"
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include "Debug.hpp"
|
#include "Debug.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "TextRenderer.hpp"
|
#include "TextRenderer.hpp"
|
||||||
|
|
||||||
#include "Game/Engine/ScopedCriticalSection.hpp"
|
#include "Game/Engine/ScopedCriticalSection.hpp"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "CardTitles.hpp"
|
#include "CardTitles.hpp"
|
||||||
#include "ClanTags.hpp"
|
#include "ClanTags.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "Party.hpp"
|
#include "Party.hpp"
|
||||||
#include "ServerCommands.hpp"
|
#include "ServerCommands.hpp"
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <Utils/WebIO.hpp>
|
#include <Utils/WebIO.hpp>
|
||||||
|
|
||||||
#include "Download.hpp"
|
#include "Download.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "MapRotation.hpp"
|
#include "MapRotation.hpp"
|
||||||
#include "Party.hpp"
|
#include "Party.hpp"
|
||||||
#include "ServerInfo.hpp"
|
#include "ServerInfo.hpp"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
#include "Elevators.hpp"
|
#include "Elevators.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
@ -1,54 +1,79 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
Utils::Signal<Events::ClientCallback> Events::ClientDisconnectSignal;
|
Utils::Concurrency::Container<Events::ClientCallback> Events::ClientDisconnectTasks_;
|
||||||
Utils::Signal<Events::ClientConnectCallback> Events::ClientConnectSignal;
|
Utils::Concurrency::Container<Events::ClientConnectCallback> Events::ClientConnectTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::SteamDisconnectSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::SteamDisconnectTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::ShutdownSystemSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::ShutdownSystemTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::ClientInitSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::ClientInitTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::ServerInitSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::ServerInitTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::DvarInitSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::DvarInitTasks_;
|
||||||
Utils::Signal<Events::Callback> Events::NetworkInitSignal;
|
Utils::Concurrency::Container<Events::Callback> Events::NetworkInitTasks_;
|
||||||
|
|
||||||
void Events::OnClientDisconnect(const Utils::Slot<ClientCallback>& callback)
|
void Events::OnClientDisconnect(const std::function<void(int clientNum)>& callback)
|
||||||
{
|
{
|
||||||
ClientDisconnectSignal.connect(callback);
|
ClientDisconnectTasks_.access([&callback](ClientCallback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnClientConnect(const Utils::Slot<ClientConnectCallback>& callback)
|
void Events::OnClientConnect(const std::function<void(Game::client_s* cl)>& callback)
|
||||||
{
|
{
|
||||||
ClientConnectSignal.connect(callback);
|
ClientConnectTasks_.access([&callback](ClientConnectCallback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnSteamDisconnect(const Utils::Slot<Callback>& callback)
|
void Events::OnSteamDisconnect(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
SteamDisconnectSignal.connect(callback);
|
SteamDisconnectTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnVMShutdown(const Utils::Slot<Callback>& callback)
|
void Events::OnVMShutdown(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
ShutdownSystemSignal.connect(callback);
|
ShutdownSystemTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnClientInit(const Utils::Slot<Callback>& callback)
|
void Events::OnClientInit(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
ClientInitSignal.connect(callback);
|
ClientInitTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnSVInit(const Utils::Slot<Callback>& callback)
|
void Events::OnSVInit(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
ServerInitSignal.connect(callback);
|
ServerInitTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnDvarInit(const Utils::Slot<Callback>& callback)
|
void Events::OnDvarInit(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
DvarInitSignal.connect(callback);
|
DvarInitTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::OnNetworkInit(const Utils::Slot<Callback>& callback)
|
void Events::OnNetworkInit(const std::function<void()>& callback)
|
||||||
{
|
{
|
||||||
NetworkInitSignal.connect(callback);
|
NetworkInitTasks_.access([&callback](Callback& tasks)
|
||||||
|
{
|
||||||
|
tasks.emplace_back(callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -57,60 +82,112 @@ namespace Components
|
|||||||
*/
|
*/
|
||||||
void Events::ClientDisconnect_Hk(const int clientNum)
|
void Events::ClientDisconnect_Hk(const int clientNum)
|
||||||
{
|
{
|
||||||
ClientDisconnectSignal(clientNum);
|
ClientDisconnectTasks_.access([&clientNum](ClientCallback& tasks)
|
||||||
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func(clientNum);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void(int)>(0x4AA430)(clientNum); // ClientDisconnect
|
Utils::Hook::Call<void(int)>(0x4AA430)(clientNum); // ClientDisconnect
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::SV_UserinfoChanged_Hk(Game::client_s* cl)
|
void Events::SV_UserinfoChanged_Hk(Game::client_s* cl)
|
||||||
{
|
{
|
||||||
ClientConnectSignal(cl);
|
ClientConnectTasks_.access([&cl](ClientConnectCallback& tasks)
|
||||||
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func(cl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void(Game::client_s*)>(0x401950)(cl); // SV_UserinfoChanged
|
Utils::Hook::Call<void(Game::client_s*)>(0x401950)(cl); // SV_UserinfoChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::SteamDisconnect_Hk()
|
void Events::SteamDisconnect_Hk()
|
||||||
{
|
{
|
||||||
SteamDisconnectSignal();
|
SteamDisconnectTasks_.access([](Callback& tasks)
|
||||||
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void()>(0x467CC0)(); // LiveSteam_Client_SteamDisconnect
|
Utils::Hook::Call<void()>(0x467CC0)(); // LiveSteam_Client_SteamDisconnect
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::Scr_ShutdownSystem_Hk(unsigned char sys)
|
void Events::Scr_ShutdownSystem_Hk(unsigned char sys)
|
||||||
{
|
{
|
||||||
ShutdownSystemSignal();
|
ShutdownSystemTasks_.access([](Callback& tasks)
|
||||||
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void(unsigned char)>(0x421EE0)(sys); // Scr_ShutdownSystem
|
Utils::Hook::Call<void(unsigned char)>(0x421EE0)(sys); // Scr_ShutdownSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::CL_InitOnceForAllClients_HK()
|
void Events::CL_InitOnceForAllClients_HK()
|
||||||
{
|
{
|
||||||
ClientInitSignal();
|
ClientInitTasks_.access([](Callback& tasks)
|
||||||
ClientInitSignal.clear();
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks = {}; // Only called once. Clear
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void()>(0x404CA0)(); // CL_InitOnceForAllClients
|
Utils::Hook::Call<void()>(0x404CA0)(); // CL_InitOnceForAllClients
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::SV_Init_Hk()
|
void Events::SV_Init_Hk()
|
||||||
{
|
{
|
||||||
ServerInitSignal();
|
ServerInitTasks_.access([](Callback& tasks)
|
||||||
ServerInitSignal.clear();
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks = {}; // Only called once. Clear
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void()>(0x474320)(); // SV_InitGameMode
|
Utils::Hook::Call<void()>(0x474320)(); // SV_InitGameMode
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::Com_InitDvars_Hk()
|
void Events::Com_InitDvars_Hk()
|
||||||
{
|
{
|
||||||
DvarInitSignal();
|
DvarInitTasks_.access([](Callback& tasks)
|
||||||
DvarInitSignal.clear();
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks = {}; // Only called once. Clear
|
||||||
|
});
|
||||||
|
|
||||||
Utils::Hook::Call<void()>(0x60AD10)(); // Com_InitDvars
|
Utils::Hook::Call<void()>(0x60AD10)(); // Com_InitDvars
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::NetworkStart()
|
void Events::NetworkStart()
|
||||||
{
|
{
|
||||||
NetworkInitSignal();
|
NetworkInitTasks_.access([](Callback& tasks)
|
||||||
NetworkInitSignal.clear();
|
{
|
||||||
|
for (const auto& func : tasks)
|
||||||
|
{
|
||||||
|
func();
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks = {}; // Only called once. Clear
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(naked) void Events::NET_OpenSocks_Hk()
|
__declspec(naked) void Events::NET_OpenSocks_Hk()
|
||||||
|
@ -5,42 +5,42 @@ namespace Components
|
|||||||
class Events : public Component
|
class Events : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void(ClientCallback)(int clientNum);
|
using Callback = std::vector<std::function<void()>>;
|
||||||
typedef void(ClientConnectCallback)(Game::client_s* cl);
|
using ClientConnectCallback = std::vector<std::function<void(Game::client_s* cl)>>;
|
||||||
typedef void(Callback)();
|
using ClientCallback = std::vector<std::function<void(int clientNum)>>;
|
||||||
|
|
||||||
Events();
|
Events();
|
||||||
|
|
||||||
// Server side
|
// Server side
|
||||||
static void OnClientDisconnect(const Utils::Slot<ClientCallback>& callback);
|
static void OnClientDisconnect(const std::function<void(int clientNum)>& callback);
|
||||||
|
|
||||||
// Server side
|
// Server side
|
||||||
static void OnClientConnect(const Utils::Slot<ClientConnectCallback>& callback);
|
static void OnClientConnect(const std::function<void(Game::client_s* cl)>& callback);
|
||||||
|
|
||||||
// Client side
|
// Client side
|
||||||
static void OnSteamDisconnect(const Utils::Slot<Callback>& callback);
|
static void OnSteamDisconnect(const std::function<void()>& callback);
|
||||||
|
|
||||||
static void OnVMShutdown(const Utils::Slot<Callback>& callback);
|
static void OnVMShutdown(const std::function<void()>& callback);
|
||||||
|
|
||||||
static void OnClientInit(const Utils::Slot<Callback>& callback);
|
static void OnClientInit(const std::function<void()>& callback);
|
||||||
|
|
||||||
// Client & Server (triggered once)
|
// Client & Server (triggered once)
|
||||||
static void OnSVInit(const Utils::Slot<Callback>& callback);
|
static void OnSVInit(const std::function<void()>& callback);
|
||||||
|
|
||||||
// Client & Server (triggered once)
|
// Client & Server (triggered once)
|
||||||
static void OnDvarInit(const Utils::Slot<Callback>& callback);
|
static void OnDvarInit(const std::function<void()>& callback);
|
||||||
|
|
||||||
static void OnNetworkInit(const Utils::Slot<Callback>& callback);
|
static void OnNetworkInit(const std::function<void()>& callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Utils::Signal<ClientCallback> ClientDisconnectSignal;
|
static Utils::Concurrency::Container<ClientCallback> ClientDisconnectTasks_;
|
||||||
static Utils::Signal<ClientConnectCallback> ClientConnectSignal;
|
static Utils::Concurrency::Container<ClientConnectCallback> ClientConnectTasks_;
|
||||||
static Utils::Signal<Callback> SteamDisconnectSignal;
|
static Utils::Concurrency::Container<Callback> SteamDisconnectTasks_;
|
||||||
static Utils::Signal<Callback> ShutdownSystemSignal;
|
static Utils::Concurrency::Container<Callback> ShutdownSystemTasks_;
|
||||||
static Utils::Signal<Callback> ClientInitSignal;
|
static Utils::Concurrency::Container<Callback> ClientInitTasks_;
|
||||||
static Utils::Signal<Callback> ServerInitSignal;
|
static Utils::Concurrency::Container<Callback> ServerInitTasks_;
|
||||||
static Utils::Signal<Callback> DvarInitSignal;
|
static Utils::Concurrency::Container<Callback> DvarInitTasks_;
|
||||||
static Utils::Signal<Callback> NetworkInitSignal;
|
static Utils::Concurrency::Container<Callback> NetworkInitTasks_;
|
||||||
|
|
||||||
static void ClientDisconnect_Hk(int clientNum);
|
static void ClientDisconnect_Hk(int clientNum);
|
||||||
static void SV_UserinfoChanged_Hk(Game::client_s* cl);
|
static void SV_UserinfoChanged_Hk(Game::client_s* cl);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <proto/friends.pb.h>
|
#include <proto/friends.pb.h>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "Friends.hpp"
|
#include "Friends.hpp"
|
||||||
#include "Materials.hpp"
|
#include "Materials.hpp"
|
||||||
#include "Node.hpp"
|
#include "Node.hpp"
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include <Components/Modules/Events.hpp>
|
||||||
|
|
||||||
#include "IO.hpp"
|
#include "IO.hpp"
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
|
|
||||||
|
@ -166,12 +166,12 @@ namespace Components::GSC
|
|||||||
if (pName != nullptr)
|
if (pName != nullptr)
|
||||||
{
|
{
|
||||||
const auto name = Utils::String::ToLower(*pName);
|
const auto name = Utils::String::ToLower(*pName);
|
||||||
for (const auto& func : CustomScrFunctions)
|
for (const auto& funcs : CustomScrFunctions)
|
||||||
{
|
{
|
||||||
if (Utils::Contains(&func.aliases, name))
|
if (std::ranges::find(funcs.aliases, name) != funcs.aliases.end())
|
||||||
{
|
{
|
||||||
*type = func.type;
|
*type = funcs.type;
|
||||||
return func.actionFunc;
|
return funcs.actionFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,12 +193,12 @@ namespace Components::GSC
|
|||||||
if (pName != nullptr)
|
if (pName != nullptr)
|
||||||
{
|
{
|
||||||
const auto name = Utils::String::ToLower(*pName);
|
const auto name = Utils::String::ToLower(*pName);
|
||||||
for (const auto& meth : CustomScrMethods)
|
for (const auto& meths : CustomScrMethods)
|
||||||
{
|
{
|
||||||
if (Utils::Contains(&meth.aliases, name))
|
if (std::ranges::find(meths.aliases, name) != meths.aliases.end())
|
||||||
{
|
{
|
||||||
*type = meth.type;
|
*type = meths.type;
|
||||||
return meth.actionFunc;
|
return meths.actionFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ namespace Components::GSC
|
|||||||
{
|
{
|
||||||
using namespace Utils::String;
|
using namespace Utils::String;
|
||||||
|
|
||||||
int ScriptError::developer_;
|
int ScriptError::Developer_;
|
||||||
|
|
||||||
Game::scrParserGlob_t ScriptError::scrParserGlob;
|
Game::scrParserGlob_t ScriptError::ScrParserGlob;
|
||||||
Game::scrParserPub_t ScriptError::scrParserPub;
|
Game::scrParserPub_t ScriptError::ScrParserPub;
|
||||||
|
|
||||||
int ScriptError::Scr_IsInOpcodeMemory(const char* pos)
|
int ScriptError::Scr_IsInOpcodeMemory(const char* pos)
|
||||||
{
|
{
|
||||||
@ -27,7 +27,7 @@ namespace Components::GSC
|
|||||||
Game::OpcodeLookup* opcodeLookup;
|
Game::OpcodeLookup* opcodeLookup;
|
||||||
Game::SourceLookup* sourcePosLookup;
|
Game::SourceLookup* sourcePosLookup;
|
||||||
|
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -48,83 +48,83 @@ namespace Components::GSC
|
|||||||
type &= ~Game::SOURCE_TYPE_BREAKPOINT;
|
type &= ~Game::SOURCE_TYPE_BREAKPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(scrParserGlob.opcodeLookup);
|
assert(ScrParserGlob.opcodeLookup);
|
||||||
assert(scrParserGlob.sourcePosLookup);
|
assert(ScrParserGlob.sourcePosLookup);
|
||||||
assert(Game::scrCompilePub->opcodePos);
|
assert(Game::scrCompilePub->opcodePos);
|
||||||
|
|
||||||
auto size = sizeof(Game::OpcodeLookup) * (scrParserGlob.opcodeLookupLen + 1);
|
auto size = sizeof(Game::OpcodeLookup) * (ScrParserGlob.opcodeLookupLen + 1);
|
||||||
if (size > scrParserGlob.opcodeLookupMaxSize)
|
if (size > ScrParserGlob.opcodeLookupMaxSize)
|
||||||
{
|
{
|
||||||
if (scrParserGlob.opcodeLookupMaxSize >= Game::MAX_OPCODE_LOOKUP_SIZE)
|
if (ScrParserGlob.opcodeLookupMaxSize >= Game::MAX_OPCODE_LOOKUP_SIZE)
|
||||||
{
|
{
|
||||||
Game::Sys_Error("MAX_OPCODE_LOOKUP_SIZE exceeded");
|
Game::Sys_Error("MAX_OPCODE_LOOKUP_SIZE exceeded");
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Z_VirtualCommit((char*)scrParserGlob.opcodeLookup + scrParserGlob.opcodeLookupMaxSize, 0x20000);
|
Game::Z_VirtualCommit((char*)ScrParserGlob.opcodeLookup + ScrParserGlob.opcodeLookupMaxSize, 0x20000);
|
||||||
scrParserGlob.opcodeLookupMaxSize += 0x20000;
|
ScrParserGlob.opcodeLookupMaxSize += 0x20000;
|
||||||
assert(size <= scrParserGlob.opcodeLookupMaxSize);
|
assert(size <= ScrParserGlob.opcodeLookupMaxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
size = sizeof(Game::SourceLookup) * (scrParserGlob.sourcePosLookupLen + 1);
|
size = sizeof(Game::SourceLookup) * (ScrParserGlob.sourcePosLookupLen + 1);
|
||||||
if (size > scrParserGlob.sourcePosLookupMaxSize)
|
if (size > ScrParserGlob.sourcePosLookupMaxSize)
|
||||||
{
|
{
|
||||||
if (scrParserGlob.sourcePosLookupMaxSize >= Game::MAX_SOURCEPOS_LOOKUP_SIZE)
|
if (ScrParserGlob.sourcePosLookupMaxSize >= Game::MAX_SOURCEPOS_LOOKUP_SIZE)
|
||||||
{
|
{
|
||||||
Game::Sys_Error("MAX_SOURCEPOS_LOOKUP_SIZE exceeded");
|
Game::Sys_Error("MAX_SOURCEPOS_LOOKUP_SIZE exceeded");
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Z_VirtualCommit((char*)scrParserGlob.sourcePosLookup + scrParserGlob.sourcePosLookupMaxSize, 0x20000);
|
Game::Z_VirtualCommit((char*)ScrParserGlob.sourcePosLookup + ScrParserGlob.sourcePosLookupMaxSize, 0x20000);
|
||||||
scrParserGlob.sourcePosLookupMaxSize += 0x20000;
|
ScrParserGlob.sourcePosLookupMaxSize += 0x20000;
|
||||||
assert(size <= scrParserGlob.sourcePosLookupMaxSize);
|
assert(size <= ScrParserGlob.sourcePosLookupMaxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrParserGlob.currentCodePos == Game::scrCompilePub->opcodePos)
|
if (ScrParserGlob.currentCodePos == Game::scrCompilePub->opcodePos)
|
||||||
{
|
{
|
||||||
assert(scrParserGlob.currentSourcePosCount);
|
assert(ScrParserGlob.currentSourcePosCount);
|
||||||
--scrParserGlob.opcodeLookupLen;
|
--ScrParserGlob.opcodeLookupLen;
|
||||||
opcodeLookup = &scrParserGlob.opcodeLookup[scrParserGlob.opcodeLookupLen];
|
opcodeLookup = &ScrParserGlob.opcodeLookup[ScrParserGlob.opcodeLookupLen];
|
||||||
assert(opcodeLookup->sourcePosIndex + scrParserGlob.currentSourcePosCount == scrParserGlob.sourcePosLookupLen);
|
assert(opcodeLookup->sourcePosIndex + ScrParserGlob.currentSourcePosCount == ScrParserGlob.sourcePosLookupLen);
|
||||||
assert(opcodeLookup->codePos == (char*)scrParserGlob.currentCodePos);
|
assert(opcodeLookup->codePos == (char*)ScrParserGlob.currentCodePos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scrParserGlob.currentSourcePosCount = 0;
|
ScrParserGlob.currentSourcePosCount = 0;
|
||||||
scrParserGlob.currentCodePos = Game::scrCompilePub->opcodePos;
|
ScrParserGlob.currentCodePos = Game::scrCompilePub->opcodePos;
|
||||||
opcodeLookup = &scrParserGlob.opcodeLookup[scrParserGlob.opcodeLookupLen];
|
opcodeLookup = &ScrParserGlob.opcodeLookup[ScrParserGlob.opcodeLookupLen];
|
||||||
opcodeLookup->sourcePosIndex = scrParserGlob.sourcePosLookupLen;
|
opcodeLookup->sourcePosIndex = ScrParserGlob.sourcePosLookupLen;
|
||||||
opcodeLookup->codePos = scrParserGlob.currentCodePos;
|
opcodeLookup->codePos = ScrParserGlob.currentCodePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sourcePosLookupIndex = scrParserGlob.currentSourcePosCount + opcodeLookup->sourcePosIndex;
|
auto sourcePosLookupIndex = ScrParserGlob.currentSourcePosCount + opcodeLookup->sourcePosIndex;
|
||||||
sourcePosLookup = &scrParserGlob.sourcePosLookup[sourcePosLookupIndex];
|
sourcePosLookup = &ScrParserGlob.sourcePosLookup[sourcePosLookupIndex];
|
||||||
sourcePosLookup->sourcePos = sourcePos;
|
sourcePosLookup->sourcePos = sourcePos;
|
||||||
|
|
||||||
if (sourcePos == static_cast<unsigned int>(-1))
|
if (sourcePos == static_cast<unsigned int>(-1))
|
||||||
{
|
{
|
||||||
assert(scrParserGlob.delayedSourceIndex == -1);
|
assert(ScrParserGlob.delayedSourceIndex == -1);
|
||||||
assert(type & Game::SOURCE_TYPE_BREAKPOINT);
|
assert(type & Game::SOURCE_TYPE_BREAKPOINT);
|
||||||
scrParserGlob.delayedSourceIndex = static_cast<int>(sourcePosLookupIndex);
|
ScrParserGlob.delayedSourceIndex = static_cast<int>(sourcePosLookupIndex);
|
||||||
}
|
}
|
||||||
else if (sourcePos == static_cast<unsigned int>(-2))
|
else if (sourcePos == static_cast<unsigned int>(-2))
|
||||||
{
|
{
|
||||||
scrParserGlob.threadStartSourceIndex = static_cast<int>(sourcePosLookupIndex);
|
ScrParserGlob.threadStartSourceIndex = static_cast<int>(sourcePosLookupIndex);
|
||||||
}
|
}
|
||||||
else if (scrParserGlob.delayedSourceIndex >= 0 && (type & Game::SOURCE_TYPE_BREAKPOINT))
|
else if (ScrParserGlob.delayedSourceIndex >= 0 && (type & Game::SOURCE_TYPE_BREAKPOINT))
|
||||||
{
|
{
|
||||||
scrParserGlob.sourcePosLookup[scrParserGlob.delayedSourceIndex].sourcePos = sourcePos;
|
ScrParserGlob.sourcePosLookup[ScrParserGlob.delayedSourceIndex].sourcePos = sourcePos;
|
||||||
scrParserGlob.delayedSourceIndex = -1;
|
ScrParserGlob.delayedSourceIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcePosLookup->type |= type;
|
sourcePosLookup->type |= type;
|
||||||
++scrParserGlob.currentSourcePosCount;
|
++ScrParserGlob.currentSourcePosCount;
|
||||||
opcodeLookup->sourcePosCount = static_cast<unsigned short>(scrParserGlob.currentSourcePosCount);
|
opcodeLookup->sourcePosCount = static_cast<unsigned short>(ScrParserGlob.currentSourcePosCount);
|
||||||
++scrParserGlob.opcodeLookupLen;
|
++ScrParserGlob.opcodeLookupLen;
|
||||||
++scrParserGlob.sourcePosLookupLen;
|
++ScrParserGlob.sourcePosLookupLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptError::RemoveOpcodePos()
|
void ScriptError::RemoveOpcodePos()
|
||||||
{
|
{
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -135,35 +135,35 @@ namespace Components::GSC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(scrParserGlob.opcodeLookup);
|
assert(ScrParserGlob.opcodeLookup);
|
||||||
assert(scrParserGlob.sourcePosLookup);
|
assert(ScrParserGlob.sourcePosLookup);
|
||||||
assert(Game::scrCompilePub->opcodePos);
|
assert(Game::scrCompilePub->opcodePos);
|
||||||
assert(scrParserGlob.sourcePosLookupLen);
|
assert(ScrParserGlob.sourcePosLookupLen);
|
||||||
|
|
||||||
--scrParserGlob.sourcePosLookupLen;
|
--ScrParserGlob.sourcePosLookupLen;
|
||||||
assert(scrParserGlob.opcodeLookupLen);
|
assert(ScrParserGlob.opcodeLookupLen);
|
||||||
|
|
||||||
--scrParserGlob.opcodeLookupLen;
|
--ScrParserGlob.opcodeLookupLen;
|
||||||
assert(scrParserGlob.currentSourcePosCount);
|
assert(ScrParserGlob.currentSourcePosCount);
|
||||||
--scrParserGlob.currentSourcePosCount;
|
--ScrParserGlob.currentSourcePosCount;
|
||||||
|
|
||||||
auto* opcodeLookup = &scrParserGlob.opcodeLookup[scrParserGlob.opcodeLookupLen];
|
auto* opcodeLookup = &ScrParserGlob.opcodeLookup[ScrParserGlob.opcodeLookupLen];
|
||||||
|
|
||||||
assert(scrParserGlob.currentCodePos == Game::scrCompilePub->opcodePos);
|
assert(ScrParserGlob.currentCodePos == Game::scrCompilePub->opcodePos);
|
||||||
assert(opcodeLookup->sourcePosIndex + scrParserGlob.currentSourcePosCount == scrParserGlob.sourcePosLookupLen);
|
assert(opcodeLookup->sourcePosIndex + ScrParserGlob.currentSourcePosCount == ScrParserGlob.sourcePosLookupLen);
|
||||||
assert(opcodeLookup->codePos == (char*)scrParserGlob.currentCodePos);
|
assert(opcodeLookup->codePos == (char*)ScrParserGlob.currentCodePos);
|
||||||
|
|
||||||
if (!scrParserGlob.currentSourcePosCount)
|
if (!ScrParserGlob.currentSourcePosCount)
|
||||||
{
|
{
|
||||||
scrParserGlob.currentCodePos = nullptr;
|
ScrParserGlob.currentCodePos = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
opcodeLookup->sourcePosCount = static_cast<unsigned short>(scrParserGlob.currentSourcePosCount);
|
opcodeLookup->sourcePosCount = static_cast<unsigned short>(ScrParserGlob.currentSourcePosCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptError::AddThreadStartOpcodePos(unsigned int sourcePos)
|
void ScriptError::AddThreadStartOpcodePos(unsigned int sourcePos)
|
||||||
{
|
{
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -174,12 +174,12 @@ namespace Components::GSC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(scrParserGlob.threadStartSourceIndex >= 0);
|
assert(ScrParserGlob.threadStartSourceIndex >= 0);
|
||||||
auto* sourcePosLookup = &scrParserGlob.sourcePosLookup[scrParserGlob.threadStartSourceIndex];
|
auto* sourcePosLookup = &ScrParserGlob.sourcePosLookup[ScrParserGlob.threadStartSourceIndex];
|
||||||
sourcePosLookup->sourcePos = sourcePos;
|
sourcePosLookup->sourcePos = sourcePos;
|
||||||
assert(!sourcePosLookup->type);
|
assert(!sourcePosLookup->type);
|
||||||
sourcePosLookup->type = 8;
|
sourcePosLookup->type = 8;
|
||||||
scrParserGlob.threadStartSourceIndex = -1;
|
ScrParserGlob.threadStartSourceIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,35 +188,35 @@ namespace Components::GSC
|
|||||||
const char* startLine;
|
const char* startLine;
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
assert(developer_);
|
assert(Developer_);
|
||||||
return Scr_GetLineNumInternal(scrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, sourcePos, &startLine, &col, nullptr);
|
return Scr_GetLineNumInternal(ScrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, sourcePos, &startLine, &col, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ScriptError::Scr_GetPrevSourcePos(const char* codePos, unsigned int index)
|
unsigned int ScriptError::Scr_GetPrevSourcePos(const char* codePos, unsigned int index)
|
||||||
{
|
{
|
||||||
return scrParserGlob.sourcePosLookup[index + Scr_GetPrevSourcePosOpcodeLookup(codePos)->sourcePosIndex].sourcePos;
|
return ScrParserGlob.sourcePosLookup[index + Scr_GetPrevSourcePosOpcodeLookup(codePos)->sourcePosIndex].sourcePos;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::OpcodeLookup* ScriptError::Scr_GetPrevSourcePosOpcodeLookup(const char* codePos)
|
Game::OpcodeLookup* ScriptError::Scr_GetPrevSourcePosOpcodeLookup(const char* codePos)
|
||||||
{
|
{
|
||||||
assert(Scr_IsInOpcodeMemory(codePos));
|
assert(Scr_IsInOpcodeMemory(codePos));
|
||||||
assert(scrParserGlob.opcodeLookup);
|
assert(ScrParserGlob.opcodeLookup);
|
||||||
|
|
||||||
unsigned int low = 0;
|
unsigned int low = 0;
|
||||||
unsigned int high = scrParserGlob.opcodeLookupLen - 1;
|
unsigned int high = ScrParserGlob.opcodeLookupLen - 1;
|
||||||
while (low <= high)
|
while (low <= high)
|
||||||
{
|
{
|
||||||
unsigned int middle = (high + low) >> 1;
|
unsigned int middle = (high + low) >> 1;
|
||||||
if (codePos < scrParserGlob.opcodeLookup[middle].codePos)
|
if (codePos < ScrParserGlob.opcodeLookup[middle].codePos)
|
||||||
{
|
{
|
||||||
high = middle - 1;
|
high = middle - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
low = middle + 1;
|
low = middle + 1;
|
||||||
if (low == scrParserGlob.opcodeLookupLen || codePos < scrParserGlob.opcodeLookup[low].codePos)
|
if (low == ScrParserGlob.opcodeLookupLen || codePos < ScrParserGlob.opcodeLookup[low].codePos)
|
||||||
{
|
{
|
||||||
return &scrParserGlob.opcodeLookup[middle];
|
return &ScrParserGlob.opcodeLookup[middle];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,16 +279,16 @@ namespace Components::GSC
|
|||||||
unsigned int bufferIndex;
|
unsigned int bufferIndex;
|
||||||
|
|
||||||
assert(Scr_IsInOpcodeMemory(codePos));
|
assert(Scr_IsInOpcodeMemory(codePos));
|
||||||
assert(scrParserPub.sourceBufferLookupLen > 0);
|
assert(ScrParserPub.sourceBufferLookupLen > 0);
|
||||||
|
|
||||||
for (bufferIndex = scrParserPub.sourceBufferLookupLen - 1; bufferIndex; --bufferIndex)
|
for (bufferIndex = ScrParserPub.sourceBufferLookupLen - 1; bufferIndex; --bufferIndex)
|
||||||
{
|
{
|
||||||
if (!scrParserPub.sourceBufferLookup[bufferIndex].codePos)
|
if (!ScrParserPub.sourceBufferLookup[bufferIndex].codePos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrParserPub.sourceBufferLookup[bufferIndex].codePos > codePos)
|
if (ScrParserPub.sourceBufferLookup[bufferIndex].codePos > codePos)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ namespace Components::GSC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
if (Scr_IsInOpcodeMemory(codePos - 1))
|
if (Scr_IsInOpcodeMemory(codePos - 1))
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ namespace Components::GSC
|
|||||||
if (Game::scrVarPub->programBuffer && Scr_IsInOpcodeMemory(codePos))
|
if (Game::scrVarPub->programBuffer && Scr_IsInOpcodeMemory(codePos))
|
||||||
{
|
{
|
||||||
auto bufferIndex = Scr_GetSourceBuffer(codePos - 1);
|
auto bufferIndex = Scr_GetSourceBuffer(codePos - 1);
|
||||||
Scr_PrintSourcePos(channel, scrParserPub.sourceBufferLookup[bufferIndex].buf, scrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, Scr_GetPrevSourcePos(codePos - 1, index));
|
Scr_PrintSourcePos(channel, ScrParserPub.sourceBufferLookup[bufferIndex].buf, ScrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, Scr_GetPrevSourcePos(codePos - 1, index));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ namespace Components::GSC
|
|||||||
assert(filename);
|
assert(filename);
|
||||||
auto lineNum = Scr_GetLineInfo(buf, sourcePos, &col, line, nullptr);
|
auto lineNum = Scr_GetLineInfo(buf, sourcePos, &col, line, nullptr);
|
||||||
|
|
||||||
Game::Com_PrintMessage(channel, VA("(file '%s'%s, line %d)\n", filename, scrParserGlob.saveSourceBufferLookup ? " (savegame)" : "", lineNum + 1), 0);
|
Game::Com_PrintMessage(channel, VA("(file '%s'%s, line %d)\n", filename, ScrParserGlob.saveSourceBufferLookup ? " (savegame)" : "", lineNum + 1), 0);
|
||||||
Game::Com_PrintMessage(channel, VA("%s\n", line), 0);
|
Game::Com_PrintMessage(channel, VA("%s\n", line), 0);
|
||||||
|
|
||||||
for (auto i = 0; i < col; ++i)
|
for (auto i = 0; i < col; ++i)
|
||||||
@ -400,7 +400,7 @@ namespace Components::GSC
|
|||||||
bool abort_on_error;
|
bool abort_on_error;
|
||||||
const char* dialogMessageSeparator;
|
const char* dialogMessageSeparator;
|
||||||
|
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
assert(Scr_IsInOpcodeMemory(codePos));
|
assert(Scr_IsInOpcodeMemory(codePos));
|
||||||
if (!(*Game::com_developer)->current.enabled)
|
if (!(*Game::com_developer)->current.enabled)
|
||||||
@ -462,7 +462,7 @@ namespace Components::GSC
|
|||||||
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "\n");
|
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "\n");
|
||||||
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "******* script compile error *******\n");
|
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "******* script compile error *******\n");
|
||||||
|
|
||||||
if (!developer_ || !scrParserPub.sourceBuf)
|
if (!Developer_ || !ScrParserPub.sourceBuf)
|
||||||
{
|
{
|
||||||
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "%s\n", text);
|
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "%s\n", text);
|
||||||
line[0] = '\0';
|
line[0] = '\0';
|
||||||
@ -472,12 +472,12 @@ namespace Components::GSC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(scrParserPub.sourceBuf);
|
assert(ScrParserPub.sourceBuf);
|
||||||
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "%s: ", text);
|
Game::Com_PrintError(Game::CON_CHANNEL_PARSERSCRIPT, "%s: ", text);
|
||||||
|
|
||||||
Scr_PrintSourcePos(Game::CON_CHANNEL_PARSERSCRIPT, scrParserPub.scriptfilename, scrParserPub.sourceBuf, sourcePos);
|
Scr_PrintSourcePos(Game::CON_CHANNEL_PARSERSCRIPT, ScrParserPub.scriptfilename, ScrParserPub.sourceBuf, sourcePos);
|
||||||
auto lineNumber = Scr_GetLineInfo(scrParserPub.sourceBuf, sourcePos, &col, line, nullptr);
|
const auto lineNumber = Scr_GetLineInfo(ScrParserPub.sourceBuf, sourcePos, &col, line, nullptr);
|
||||||
Game::Com_Error(Game::ERR_SCRIPT_DROP, "\x15" "script compile error\n%s\n%s(%d):\n %s\n(see console for details)\n", text, scrParserPub.scriptfilename, lineNumber, line);
|
Game::Com_Error(Game::ERR_SCRIPT_DROP, "\x15" "script compile error\n%s\n%s(%d):\n %s\n(see console for details)\n", text, ScrParserPub.scriptfilename, lineNumber, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ namespace Components::GSC
|
|||||||
|
|
||||||
Game::Com_Printf(Game::CON_CHANNEL_PARSERSCRIPT, "************************************\n");
|
Game::Com_Printf(Game::CON_CHANNEL_PARSERSCRIPT, "************************************\n");
|
||||||
|
|
||||||
Scr_GetTextSourcePos(scrParserPub.sourceBuf, codePos, line);
|
Scr_GetTextSourcePos(ScrParserPub.sourceBuf, codePos, line);
|
||||||
|
|
||||||
Game::Com_Error(Game::ERR_SCRIPT_DROP, "\x15" "script compile error\n%s\n%s\n(see console for details)\n", text, line);
|
Game::Com_Error(Game::ERR_SCRIPT_DROP, "\x15" "script compile error\n%s\n%s\n(see console for details)\n", text, line);
|
||||||
}
|
}
|
||||||
@ -513,10 +513,10 @@ namespace Components::GSC
|
|||||||
{
|
{
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (developer_ && codePos && codePos != Game::g_EndPos && Game::scrVarPub->programBuffer && Scr_IsInOpcodeMemory(codePos))
|
if (Developer_ && codePos && codePos != Game::g_EndPos && Game::scrVarPub->programBuffer && Scr_IsInOpcodeMemory(codePos))
|
||||||
{
|
{
|
||||||
auto bufferIndex = Scr_GetSourceBuffer(codePos - 1);
|
auto bufferIndex = Scr_GetSourceBuffer(codePos - 1);
|
||||||
Scr_GetLineInfo(scrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, Scr_GetPrevSourcePos(codePos - 1, 0), &col, line, nullptr);
|
Scr_GetLineInfo(ScrParserPub.sourceBufferLookup[bufferIndex].sourceBuf, Scr_GetPrevSourcePos(codePos - 1, 0), &col, line, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -526,68 +526,68 @@ namespace Components::GSC
|
|||||||
|
|
||||||
void ScriptError::Scr_InitOpcodeLookup()
|
void ScriptError::Scr_InitOpcodeLookup()
|
||||||
{
|
{
|
||||||
assert(!scrParserGlob.opcodeLookup);
|
assert(!ScrParserGlob.opcodeLookup);
|
||||||
assert(!scrParserGlob.sourcePosLookup);
|
assert(!ScrParserGlob.sourcePosLookup);
|
||||||
assert(!scrParserPub.sourceBufferLookup);
|
assert(!ScrParserPub.sourceBufferLookup);
|
||||||
|
|
||||||
if (!developer_)
|
if (!Developer_)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrParserGlob.delayedSourceIndex = -1;
|
ScrParserGlob.delayedSourceIndex = -1;
|
||||||
scrParserGlob.opcodeLookupMaxSize = 0;
|
ScrParserGlob.opcodeLookupMaxSize = 0;
|
||||||
scrParserGlob.opcodeLookupLen = 0;
|
ScrParserGlob.opcodeLookupLen = 0;
|
||||||
scrParserGlob.opcodeLookup = static_cast<Game::OpcodeLookup*>(Game::Z_VirtualReserve(Game::MAX_OPCODE_LOOKUP_SIZE));
|
ScrParserGlob.opcodeLookup = static_cast<Game::OpcodeLookup*>(Game::Z_VirtualReserve(Game::MAX_OPCODE_LOOKUP_SIZE));
|
||||||
|
|
||||||
scrParserGlob.sourcePosLookupMaxSize = 0;
|
ScrParserGlob.sourcePosLookupMaxSize = 0;
|
||||||
scrParserGlob.sourcePosLookupLen = 0;
|
ScrParserGlob.sourcePosLookupLen = 0;
|
||||||
scrParserGlob.sourcePosLookup = static_cast<Game::SourceLookup*>(Game::Z_VirtualReserve(Game::MAX_SOURCEPOS_LOOKUP_SIZE));
|
ScrParserGlob.sourcePosLookup = static_cast<Game::SourceLookup*>(Game::Z_VirtualReserve(Game::MAX_SOURCEPOS_LOOKUP_SIZE));
|
||||||
scrParserGlob.currentCodePos = nullptr;
|
ScrParserGlob.currentCodePos = nullptr;
|
||||||
scrParserGlob.currentSourcePosCount = 0;
|
ScrParserGlob.currentSourcePosCount = 0;
|
||||||
scrParserGlob.sourceBufferLookupMaxSize = 0;
|
ScrParserGlob.sourceBufferLookupMaxSize = 0;
|
||||||
|
|
||||||
scrParserPub.sourceBufferLookupLen = 0;
|
ScrParserPub.sourceBufferLookupLen = 0;
|
||||||
scrParserPub.sourceBufferLookup = static_cast<Game::SourceBufferInfo*>(Game::Z_VirtualReserve(Game::MAX_SOURCEBUF_LOOKUP_SIZE));
|
ScrParserPub.sourceBufferLookup = static_cast<Game::SourceBufferInfo*>(Game::Z_VirtualReserve(Game::MAX_SOURCEBUF_LOOKUP_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptError::Scr_ShutdownOpcodeLookup()
|
void ScriptError::Scr_ShutdownOpcodeLookup()
|
||||||
{
|
{
|
||||||
if (scrParserGlob.opcodeLookup)
|
if (ScrParserGlob.opcodeLookup)
|
||||||
{
|
{
|
||||||
Z_VirtualFree(scrParserGlob.opcodeLookup);
|
Z_VirtualFree(ScrParserGlob.opcodeLookup);
|
||||||
scrParserGlob.opcodeLookup = nullptr;
|
ScrParserGlob.opcodeLookup = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrParserGlob.sourcePosLookup)
|
if (ScrParserGlob.sourcePosLookup)
|
||||||
{
|
{
|
||||||
Z_VirtualFree(scrParserGlob.sourcePosLookup);
|
Z_VirtualFree(ScrParserGlob.sourcePosLookup);
|
||||||
scrParserGlob.sourcePosLookup = nullptr;
|
ScrParserGlob.sourcePosLookup = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrParserPub.sourceBufferLookup)
|
if (ScrParserPub.sourceBufferLookup)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < scrParserPub.sourceBufferLookupLen; ++i)
|
for (unsigned int i = 0; i < ScrParserPub.sourceBufferLookupLen; ++i)
|
||||||
{
|
{
|
||||||
Game::Engine::Hunk_FreeDebugMem(scrParserPub.sourceBufferLookup[i].buf);
|
Game::Engine::Hunk_FreeDebugMem(ScrParserPub.sourceBufferLookup[i].buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_VirtualFree(scrParserPub.sourceBufferLookup);
|
Z_VirtualFree(ScrParserPub.sourceBufferLookup);
|
||||||
scrParserPub.sourceBufferLookup = nullptr;
|
ScrParserPub.sourceBufferLookup = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrParserGlob.saveSourceBufferLookup)
|
if (ScrParserGlob.saveSourceBufferLookup)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < scrParserGlob.saveSourceBufferLookupLen; ++i)
|
for (unsigned int i = 0; i < ScrParserGlob.saveSourceBufferLookupLen; ++i)
|
||||||
{
|
{
|
||||||
if (scrParserGlob.saveSourceBufferLookup[i].sourceBuf)
|
if (ScrParserGlob.saveSourceBufferLookup[i].sourceBuf)
|
||||||
{
|
{
|
||||||
Game::Engine::Hunk_FreeDebugMem(scrParserGlob.saveSourceBufferLookup[i].buf);
|
Game::Engine::Hunk_FreeDebugMem(ScrParserGlob.saveSourceBufferLookup[i].buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Engine::Hunk_FreeDebugMem(scrParserGlob.saveSourceBufferLookup);
|
Game::Engine::Hunk_FreeDebugMem(ScrParserGlob.saveSourceBufferLookup);
|
||||||
scrParserGlob.saveSourceBufferLookup = nullptr;
|
ScrParserGlob.saveSourceBufferLookup = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,39 +612,39 @@ namespace Components::GSC
|
|||||||
|
|
||||||
Game::SourceBufferInfo* ScriptError::Scr_GetNewSourceBuffer()
|
Game::SourceBufferInfo* ScriptError::Scr_GetNewSourceBuffer()
|
||||||
{
|
{
|
||||||
assert(scrParserPub.sourceBufferLookup);
|
assert(ScrParserPub.sourceBufferLookup);
|
||||||
|
|
||||||
auto size = sizeof(Game::SourceBufferInfo) * (scrParserPub.sourceBufferLookupLen + 1);
|
auto size = sizeof(Game::SourceBufferInfo) * (ScrParserPub.sourceBufferLookupLen + 1);
|
||||||
if (size > scrParserGlob.sourceBufferLookupMaxSize)
|
if (size > ScrParserGlob.sourceBufferLookupMaxSize)
|
||||||
{
|
{
|
||||||
if (scrParserGlob.sourceBufferLookupMaxSize >= Game::MAX_SOURCEBUF_LOOKUP_SIZE)
|
if (ScrParserGlob.sourceBufferLookupMaxSize >= Game::MAX_SOURCEBUF_LOOKUP_SIZE)
|
||||||
{
|
{
|
||||||
Game::Sys_Error("MAX_SOURCEBUF_LOOKUP_SIZE exceeded");
|
Game::Sys_Error("MAX_SOURCEBUF_LOOKUP_SIZE exceeded");
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Z_VirtualCommit((char*)scrParserPub.sourceBufferLookup + scrParserGlob.sourceBufferLookupMaxSize, 0x20000);
|
Game::Z_VirtualCommit((char*)ScrParserPub.sourceBufferLookup + ScrParserGlob.sourceBufferLookupMaxSize, 0x20000);
|
||||||
scrParserGlob.sourceBufferLookupMaxSize += 0x20000;
|
ScrParserGlob.sourceBufferLookupMaxSize += 0x20000;
|
||||||
assert(size <= scrParserGlob.sourceBufferLookupMaxSize);
|
assert(size <= ScrParserGlob.sourceBufferLookupMaxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return &scrParserPub.sourceBufferLookup[scrParserPub.sourceBufferLookupLen++];
|
return &ScrParserPub.sourceBufferLookup[ScrParserPub.sourceBufferLookupLen++];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptError::Scr_AddSourceBufferInternal(const char* extFilename, const char* codePos, char* sourceBuf, int len, bool doEolFixup, bool archive)
|
void ScriptError::Scr_AddSourceBufferInternal(const char* extFilename, const char* codePos, char* sourceBuf, int len, bool doEolFixup, bool archive)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!scrParserPub.sourceBufferLookup)
|
if (!ScrParserPub.sourceBufferLookup)
|
||||||
{
|
{
|
||||||
scrParserPub.sourceBuf = nullptr;
|
ScrParserPub.sourceBuf = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((len >= -1));
|
assert((len >= -1));
|
||||||
assert((len >= 0) || !sourceBuf);
|
assert((len >= 0) || !sourceBuf);
|
||||||
|
|
||||||
auto strLen = std::strlen(extFilename) + 1;
|
const auto strLen = std::strlen(extFilename) + 1;
|
||||||
auto newLen = strLen + len + 2;
|
const auto newLen = strLen + len + 2;
|
||||||
auto* buf = static_cast<char*>(Game::Engine::Hunk_AllocDebugMem(static_cast<int>(newLen))); // Scr_AddSourceBufferInternal
|
auto* buf = static_cast<char*>(Game::Engine::Hunk_AllocDebugMem(static_cast<int>(newLen))); // Scr_AddSourceBufferInternal
|
||||||
|
|
||||||
strcpy(buf, extFilename);
|
strcpy(buf, extFilename);
|
||||||
@ -689,7 +689,7 @@ namespace Components::GSC
|
|||||||
|
|
||||||
if (sourceBuf2)
|
if (sourceBuf2)
|
||||||
{
|
{
|
||||||
scrParserPub.sourceBuf = sourceBuf2;
|
ScrParserPub.sourceBuf = sourceBuf2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,12 +749,12 @@ namespace Components::GSC
|
|||||||
{
|
{
|
||||||
char* sourceBuf;
|
char* sourceBuf;
|
||||||
|
|
||||||
if (archive && scrParserGlob.saveSourceBufferLookup)
|
if (archive && ScrParserGlob.saveSourceBufferLookup)
|
||||||
{
|
{
|
||||||
assert(scrParserGlob.saveSourceBufferLookupLen > 0);
|
assert(ScrParserGlob.saveSourceBufferLookupLen > 0);
|
||||||
--scrParserGlob.saveSourceBufferLookupLen;
|
--ScrParserGlob.saveSourceBufferLookupLen;
|
||||||
|
|
||||||
const auto* saveSourceBuffer = scrParserGlob.saveSourceBufferLookup + scrParserGlob.saveSourceBufferLookupLen;
|
const auto* saveSourceBuffer = ScrParserGlob.saveSourceBufferLookup + ScrParserGlob.saveSourceBufferLookupLen;
|
||||||
const auto len = saveSourceBuffer->len;
|
const auto len = saveSourceBuffer->len;
|
||||||
assert(len >= -1);
|
assert(len >= -1);
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ namespace Components::GSC
|
|||||||
|
|
||||||
sprintf_s(extFilename, "%s.gsc", Game::SL_ConvertToString(static_cast<unsigned short>(name)));
|
sprintf_s(extFilename, "%s.gsc", Game::SL_ConvertToString(static_cast<unsigned short>(name)));
|
||||||
|
|
||||||
const auto* oldSourceBuf = scrParserPub.sourceBuf;
|
const auto* oldSourceBuf = ScrParserPub.sourceBuf;
|
||||||
const auto* sourceBuffer = Scr_AddSourceBuffer(Game::SL_ConvertToString(static_cast<unsigned short>(name)), extFilename, Game::TempMalloc(0), true);
|
const auto* sourceBuffer = Scr_AddSourceBuffer(Game::SL_ConvertToString(static_cast<unsigned short>(name)), extFilename, Game::TempMalloc(0), true);
|
||||||
|
|
||||||
if (!sourceBuffer)
|
if (!sourceBuffer)
|
||||||
@ -820,8 +820,8 @@ namespace Components::GSC
|
|||||||
Game::scrAnimPub->animTreeNames = 0;
|
Game::scrAnimPub->animTreeNames = 0;
|
||||||
Game::scrCompilePub->far_function_count = 0;
|
Game::scrCompilePub->far_function_count = 0;
|
||||||
|
|
||||||
const auto* oldFilename = scrParserPub.scriptfilename;
|
const auto* oldFilename = ScrParserPub.scriptfilename;
|
||||||
scrParserPub.scriptfilename = extFilename;
|
ScrParserPub.scriptfilename = extFilename;
|
||||||
|
|
||||||
Game::scrCompilePub->in_ptr = "+";
|
Game::scrCompilePub->in_ptr = "+";
|
||||||
Game::scrCompilePub->in_ptr_valid = false;
|
Game::scrCompilePub->in_ptr_valid = false;
|
||||||
@ -837,8 +837,8 @@ namespace Components::GSC
|
|||||||
|
|
||||||
Game::RemoveVariable(Game::scrCompilePub->scriptsCount, name);
|
Game::RemoveVariable(Game::scrCompilePub->scriptsCount, name);
|
||||||
|
|
||||||
scrParserPub.scriptfilename = oldFilename;
|
ScrParserPub.scriptfilename = oldFilename;
|
||||||
scrParserPub.sourceBuf = oldSourceBuf;
|
ScrParserPub.sourceBuf = oldSourceBuf;
|
||||||
|
|
||||||
Game::scrAnimPub->animTreeNames = oldAnimTreeNames;
|
Game::scrAnimPub->animTreeNames = oldAnimTreeNames;
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ namespace Components::GSC
|
|||||||
void ScriptError::Scr_Settings_Hk([[maybe_unused]] int developer, int developer_script, int abort_on_error)
|
void ScriptError::Scr_Settings_Hk([[maybe_unused]] int developer, int developer_script, int abort_on_error)
|
||||||
{
|
{
|
||||||
assert(!abort_on_error || developer);
|
assert(!abort_on_error || developer);
|
||||||
developer_ = (*Game::com_developer)->current.enabled;
|
Developer_ = (*Game::com_developer)->current.enabled;
|
||||||
Game::scrVarPub->developer_script = developer_script != 0;
|
Game::scrVarPub->developer_script = developer_script != 0;
|
||||||
Game::scrVmPub->abort_on_error = abort_on_error != 0;
|
Game::scrVmPub->abort_on_error = abort_on_error != 0;
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ namespace Components::GSC
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Replacement for variables not present in currently available structs
|
// Replacement for variables not present in currently available structs
|
||||||
static int developer_;
|
static int Developer_;
|
||||||
|
|
||||||
static Game::scrParserGlob_t scrParserGlob;
|
static Game::scrParserGlob_t ScrParserGlob;
|
||||||
static Game::scrParserPub_t scrParserPub;
|
static Game::scrParserPub_t ScrParserPub;
|
||||||
|
|
||||||
static void AddOpcodePos(unsigned int sourcePos, int type);
|
static void AddOpcodePos(unsigned int sourcePos, int type);
|
||||||
static void RemoveOpcodePos();
|
static void RemoveOpcodePos();
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include <Components/Modules/Events.hpp>
|
||||||
|
|
||||||
#include "ScriptExtension.hpp"
|
#include "ScriptExtension.hpp"
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include <Utils/InfoString.hpp>
|
#include <Utils/InfoString.hpp>
|
||||||
|
|
||||||
|
#include <Components/Modules/Events.hpp>
|
||||||
|
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
#include "UserInfo.hpp"
|
#include "UserInfo.hpp"
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
#include "Console.hpp"
|
#include "Console.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "MapRotation.hpp"
|
#include "MapRotation.hpp"
|
||||||
#include "Party.hpp"
|
#include "Party.hpp"
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "PlayerMovement.hpp"
|
#include "PlayerMovement.hpp"
|
||||||
|
|
||||||
#include "GSC/Script.hpp"
|
#include "GSC/Script.hpp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
#include <proto/rcon.pb.h>
|
#include <proto/rcon.pb.h>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "RCon.hpp"
|
#include "RCon.hpp"
|
||||||
#include "Party.hpp"
|
#include "Party.hpp"
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
Utils::Signal<Renderer::BackendCallback> Renderer::BackendFrameSignal;
|
Utils::Signal<Renderer::BackendCallback> Renderer::BackendFrameSignal;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <Utils/InfoString.hpp>
|
#include <Utils/InfoString.hpp>
|
||||||
|
|
||||||
#include "Discovery.hpp"
|
#include "Discovery.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "Node.hpp"
|
#include "Node.hpp"
|
||||||
#include "Party.hpp"
|
#include "Party.hpp"
|
||||||
#include "ServerList.hpp"
|
#include "ServerList.hpp"
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "StartupMessages.hpp"
|
#include "StartupMessages.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
|
#include "Events.hpp"
|
||||||
#include "UIFeeder.hpp"
|
#include "UIFeeder.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <STDInclude.hpp>
|
#include <STDInclude.hpp>
|
||||||
|
|
||||||
#include "Chat.hpp"
|
#include "Chat.hpp"
|
||||||
|
#include "Events.hpp"
|
||||||
#include "Voice.hpp"
|
#include "Voice.hpp"
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
|
@ -67,12 +67,6 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool Contains(const std::vector<T>* haystack, T needle)
|
|
||||||
{
|
|
||||||
return std::ranges::find(*haystack, needle) != haystack->end();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> using Slot = std::function<T>;
|
template <typename T> using Slot = std::function<T>;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Signal
|
class Signal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user