From 6a483cfcae1ba4c78e177072dbf9fb51c4998995 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 3 Oct 2007 00:50:30 +0000 Subject: [PATCH] fixed amb291 issue --- dlls/cstrike/cstrike/cstrike.cpp | 5 ++--- dlls/cstrike/cstrike/cstrike.h | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/cstrike/cstrike/cstrike.cpp b/dlls/cstrike/cstrike/cstrike.cpp index d560817a..73597be6 100755 --- a/dlls/cstrike/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike/cstrike.cpp @@ -1719,10 +1719,9 @@ static cell AMX_NATIVE_CALL cs_get_c4_defusing(AMX* amx, cell* params) return 0; } - return *((char*)((REAL*)pC4->pvPrivateData + OFFSET_C4_DEFUSING)) ? 1 : 0; - - return 1; + return *(bool *)((char *)(pC4->pvPrivateData) + OFFSET_C4_DEFUSING) ? 1 : 0; } + static cell AMX_NATIVE_CALL cs_set_c4_defusing(AMX* amx, cell* params) { CHECK_NONPLAYER(params[1]); diff --git a/dlls/cstrike/cstrike/cstrike.h b/dlls/cstrike/cstrike/cstrike.h index 47cdd563..f89bc86a 100755 --- a/dlls/cstrike/cstrike/cstrike.h +++ b/dlls/cstrike/cstrike/cstrike.h @@ -47,9 +47,11 @@ #if defined __linux__ #define EXTRAOFFSET 5 // offsets 5 higher in Linux builds #define EXTRAOFFSET_WEAPONS 4 // weapon offsets are obviously only 4 steps higher on Linux! + #define ACTUAL_EXTRA_OFFSET 20 // actual, byte-addressable offset #else #define EXTRAOFFSET 0 // no change in Windows builds #define EXTRAOFFSET_WEAPONS 0 + #define ACTUAL_EXTRA_OFFSET 0 #endif // defined __linux__ /* Offset history: @@ -111,7 +113,7 @@ #define OFFSET_ARMOURY_TYPE 34 + EXTRAOFFSET_WEAPONS // C4 offsets #define OFFSET_C4_EXPLODE_TIME 100 + EXTRAOFFSET - #define OFFSET_C4_DEFUSING 0x60 + EXTRAOFFSET + #define OFFSET_C4_DEFUSING 0x180 + ACTUAL_EXTRA_OFFSET #else // Amd64 offsets here #define OFFSET_ARMORTYPE 137 + EXTRAOFFSET