1.1 --- a/extensions/tf2/holiday.cpp Fri Oct 28 11:24:08 2011 -0400
1.2 +++ b/extensions/tf2/holiday.cpp Fri Oct 28 19:07:40 2011 -0400
1.3 @@ -31,48 +31,49 @@
1.4
1.5 #include "holiday.h"
1.6
1.7 -CDetour *getHolidayDetour = NULL;
1.8 +CDetour *isHolidayDetour = NULL;
1.9
1.10 -IForward *g_getHolidayForward = NULL;
1.11 +IForward *g_isHolidayForward = NULL;
1.12
1.13 -DETOUR_DECL_STATIC0(GetHoliday, int)
1.14 +DETOUR_DECL_STATIC1(IsHolidayActive, bool, int, holiday)
1.15 {
1.16 - int actualres = DETOUR_STATIC_CALL(GetHoliday)();
1.17 - if (!g_getHolidayForward)
1.18 + bool actualres = DETOUR_STATIC_CALL(IsHolidayActive)(holiday);
1.19 + if (!g_isHolidayForward)
1.20 {
1.21 g_pSM->LogMessage(myself, "Invalid Forward");
1.22 return actualres;
1.23 }
1.24
1.25 cell_t result = 0;
1.26 - int newres = actualres;
1.27 + cell_t newres = actualres ? 1 : 0;
1.28
1.29 - g_getHolidayForward->PushCellByRef(&newres);
1.30 - g_getHolidayForward->Execute(&result);
1.31 + g_isHolidayForward->PushCell(holiday);
1.32 + g_isHolidayForward->PushCellByRef(&newres);
1.33 + g_isHolidayForward->Execute(&result);
1.34
1.35 if (result == Pl_Changed)
1.36 {
1.37 - return newres;
1.38 + return (newres == 0) ? false : true;
1.39 }
1.40
1.41 return actualres;
1.42 }
1.43
1.44 -bool InitialiseGetHolidayDetour()
1.45 +bool InitialiseIsHolidayDetour()
1.46 {
1.47 - getHolidayDetour = DETOUR_CREATE_STATIC(GetHoliday, "GetHoliday");
1.48 + isHolidayDetour = DETOUR_CREATE_STATIC(IsHolidayActive, "IsHolidayActive");
1.49
1.50 - if (getHolidayDetour != NULL)
1.51 + if (isHolidayDetour != NULL)
1.52 {
1.53 - getHolidayDetour->EnableDetour();
1.54 + isHolidayDetour->EnableDetour();
1.55 return true;
1.56 }
1.57
1.58 - g_pSM->LogError(myself, "GetHoliday detour failed");
1.59 + g_pSM->LogError(myself, "IsHolidayActive detour failed");
1.60 return false;
1.61 }
1.62
1.63 -void RemoveGetHolidayDetour()
1.64 +void RemoveIsHolidayDetour()
1.65 {
1.66 - getHolidayDetour->Destroy();
1.67 + isHolidayDetour->Destroy();
1.68 }