mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
Fixes resulting from code analysis
This commit is contained in:
parent
181e463cbf
commit
51430fec77
8 changed files with 602 additions and 1718 deletions
|
@ -300,6 +300,10 @@ static void Cmd_Give_f( gentity_t *ent ) {
|
|||
for ( i = bg_numGiveItems - 1; i > -1; i-- ) {
|
||||
item = &bg_giveItem[i];
|
||||
|
||||
if(item == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Q_stricmp( arg, item->consoleName ) ) {
|
||||
break;
|
||||
}
|
||||
|
@ -317,6 +321,10 @@ static void Cmd_Give_f( gentity_t *ent ) {
|
|||
|
||||
//Fuck this. Why does ioEF crash if you don't break a case statement with code in it? :S
|
||||
|
||||
if(item == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( item->giveType ) {
|
||||
case TYPE_ALL:
|
||||
targEnt->health = ps->stats[STAT_MAX_HEALTH];
|
||||
|
@ -1566,17 +1574,18 @@ static void Cmd_SayArea( gentity_t *ent, char* text)
|
|||
|
||||
OtherPlayer = &g_entities[i]; //Point OtherPlayer to next player
|
||||
|
||||
//Send message to admins warning about command being used.
|
||||
//TiM - since double spamming is annoying, ensure that the target admin wants this alert
|
||||
if ( !OtherPlayer->client->noAdminChat )
|
||||
G_SayTo( ent, OtherPlayer, SAY_ADMIN, COLOR_CYAN, va("%s ^7said to area: ", pers->netname ), text ); //^2%s
|
||||
|
||||
//Check is OtherPlayer is valid
|
||||
if ( !OtherPlayer || !OtherPlayer->inuse || !OtherPlayer->client )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Send message to admins warning about command being used.
|
||||
//TiM - since double spamming is annoying, ensure that the target admin wants this alert
|
||||
if ( !OtherPlayer->client->noAdminChat )
|
||||
G_SayTo( ent, OtherPlayer, SAY_ADMIN, COLOR_CYAN, va("%s ^7said to area: ", pers->netname ), text ); //^2%s
|
||||
|
||||
|
||||
//TiM - I have a better solution. the trap_inPVS function lets u see if two points are within the same Vis cluster
|
||||
//in the BSP tree. That should mean as long as they're in the same room, regardless if they can see each other or not,
|
||||
//they'll get the message
|
||||
|
@ -2220,6 +2229,10 @@ static void Cmd_ForceKill_f( gentity_t *ent ) {
|
|||
}
|
||||
} // end iterations
|
||||
|
||||
if(target == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Com_sprintf (send, sizeof(send), "%s ^7forced %s^7's death", ent->client->pers.netname, target->client->pers.netname);
|
||||
|
||||
for (j = 0; j < MAX_CLIENTS - 1; j++) {
|
||||
|
@ -3725,7 +3738,7 @@ static void Cmd_EntList_f ( gentity_t *ent ) {
|
|||
Com_sprintf( entBuffer, sizeof( entBuffer ), "ClassName: '%s', ID: %i\n", mapEnt->classname, i);
|
||||
}
|
||||
|
||||
if ( strlen(mainBuffer) + strlen(entBuffer) > sizeof( mainBuffer ) ) {
|
||||
if ( strlen(mainBuffer) + strlen(entBuffer) >= sizeof( mainBuffer ) ) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
@ -5262,7 +5275,7 @@ static void Cmd_MapsList_f( gentity_t *ent )
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( strlen(mapList) + len + 20 > sizeof( mapList ) )
|
||||
if ( strlen(mapList) + len + 20 >= sizeof( mapList ) )
|
||||
break;
|
||||
|
||||
Q_strcat( mapList, sizeof( mapList ), filePtr );
|
||||
|
|
|
@ -1113,7 +1113,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
|
|||
|
||||
if ( client )
|
||||
{
|
||||
if ( client->noclip ) {
|
||||
if ( client == NULL || client->noclip ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2621,6 +2621,7 @@ void G_RunThink (gentity_t *ent) {
|
|||
ent->nextthink = 0;
|
||||
if (!ent->think) {
|
||||
G_Error ( "NULL ent->think");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G_LUA
|
||||
|
|
|
@ -607,10 +607,12 @@ void Svcmd_EntityList_f (void) {
|
|||
gentity_t *check;
|
||||
char arg[MAX_QPATH*4];
|
||||
int length = 0;
|
||||
qboolean args = qfalse;
|
||||
|
||||
if(trap_Argc() > 1) {
|
||||
trap_Argv(1, arg, sizeof(arg));
|
||||
length = strlen(arg);
|
||||
args = qtrue;
|
||||
}
|
||||
|
||||
check = g_entities+1;
|
||||
|
@ -618,7 +620,7 @@ void Svcmd_EntityList_f (void) {
|
|||
if ( !check->inuse ) {
|
||||
continue;
|
||||
}
|
||||
if(!arg[0]) {
|
||||
if(args == qfalse) {
|
||||
if ( check->classname && Q_stricmpn(check->classname, "noclass", 7) && Q_stricmpn(check->classname, "bodyque", 7) ) {
|
||||
G_Printf("%3i:", e);
|
||||
switch ( check->s.eType ) {
|
||||
|
|
|
@ -1644,6 +1644,10 @@ void SP_target_turbolift ( gentity_t *self )
|
|||
char mapRoute[MAX_QPATH];
|
||||
char serverInfo[MAX_TOKEN_CHARS];
|
||||
|
||||
if(self == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
//cache the moving sounds
|
||||
G_SpawnString( "soundLoop", "sound/movers/plats/turbomove.wav", &loopSound );
|
||||
G_SpawnString( "soundEnd", "sound/movers/plats/turbostop.wav", &endSound );
|
||||
|
|
|
@ -364,7 +364,7 @@ void Use_target_push( gentity_t *self, gentity_t *other, gentity_t *activator )
|
|||
}
|
||||
|
||||
/* RPG-X: J2J noclip use */
|
||||
if ( activator->client->ps.pm_type != PM_NORMAL || activator->client->ps.pm_type != PM_NOCLIP) {
|
||||
if ( (activator->client->ps.pm_type != PM_NORMAL) || (activator->client->ps.pm_type != PM_NOCLIP)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -918,6 +918,10 @@ char *Q_CleanStr( char *string ) {
|
|||
char* s;
|
||||
int c;
|
||||
|
||||
if(string == NULL) {
|
||||
return string;
|
||||
}
|
||||
|
||||
s = string;
|
||||
d = string;
|
||||
while ((c = *s) != 0 ) {
|
||||
|
|
Loading…
Reference in a new issue