src/squirrel_helper.hpp
branchnoai
changeset 9480 d071f885f918
parent 9437 28e0105114a4
child 9490 999eb7531205
--- a/src/squirrel_helper.hpp	Mon Mar 19 13:01:04 2007 +0000
+++ b/src/squirrel_helper.hpp	Mon Mar 19 13:14:20 2007 +0000
@@ -122,6 +122,35 @@
 	}
 
 	/**
+	 * The real C++ caller for function with a return value and 4 params.
+	 */
+	template <typename CL, typename RT, typename P1, typename P2, typename P3, typename P4>
+	static int SQCall(CL *instance, RT (CL::*func)(P1, P2, P3, P4), HSQUIRRELVM vm)
+	{
+		return Return(vm, (instance->*func)(
+						GetParam(ForceType<P1>(), vm, 2),
+						GetParam(ForceType<P2>(), vm, 3),
+						GetParam(ForceType<P3>(), vm, 4),
+						GetParam(ForceType<P3>(), vm, 5)
+					));
+	}
+
+	/**
+	 * The real C++ caller for function with no return value and 4 params.
+	 */
+	template <typename CL, typename P1, typename P2, typename P3, typename P4>
+	static int SQCall(CL *instance, void (CL::*func)(P1, P2, P3, P4), HSQUIRRELVM vm)
+	{
+		(instance->*func)(
+						GetParam(ForceType<P1>(), vm, 2),
+						GetParam(ForceType<P2>(), vm, 3),
+						GetParam(ForceType<P3>(), vm, 4),
+						GetParam(ForceType<P3>(), vm, 5)
+					);
+		return 0;
+	}
+
+	/**
 	 * A general template for all callback functions from Squirrel.
 	 *  In here the function_proc is recovered, and the SQCall is called that
 	 *  can handle this exact amount of params.