[TFCX] Fix Medic infection Crash on Linux (#991)

* [TFCX] Fix Medic infection Crash on Linux

Issue: #988

* [TFCX] Removed redundant code

- Added `_DEBUG_TFCX` preprocessor directive
- Deleted redundant code (which fetches pdata)
This commit is contained in:
Harsha Raghu 2021-09-17 16:29:54 +05:30 committed by GitHub
parent 10db2e5c85
commit 2c8be75057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,10 +121,23 @@ void Client_Damage(void* mValue){
if ( FNullEnt( enemy ) )
break;
#ifdef _DEBUG_TFCX
ALERT(at_logged, "Clinet_damage Called with state-%d dmg-%d Netname'%s'(Class'%s') slno-'%d'\n",
mState, damage, STRING(mPlayer->pEdict->v.netname),
STRING(mPlayer->pEdict->v.classname), mPlayer->pEdict->serialnumber);
ALERT(at_logged, " Called with enemy-slno-%d Netname:'%s'(Class'%s')\n", mPlayer->pEdict->serialnumber,
STRING(enemy->v.netname), STRING(enemy->v.classname));
#endif // _DEBUG_TFCX
if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) { // attacker is player and his active weapon
pAttacker = GET_PLAYER_POINTER(enemy);
#ifdef _DEBUG_TFCX
ALERT(at_logged, " attacker is player and his active weapon id-%d, has flags - (FL_CLIENT | FL_FAKECLIENT)\n\n", pAttacker->current);
#endif // _DEBUG_TFCX
aim = pAttacker->aiming;
weapon = pAttacker->current;
@ -150,6 +163,15 @@ void Client_Damage(void* mValue){
pAttacker = GET_PLAYER_POINTER(enemy->v.owner);
#ifdef _DEBUG_TFCX
ALERT(at_logged, " attacker is Class'%s'(with its enmy as Netname'%s'[Class'%s']) and his owner is '%s(%s)' enemy->owner has flags - FL_CLIENT | FL_FAKECLIENT\n\n",
(enemy ? STRING(enemy->v.classname) : "Null"),
(enemy->v.enemy ? STRING(enemy->v.enemy->v.netname) : "Null"),
(enemy->v.enemy ? STRING(enemy->v.enemy->v.classname) : "Null"),
(enemy->v.owner ? STRING(enemy->v.owner->v.netname) : "Null"),
(enemy->v.owner ? STRING(enemy->v.owner->v.classname) : "Null"));
#endif // _DEBUG_TFCX
const char *szClass = STRING(enemy->v.classname);
switch(szClass[10]){
@ -185,16 +207,8 @@ void Client_Damage(void* mValue){
if ( !weapon ) {
switch(szClass[3]){
case 'e':
weapon = TFC_WPN_TIMER; // TFC_WPN_MEDKIT ??
tempInt = get_pdata_ehandle(mPlayer->pEdict, pdTimerOwner * 4); // function is char-based.
if (tempInt < 1 || tempInt > gpGlobals->maxClients)
{
break;
}
pAttacker = GET_PLAYER_POINTER_I(tempInt);
weapon = TFC_WPN_TIMER; // TFC_WPN_MEDKIT ?? //ShootingKing: Class - "timer"
pAttacker = GET_PLAYER_POINTER(enemy->v.enemy);
if (pAttacker->teamId == mPlayer->teamId) // ???
{