[quake3-commits] r2364 - trunk/code/game

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Nov 20 17:51:48 EST 2012


Author: ztm
Date: 2012-11-20 17:51:48 -0500 (Tue, 20 Nov 2012)
New Revision: 2364

Modified:
   trunk/code/game/g_cmds.c
Log:
Changes suggested by DevHC:
- Remove "!target" checks from tell, vtell, and gc commands. Target was just set, cannot be NULL.
- Validate "order" in gc command before "player id."

Modified: trunk/code/game/g_cmds.c
===================================================================
--- trunk/code/game/g_cmds.c	2012-11-20 03:34:16 UTC (rev 2363)
+++ trunk/code/game/g_cmds.c	2012-11-20 22:51:48 UTC (rev 2364)
@@ -955,7 +955,7 @@
 	}
 
 	target = &g_entities[targetNum];
-	if ( !target || !target->inuse || !target->client ) {
+	if ( !target->inuse || !target->client ) {
 		return;
 	}
 
@@ -1081,7 +1081,7 @@
 	}
 
 	target = &g_entities[targetNum];
-	if ( !target || !target->inuse || !target->client ) {
+	if ( !target->inuse || !target->client ) {
 		return;
 	}
 
@@ -1195,6 +1195,14 @@
 		return;
 	}
 
+	trap_Argv( 2, arg, sizeof( arg ) );
+	order = atoi( arg );
+
+	if ( order < 0 || order >= numgc_orders ) {
+		trap_SendServerCommand( ent-g_entities, va("print \"Bad order: %i\n\"", order));
+		return;
+	}
+
 	trap_Argv( 1, arg, sizeof( arg ) );
 	targetNum = ClientNumberFromString( ent, arg );
 	if ( targetNum == -1 ) {
@@ -1202,18 +1210,10 @@
 	}
 
 	target = &g_entities[targetNum];
-	if ( !target || !target->inuse || !target->client ) {
+	if ( !target->inuse || !target->client ) {
 		return;
 	}
 
-	trap_Argv( 2, arg, sizeof( arg ) );
-	order = atoi( arg );
-
-	if ( order < 0 || order >= numgc_orders ) {
-		trap_SendServerCommand( ent-g_entities, va("print \"Bad order: %i\n\"", order));
-		return;
-	}
-
 	G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, gc_orders[order] );
 	G_Say( ent, target, SAY_TELL, gc_orders[order] );
 	// don't tell to the player self if it was already directed to this player



More information about the quake3-commits mailing list