From 6eb5f8fa381100ed7cac1ab62a4ece11795a5d92 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 18 Sep 2026 09:21:36 -0700 Subject: [PATCH] Replace ke::Function use with std::function. --- bridge/include/CoreProvider.h | 4 ++-- core/GameHooks.h | 4 ++-- core/logic/HandleSys.h | 4 ++-- core/logic/PluginSys.cpp | 6 +++--- core/logic/PluginSys.h | 10 +++++----- core/logic/frame_tasks.cpp | 8 ++++---- core/logic/frame_tasks.h | 4 ++-- public/ReentrantList.h | 2 -- 8 files changed, 20 insertions(+), 22 deletions(-) diff --git a/bridge/include/CoreProvider.h b/bridge/include/CoreProvider.h index 64b1d69e..276dd8aa 100644 --- a/bridge/include/CoreProvider.h +++ b/bridge/include/CoreProvider.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include // SDK types. #if defined(SM_LOGIC) @@ -62,7 +62,7 @@ struct DatabaseInfo; class IPlayerInfoBridge; class ICommandArgs; -typedef ke::Function CommandFunc; +typedef std::function CommandFunc; class CoreProvider { diff --git a/core/GameHooks.h b/core/GameHooks.h index 83c8ad70..043ed0d5 100644 --- a/core/GameHooks.h +++ b/core/GameHooks.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include class ConVar; class CCommand; @@ -63,7 +63,7 @@ class CommandHook : public ke::Refcounted { public: // return false to RETURN_META(MRES_IGNORED), or true to SUPERCEDE. - typedef ke::Function Callback; + typedef std::function Callback; public: CommandHook(ConCommand *cmd, const Callback &callback, bool post); diff --git a/core/logic/HandleSys.h b/core/logic/HandleSys.h index dee2f6e4..0ad0637f 100644 --- a/core/logic/HandleSys.h +++ b/core/logic/HandleSys.h @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include "common_logic.h" @@ -123,7 +123,7 @@ struct QHandleType } }; -typedef ke::Function HandleReporter; +typedef std::function HandleReporter; class HandleSystem : public IHandleSys diff --git a/core/logic/PluginSys.cpp b/core/logic/PluginSys.cpp index 86e17266..d3dcc06b 100644 --- a/core/logic/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -1284,7 +1284,7 @@ bool CPlugin::ForEachExtVar(const ExtVarCallback& callback) return true; } -void CPlugin::ForEachLibrary(ke::Function callback) +void CPlugin::ForEachLibrary(std::function callback) { for (auto iter = m_Libraries.begin(); iter != m_Libraries.end(); iter++) callback((*iter).c_str()); @@ -1296,7 +1296,7 @@ void CPlugin::AddRequiredLib(const char *name) m_RequiredLibs.push_back(name); } -bool CPlugin::ForEachRequiredLib(ke::Function callback) +bool CPlugin::ForEachRequiredLib(std::function callback) { for (auto iter = m_RequiredLibs.begin(); iter != m_RequiredLibs.end(); iter++) { if (!callback((*iter).c_str())) @@ -2392,7 +2392,7 @@ void CPluginManager::FreePluginList(const std::vector *list) delete const_cast *>(list); } -void CPluginManager::ForEachPlugin(ke::Function callback) +void CPluginManager::ForEachPlugin(std::function callback) { for (PluginIter iter(m_plugins); !iter.done(); iter.next()) callback(*iter); diff --git a/core/logic/PluginSys.h b/core/logic/PluginSys.h index de731ea2..f60ffd88 100644 --- a/core/logic/PluginSys.h +++ b/core/logic/PluginSys.h @@ -56,7 +56,7 @@ #include "PhraseCollection.h" #include #include -#include +#include #include class CPlayer; @@ -129,10 +129,10 @@ public: bool required; }; - typedef ke::Function ExtVarCallback; + typedef std::function ExtVarCallback; bool ForEachExtVar(const ExtVarCallback& callback); - void ForEachLibrary(ke::Function callback); + void ForEachLibrary(std::function callback); public: /** * Creates a plugin object with default values. @@ -215,7 +215,7 @@ public: } void AddRequiredLib(const char *name); - bool ForEachRequiredLib(ke::Function callback); + bool ForEachRequiredLib(std::function callback); bool HasMissingFakeNatives() const { return m_FakeNativesMissing; @@ -426,7 +426,7 @@ public: void _SetPauseState(CPlugin *pPlugin, bool pause); - void ForEachPlugin(ke::Function callback); + void ForEachPlugin(std::function callback); private: LoadRes LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type); diff --git a/core/logic/frame_tasks.cpp b/core/logic/frame_tasks.cpp index 74f767d8..84da5cb2 100644 --- a/core/logic/frame_tasks.cpp +++ b/core/logic/frame_tasks.cpp @@ -30,11 +30,11 @@ using namespace SourceMod; -std::vector> sNextTasks; -std::vector> sWorkTasks; +std::vector> sNextTasks; +std::vector> sWorkTasks; void -SourceMod::ScheduleTaskForNextFrame(ke::Function&& task) +SourceMod::ScheduleTaskForNextFrame(std::function&& task) { sNextTasks.push_back(std::forward(task)); } @@ -46,7 +46,7 @@ SourceMod::RunScheduledFrameTasks(bool simulating) return; // Swap. - std::vector> temp(std::move(sNextTasks)); + std::vector> temp(std::move(sNextTasks)); sNextTasks = std::move(sWorkTasks); sWorkTasks = std::move(temp); diff --git a/core/logic/frame_tasks.h b/core/logic/frame_tasks.h index 31dabf3a..aec1f35a 100644 --- a/core/logic/frame_tasks.h +++ b/core/logic/frame_tasks.h @@ -27,11 +27,11 @@ #ifndef _include_sourcemod_logic_frame_tasks_h_ #define _include_sourcemod_logic_frame_tasks_h_ -#include +#include namespace SourceMod { -void ScheduleTaskForNextFrame(ke::Function&& task); +void ScheduleTaskForNextFrame(std::function&& task); void RunScheduledFrameTasks(bool simulating); diff --git a/public/ReentrantList.h b/public/ReentrantList.h index b37670c2..f186cfca 100644 --- a/public/ReentrantList.h +++ b/public/ReentrantList.h @@ -31,8 +31,6 @@ #include #include -#include - namespace SourceMod { // ReentrantList is a wrapper around a std::list, with special attention twoard