Switch ForwardSys to use ICallable.

This removes a ton of tech debt and will improve Forward performance.
This commit is contained in:
David Anderson
2026-05-17 15:22:58 -07:00
parent e70cddfe3e
commit 468760c902
11 changed files with 321 additions and 655 deletions
-1
View File
@@ -47,7 +47,6 @@ enum ParamType
Param_Float = (2<<1), /**< Only floats can be pushed */
Param_String = (3<<1)|SP_PARAMFLAG_BYREF, /**< Only strings can be pushed */
Param_Array = (4<<1)|SP_PARAMFLAG_BYREF, /**< Only arrays can be pushed */
Param_VarArgs = (5<<1), /**< Same as "..." in plugins, anything can be pushed, but it will always be byref */
Param_CellByRef = (1<<1)|SP_PARAMFLAG_BYREF, /**< Only a cell by reference can be pushed */
Param_FloatByRef = (2<<1)|SP_PARAMFLAG_BYREF /**< Only a float by reference can be pushed */
};
+2 -8
View File
@@ -53,7 +53,7 @@ public Action:Command_CreatePrivateForward(args)
delete g_PrivateFwd;
}
g_PrivateFwd = CreateForward(ET_Hook, Param_Cell, Param_String, Param_VarArgs);
g_PrivateFwd = CreateForward(ET_Hook, Param_Cell, Param_String);
if (g_PrivateFwd == null)
{
@@ -134,13 +134,7 @@ public Action:Command_ExecPrivateForward(args)
Call_StartForward(g_PrivateFwd);
Call_PushCell(24);
Call_PushString("I am a format string: %d %d %d %d %d %d");
Call_PushCell(0);
Call_PushCell(1);
Call_PushCell(2);
Call_PushCell(3);
Call_PushCell(4);
Call_PushCell(5);
Call_PushString("I am a string");
err = Call_Finish(ret);
PrintToServer("Call to private forward completed");
+2 -3
View File
@@ -9,7 +9,7 @@ public Plugin:myinfo =
url = "http://www.sourcemod.net/"
};
public Action:OnPrivateForward(num, const String:format[], ...)
public Action:OnPrivateForward(num, const String:format[])
{
decl String:buffer[128];
@@ -17,8 +17,7 @@ public Action:OnPrivateForward(num, const String:format[], ...)
PrintToServer("num = %d (expected: %d)", num, 24);
VFormat(buffer, sizeof(buffer), format, 3);
PrintToServer("buffer = \"%s\" (expected: \"%s\")", buffer, "I am a format string: 0 1 2 3 4 5");
PrintToServer("buffer = \"%s\" (expected: \"%s\")", buffer, "I am a string");
PrintToServer("End private forward #2");