1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-03 15:24:15 +01:00
HLMetaModOfficial/sourcehook/test/testbail2.cpp
Pavol Marko 8e446b28c3 Added hook ids
Added VP hooks and VP Hook test
New macro syntax (SH_ADD_HOOK + SH_STATIC/SH_MEMBER)

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40385
2007-05-07 18:35:59 +00:00

37 lines
723 B
C++

// TESTBAIL
// Different compilation unit
#include "sourcehook.h"
#include "sourcehook_test.h"
#include "testbail.h"
int EatYams_Handler2(int a)
{
ADD_STATE(State_EatYams_Handler2_Called(a));
RETURN_META_VALUE_NEWPARAMS(MRES_OVERRIDE, 6, &IGaben::EatYams, (0xBEEF));
}
int EatYams_Handler3(int a)
{
ADD_STATE(State_EatYams_Handler3_Called(a));
RETURN_META_VALUE(MRES_IGNORED, 0);
}
namespace N_TestBail
{
bool TestBail2(std::string &error)
{
g_PLID = 2;
SH_ADD_HOOK(IGaben, EatYams, g_Gabgab, SH_STATIC(EatYams_Handler2), false);
SH_ADD_HOOK(IGaben, EatYams, g_Gabgab, SH_STATIC(EatYams_Handler3), false);
int ret = g_Gabgab->EatYams(0xDEAD);
CHECK_COND(ret == 6, "Part 2.1");
return true;
}
}