Fix some misprints and mistakes in code, part 2 (#1021)

* Fix compiler warnings about broken syntax

Revert "Fix compiler warnings about broken syntax"

This reverts commit cd0649806feaab064e93a0fbcd1f4488747f9b79.

Unbreak code

* Unbreak code

* Stop breaking code, please

* Small real unused check

* Fix "breaked" code and fix MAX_WEAPONS misprints

* Compiler break in debug mode if passing upper case strings
This commit is contained in:
Unreal Karaulov 2021-12-03 08:24:15 +03:00 committed by GitHub
parent e8909c1583
commit f8ac58c839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 24 additions and 97 deletions

View File

@ -70,7 +70,7 @@ static ucell hex2long(char *s,char **n)
s++; s++;
} /* if */ } /* if */
assert((*s>='0' && *s<='9') || (*s>='a' && *s<='f') || (*s>='a' && *s<='f')); assert((*s>='0' && *s<='9') || (*s>='a' && *s<='f') || (*s>='A' && *s<='F'));
for ( ;; ) { for ( ;; ) {
if (*s>='0' && *s<='9') if (*s>='0' && *s<='9')
digit=*s-'0'; digit=*s-'0';

View File

@ -434,7 +434,7 @@ void CPlayer::WeaponsCheck(int weapons)
int old; int old;
int cur; int cur;
for(int i = 1; i < MAX_WEAPONS; ++i) for(int i = 1; i < DODMAX_WEAPONS; ++i)
{ {
// Check to see we are not talking about a grenade and we have changed // Check to see we are not talking about a grenade and we have changed
if(i != 13 && i != 14 && i != 15 && i != 16 && i != 36) if(i != 13 && i != 14 && i != 15 && i != 16 && i != 36)

View File

@ -263,7 +263,7 @@ static cell AMX_NATIVE_CALL dod_weapon_type(AMX *amx, cell *params) /* 2 params
{ {
int weaponsbit = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element int weaponsbit = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element
for(int x = 1; x < MAX_WEAPONS; ++x) for(int x = 1; x < DODMAX_WEAPONS; ++x)
{ {
if((weaponsbit&(1<<x)) > 0) if((weaponsbit&(1<<x)) > 0)
{ {

View File

@ -222,7 +222,7 @@ void Client_AmmoX(void* mValue)
case 1: case 1:
if (!mPlayer ) if (!mPlayer )
break; break;
for(int i = 1; i < MAX_WEAPONS ; ++i) for(int i = 1; i < DODMAX_WEAPONS ; ++i)
{ {
if (iAmmo == weaponData[i].ammoSlot) if (iAmmo == weaponData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue; mPlayer->weapons[i].ammo = *(int*)mValue;
@ -244,7 +244,7 @@ void Client_AmmoShort(void* mValue)
if(!mPlayer ) if(!mPlayer )
break; break;
for(int i = 1; i < MAX_WEAPONS ; ++i) for(int i = 1; i < DODMAX_WEAPONS ; ++i)
{ {
if (iAmmo == weaponData[i].ammoSlot) if (iAmmo == weaponData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue; mPlayer->weapons[i].ammo = *(int*)mValue;

View File

@ -34,31 +34,26 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
{ {
gfm_tr->fAllSolid = *ptr; gfm_tr->fAllSolid = *ptr;
return 1; return 1;
break;
} }
case TR_StartSolid: case TR_StartSolid:
{ {
gfm_tr->fStartSolid = *ptr; gfm_tr->fStartSolid = *ptr;
return 1; return 1;
break;
} }
case TR_InOpen: case TR_InOpen:
{ {
gfm_tr->fInOpen = *ptr; gfm_tr->fInOpen = *ptr;
return 1; return 1;
break;
} }
case TR_InWater: case TR_InWater:
{ {
gfm_tr->fInWater = *ptr; gfm_tr->fInWater = *ptr;
return 1; return 1;
break;
} }
case TR_flFraction: case TR_flFraction:
{ {
gfm_tr->flFraction = amx_ctof(*ptr); gfm_tr->flFraction = amx_ctof(*ptr);
return 1; return 1;
break;
} }
case TR_vecEndPos: case TR_vecEndPos:
{ {
@ -66,13 +61,11 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
gfm_tr->vecEndPos.y = amx_ctof(ptr[1]); gfm_tr->vecEndPos.y = amx_ctof(ptr[1]);
gfm_tr->vecEndPos.z = amx_ctof(ptr[2]); gfm_tr->vecEndPos.z = amx_ctof(ptr[2]);
return 1; return 1;
break;
} }
case TR_flPlaneDist: case TR_flPlaneDist:
{ {
gfm_tr->flPlaneDist = amx_ctof(*ptr); gfm_tr->flPlaneDist = amx_ctof(*ptr);
return 1; return 1;
break;
} }
case TR_vecPlaneNormal: case TR_vecPlaneNormal:
{ {
@ -80,7 +73,6 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
gfm_tr->vecPlaneNormal.y = amx_ctof(ptr[1]); gfm_tr->vecPlaneNormal.y = amx_ctof(ptr[1]);
gfm_tr->vecPlaneNormal.z = amx_ctof(ptr[2]); gfm_tr->vecPlaneNormal.z = amx_ctof(ptr[2]);
return 1; return 1;
break;
} }
case TR_pHit: case TR_pHit:
{ {
@ -96,15 +88,13 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
{ {
gfm_tr->iHitgroup = *ptr; gfm_tr->iHitgroup = *ptr;
return 1; return 1;
break;
} }
default: }
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]); MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0; return 0;
} }
}
}
static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
{ {
@ -116,29 +106,24 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
case TR_AllSolid: case TR_AllSolid:
{ {
return gfm_tr->fAllSolid; return gfm_tr->fAllSolid;
break;
} }
case TR_StartSolid: case TR_StartSolid:
{ {
return gfm_tr->fStartSolid; return gfm_tr->fStartSolid;
break;
} }
case TR_InOpen: case TR_InOpen:
{ {
return gfm_tr->fInOpen; return gfm_tr->fInOpen;
break;
} }
case TR_InWater: case TR_InWater:
{ {
return gfm_tr->fInWater; return gfm_tr->fInWater;
break;
} }
case TR_flFraction: case TR_flFraction:
{ {
ptr = MF_GetAmxAddr(amx, params[2]); ptr = MF_GetAmxAddr(amx, params[2]);
*ptr = amx_ftoc(gfm_tr->flFraction); *ptr = amx_ftoc(gfm_tr->flFraction);
return 1; return 1;
break;
} }
case TR_vecEndPos: case TR_vecEndPos:
{ {
@ -147,14 +132,12 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
ptr[1] = amx_ftoc(gfm_tr->vecEndPos.y); ptr[1] = amx_ftoc(gfm_tr->vecEndPos.y);
ptr[2] = amx_ftoc(gfm_tr->vecEndPos.z); ptr[2] = amx_ftoc(gfm_tr->vecEndPos.z);
return 1; return 1;
break;
} }
case TR_flPlaneDist: case TR_flPlaneDist:
{ {
ptr = MF_GetAmxAddr(amx, params[2]); ptr = MF_GetAmxAddr(amx, params[2]);
*ptr = amx_ftoc(gfm_tr->flPlaneDist); *ptr = amx_ftoc(gfm_tr->flPlaneDist);
return 1; return 1;
break;
} }
case TR_vecPlaneNormal: case TR_vecPlaneNormal:
{ {
@ -163,27 +146,22 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
ptr[1] = amx_ftoc(gfm_tr->vecPlaneNormal.y); ptr[1] = amx_ftoc(gfm_tr->vecPlaneNormal.y);
ptr[2] = amx_ftoc(gfm_tr->vecPlaneNormal.z); ptr[2] = amx_ftoc(gfm_tr->vecPlaneNormal.z);
return 1; return 1;
break;
} }
case TR_pHit: case TR_pHit:
{ {
if (FNullEnt(gfm_tr->pHit)) if (FNullEnt(gfm_tr->pHit))
return -1; return -1;
return ENTINDEX(gfm_tr->pHit); return ENTINDEX(gfm_tr->pHit);
break;
} }
case TR_iHitgroup: case TR_iHitgroup:
{ {
return gfm_tr->iHitgroup; return gfm_tr->iHitgroup;
break;
} }
default: }
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]); MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0; return 0;
} }
}
}
AMX_NATIVE_INFO tr_Natives[] = AMX_NATIVE_INFO tr_Natives[] =
{ {

View File

@ -48,31 +48,26 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
{ {
tr->fAllSolid = *ptr; tr->fAllSolid = *ptr;
return 1; return 1;
break;
} }
case TR_InOpen: case TR_InOpen:
{ {
tr->fInOpen = *ptr; tr->fInOpen = *ptr;
return 1; return 1;
break;
} }
case TR_StartSolid: case TR_StartSolid:
{ {
tr->fStartSolid = *ptr; tr->fStartSolid = *ptr;
return 1; return 1;
break;
} }
case TR_InWater: case TR_InWater:
{ {
tr->fInWater = *ptr; tr->fInWater = *ptr;
return 1; return 1;
break;
} }
case TR_flFraction: case TR_flFraction:
{ {
tr->flFraction = amx_ctof(*ptr); tr->flFraction = amx_ctof(*ptr);
return 1; return 1;
break;
} }
case TR_vecEndPos: case TR_vecEndPos:
{ {
@ -80,13 +75,11 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
tr->vecEndPos.y = amx_ctof(ptr[1]); tr->vecEndPos.y = amx_ctof(ptr[1]);
tr->vecEndPos.z = amx_ctof(ptr[2]); tr->vecEndPos.z = amx_ctof(ptr[2]);
return 1; return 1;
break;
} }
case TR_flPlaneDist: case TR_flPlaneDist:
{ {
tr->flPlaneDist = amx_ctof(*ptr); tr->flPlaneDist = amx_ctof(*ptr);
return 1; return 1;
break;
} }
case TR_vecPlaneNormal: case TR_vecPlaneNormal:
{ {
@ -94,7 +87,6 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
tr->vecPlaneNormal.y = amx_ctof(ptr[1]); tr->vecPlaneNormal.y = amx_ctof(ptr[1]);
tr->vecPlaneNormal.z = amx_ctof(ptr[2]); tr->vecPlaneNormal.z = amx_ctof(ptr[2]);
return 1; return 1;
break;
} }
case TR_pHit: case TR_pHit:
{ {
@ -110,14 +102,10 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
{ {
tr->iHitgroup = *ptr; tr->iHitgroup = *ptr;
return 1; return 1;
break;
} }
default: }
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]); MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0;
}
}
return 0; return 0;
} }
@ -137,29 +125,24 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params)
case TR_AllSolid: case TR_AllSolid:
{ {
return tr->fAllSolid; return tr->fAllSolid;
break;
} }
case TR_InOpen: case TR_InOpen:
{ {
return tr->fInOpen; return tr->fInOpen;
break;
} }
case TR_StartSolid: case TR_StartSolid:
{ {
return tr->fStartSolid; return tr->fStartSolid;
break;
} }
case TR_InWater: case TR_InWater:
{ {
return tr->fInWater; return tr->fInWater;
break;
} }
case TR_flFraction: case TR_flFraction:
{ {
ptr = MF_GetAmxAddr(amx, params[3]); ptr = MF_GetAmxAddr(amx, params[3]);
*ptr = amx_ftoc(tr->flFraction); *ptr = amx_ftoc(tr->flFraction);
return 1; return 1;
break;
} }
case TR_vecEndPos: case TR_vecEndPos:
{ {
@ -168,14 +151,12 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params)
ptr[1] = amx_ftoc(tr->vecEndPos.y); ptr[1] = amx_ftoc(tr->vecEndPos.y);
ptr[2] = amx_ftoc(tr->vecEndPos.z); ptr[2] = amx_ftoc(tr->vecEndPos.z);
return 1; return 1;
break;
} }
case TR_flPlaneDist: case TR_flPlaneDist:
{ {
ptr = MF_GetAmxAddr(amx, params[3]); ptr = MF_GetAmxAddr(amx, params[3]);
*ptr = amx_ftoc(tr->flPlaneDist); *ptr = amx_ftoc(tr->flPlaneDist);
return 1; return 1;
break;
} }
case TR_vecPlaneNormal: case TR_vecPlaneNormal:
{ {
@ -184,26 +165,20 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params)
ptr[1] = amx_ftoc(tr->vecPlaneNormal.y); ptr[1] = amx_ftoc(tr->vecPlaneNormal.y);
ptr[2] = amx_ftoc(tr->vecPlaneNormal.z); ptr[2] = amx_ftoc(tr->vecPlaneNormal.z);
return 1; return 1;
break;
} }
case TR_pHit: case TR_pHit:
{ {
if (FNullEnt(tr->pHit)) if (FNullEnt(tr->pHit))
return -1; return -1;
return ENTINDEX(tr->pHit); return ENTINDEX(tr->pHit);
break;
} }
case TR_iHitgroup: case TR_iHitgroup:
{ {
return tr->iHitgroup; return tr->iHitgroup;
break;
} }
default: }
{
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]); MF_LogError(amx, AMX_ERR_NATIVE, "Unknown TraceResult member %d", params[2]);
return 0;
}
}
return 0; return 0;
} }
@ -221,7 +196,6 @@ static cell AMX_NATIVE_CALL get_kvd(AMX *amx, cell *params)
case KV_fHandled: case KV_fHandled:
{ {
return kvd->fHandled; return kvd->fHandled;
break;
} }
case KV_ClassName: case KV_ClassName:
{ {
@ -232,7 +206,6 @@ static cell AMX_NATIVE_CALL get_kvd(AMX *amx, cell *params)
} }
cell *ptr = MF_GetAmxAddr(amx, params[4]); cell *ptr = MF_GetAmxAddr(amx, params[4]);
return MF_SetAmxString(amx, params[3], kvd->szClassName, (int)*ptr); return MF_SetAmxString(amx, params[3], kvd->szClassName, (int)*ptr);
break;
} }
case KV_KeyName: case KV_KeyName:
{ {
@ -243,7 +216,6 @@ static cell AMX_NATIVE_CALL get_kvd(AMX *amx, cell *params)
} }
cell *ptr = MF_GetAmxAddr(amx, params[4]); cell *ptr = MF_GetAmxAddr(amx, params[4]);
return MF_SetAmxString(amx, params[3], kvd->szKeyName, (int)*ptr); return MF_SetAmxString(amx, params[3], kvd->szKeyName, (int)*ptr);
break;
} }
case KV_Value: case KV_Value:
{ {
@ -254,7 +226,6 @@ static cell AMX_NATIVE_CALL get_kvd(AMX *amx, cell *params)
} }
cell *ptr = MF_GetAmxAddr(amx, params[4]); cell *ptr = MF_GetAmxAddr(amx, params[4]);
return MF_SetAmxString(amx, params[3], kvd->szValue, (int)*ptr); return MF_SetAmxString(amx, params[3], kvd->szValue, (int)*ptr);
break;
} }
} }
@ -301,28 +272,24 @@ static cell AMX_NATIVE_CALL set_kvd(AMX *amx, cell *params)
{ {
kvd->fHandled = (int)*ptr; kvd->fHandled = (int)*ptr;
return 1; return 1;
break;
} }
case KV_ClassName: case KV_ClassName:
{ {
kvdw->cls = MF_GetAmxString(amx, params[3], 0, &len); kvdw->cls = MF_GetAmxString(amx, params[3], 0, &len);
kvd->szClassName = const_cast<char *>(kvdw->cls.chars()); kvd->szClassName = const_cast<char *>(kvdw->cls.chars());
return 1; return 1;
break;
} }
case KV_KeyName: case KV_KeyName:
{ {
kvdw->key = MF_GetAmxString(amx, params[3], 0, &len); kvdw->key = MF_GetAmxString(amx, params[3], 0, &len);
kvd->szKeyName = const_cast<char *>(kvdw->key.chars()); kvd->szKeyName = const_cast<char *>(kvdw->key.chars());
return 1; return 1;
break;
} }
case KV_Value: case KV_Value:
{ {
kvdw->val = MF_GetAmxString(amx, params[3], 0, &len); kvdw->val = MF_GetAmxString(amx, params[3], 0, &len);
kvd->szValue = const_cast<char *>(kvdw->val.chars()); kvd->szValue = const_cast<char *>(kvdw->val.chars());
return 1; return 1;
break;
} }
} }

View File

@ -81,7 +81,6 @@ static cell AMX_NATIVE_CALL fm_return(AMX *amx, cell *params)
default: default:
{ {
return 0; return 0;
break;
} }
} }

View File

@ -277,7 +277,6 @@ static cell AMX_NATIVE_CALL SQL_ReadResult(AMX *amx, cell *params)
{ {
int num = row->GetInt(col); int num = row->GetInt(col);
return num; return num;
break;
} }
default: default:
{ {

View File

@ -247,7 +247,6 @@ static cell AMX_NATIVE_CALL dbi_field(AMX *amx, cell *params)
case 2: case 2:
{ {
return atoi(data); return atoi(data);
break;
} }
case 3: case 3:
{ {
@ -255,12 +254,10 @@ static cell AMX_NATIVE_CALL dbi_field(AMX *amx, cell *params)
REAL fdata = atof(data); REAL fdata = atof(data);
*destaddr = amx_ftoc(fdata); *destaddr = amx_ftoc(fdata);
return 1; return 1;
break;
} }
case 4: case 4:
{ {
return MF_SetAmxString(amx, params[3], data, params[4]); return MF_SetAmxString(amx, params[3], data, params[4]);
break;
} }
} }
@ -315,7 +312,6 @@ static cell AMX_NATIVE_CALL dbi_result(AMX *amx, cell *params)
case 2: case 2:
{ {
return atoi(data); return atoi(data);
break;
} }
case 3: case 3:
{ {
@ -323,12 +319,10 @@ static cell AMX_NATIVE_CALL dbi_result(AMX *amx, cell *params)
REAL fdata = atof(data); REAL fdata = atof(data);
*destaddr = amx_ftoc(fdata); *destaddr = amx_ftoc(fdata);
return 1; return 1;
break;
} }
case 4: case 4:
{ {
return MF_SetAmxString(amx, params[3], data, params[4]); return MF_SetAmxString(amx, params[3], data, params[4]);
break;
} }
} }

View File

@ -115,20 +115,17 @@ static cell nvault_get(AMX *amx, cell *params)
case 2: case 2:
{ {
return atoi(val); return atoi(val);
break;
} }
case 3: case 3:
{ {
cell *fAddr = MF_GetAmxAddr(amx, params[3]); cell *fAddr = MF_GetAmxAddr(amx, params[3]);
*fAddr = amx_ftoc((REAL)atof(val)); *fAddr = amx_ftoc((REAL)atof(val));
return 1; return 1;
break;
} }
case 4: case 4:
{ {
len = *(MF_GetAmxAddr(amx, params[4])); len = *(MF_GetAmxAddr(amx, params[4]));
return MF_SetAmxString(amx, params[3], val, len); return MF_SetAmxString(amx, params[3], val, len);
break;
} }
} }

View File

@ -654,7 +654,7 @@ int RegEx::Replace(char *text, size_t textMaxLen, const char *replace, size_t re
* $nn or ${nn} * $nn or ${nn}
* ^ ^ * ^ ^
*/ */
if (*walk && *walk >= '0' && *walk <= '9') if (*walk >= '0' && *walk <= '9')
{ {
backref = backref * 10 + *walk - '0'; backref = backref * 10 + *walk - '0';
++walk; ++walk;

View File

@ -273,7 +273,6 @@ static cell AMX_NATIVE_CALL SQL_ReadResult(AMX *amx, cell *params)
{ {
int num = row->GetInt(col); int num = row->GetInt(col);
return num; return num;
break;
} }
default: default:
{ {

View File

@ -245,7 +245,6 @@ static cell AMX_NATIVE_CALL dbi_field(AMX *amx, cell *params)
case 2: case 2:
{ {
return atoi(data); return atoi(data);
break;
} }
case 3: case 3:
{ {
@ -253,12 +252,10 @@ static cell AMX_NATIVE_CALL dbi_field(AMX *amx, cell *params)
REAL fdata = atof(data); REAL fdata = atof(data);
*destaddr = amx_ftoc(fdata); *destaddr = amx_ftoc(fdata);
return 1; return 1;
break;
} }
case 4: case 4:
{ {
return MF_SetAmxString(amx, params[3], data, params[4]); return MF_SetAmxString(amx, params[3], data, params[4]);
break;
} }
} }
@ -309,7 +306,6 @@ static cell AMX_NATIVE_CALL dbi_result(AMX *amx, cell *params)
case 2: case 2:
{ {
return atoi(data); return atoi(data);
break;
} }
case 3: case 3:
{ {
@ -317,12 +313,10 @@ static cell AMX_NATIVE_CALL dbi_result(AMX *amx, cell *params)
REAL fdata = atof(data); REAL fdata = atof(data);
*destaddr = amx_ftoc(fdata); *destaddr = amx_ftoc(fdata);
return 1; return 1;
break;
} }
case 4: case 4:
{ {
return MF_SetAmxString(amx, params[3], data, params[4]); return MF_SetAmxString(amx, params[3], data, params[4]);
break;
} }
} }

View File

@ -161,10 +161,10 @@ struct CPlayer {
int clip; int clip;
}; };
PlayerWeapon weapons[MAX_WEAPONS]; PlayerWeapon weapons[TFCMAX_WEAPONS];
PlayerWeapon attackers[33]; PlayerWeapon attackers[33];
PlayerWeapon victims[33]; PlayerWeapon victims[33];
Stats weaponsRnd[MAX_WEAPONS]; // DEC-Weapon (Round) stats Stats weaponsRnd[TFCMAX_WEAPONS]; // DEC-Weapon (Round) stats
Stats life; Stats life;
int teamId; int teamId;

View File

@ -46,7 +46,7 @@ void Client_WeaponList(void* mValue){
break; break;
case 7: case 7:
int iId = *(int*)mValue; int iId = *(int*)mValue;
if ( (iId < 0 || iId >= MAX_WEAPONS ) || ( wpnList & (1<<iId) ) ) if ( (iId < 0 || iId >= TFCMAX_WEAPONS ) || ( wpnList & (1<<iId) ) )
break; break;
wpnList |= (1<<iId); wpnList |= (1<<iId);
@ -340,7 +340,7 @@ void Client_AmmoX(void* mValue){
} }
// //
for(int i = 1; i < MAX_WEAPONS ; ++i) for(int i = 1; i < TFCMAX_WEAPONS ; ++i)
if (iAmmo == weaponData[i].ammoSlot) if (iAmmo == weaponData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue; mPlayer->weapons[i].ammo = *(int*)mValue;
} }
@ -355,7 +355,7 @@ void Client_AmmoPickup(void* mValue){
break; break;
case 1: case 1:
if (!mPlayer ) break; if (!mPlayer ) break;
for(int i = 1; i < MAX_WEAPONS ; ++i) for(int i = 1; i < TFCMAX_WEAPONS ; ++i)
if (weaponData[i].ammoSlot == iSlot) if (weaponData[i].ammoSlot == iSlot)
mPlayer->weapons[i].ammo += *(int*)mValue; mPlayer->weapons[i].ammo += *(int*)mValue;
} }