Reduced scope of more variables

This commit is contained in:
Walter Julius Hennecke 2013-08-13 21:45:20 +02:00
parent 1059d56e85
commit 5a78efe9cf
2 changed files with 19 additions and 17 deletions

View file

@ -425,7 +425,6 @@ custom explosion effect/sound?
void SP_misc_model_breakable( gentity_t *ent )
{
char damageModel[MAX_QPATH];
int32_t len = 0;
entityShared_t* eShared = &ent->r;
entityState_t* eState = &ent->s;
@ -455,7 +454,7 @@ void SP_misc_model_breakable( gentity_t *ent )
if(ent->model2 == NULL) {
len = strlen( ent->model ) - 4;
int32_t len = strlen( ent->model ) - 4;
strncpy( damageModel, ent->model, len );
damageModel[len] = 0; //chop extension
}
@ -541,12 +540,12 @@ void ammo_fade_out( gentity_t *ent )
//! Think function for the ammo station
void ammo_think( gentity_t *ent )
{
int32_t dif = 0;
int32_t i = 0;
// Still has ammo to give
if ( ent->enemy && ent->enemy->client )
{
int32_t i = 0;
//assume that we'll finish here, if we don't, it will be overridden
ent->use = ammo_use;
ent->think = 0;//qvm complains about using NULL
@ -556,7 +555,7 @@ void ammo_think( gentity_t *ent )
if ( (ent->enemy->client->ps.stats[STAT_WEAPONS]&( 1 << i )) ) {
//has this weapon
dif = Max_Weapon(i) - ent->enemy->client->ps.ammo[i];//needs ammo?
int32_t dif = Max_Weapon(i) - ent->enemy->client->ps.ammo[i];//needs ammo?
if (dif > 2 ) {
dif= 2;
@ -595,8 +594,6 @@ void ammo_think( gentity_t *ent )
//! use function for a ammo station
void ammo_use( gentity_t *self, gentity_t *other, gentity_t *activator)
{
int32_t dif = 0;
int32_t i = 0;
if (self->think != NULL) {
if (self->use != NULL) {
@ -605,6 +602,9 @@ void ammo_use( gentity_t *self, gentity_t *other, gentity_t *activator)
}
} else {
if ( other && other->client ) {
int32_t i = 0;
int32_t dif = 0;
for ( ; i < WP_NUM_WEAPONS && dif == 0; i++ ) {
//go through all weapons

View file

@ -1206,8 +1206,6 @@ char* G_Client_Connect( int32_t clientNum, qboolean firstTime, qboolean isBot )
gentity_t* ent = NULL;
vmCvar_t mapname;
vmCvar_t sv_hostname;
int32_t tmpScore = 0; //Without these, tonnes of proverbial shyte hits the fan if a bot connects O_o
int32_t i = 0;
qboolean changeRank = qfalse;
ent = &g_entities[ clientNum ];
@ -1247,6 +1245,7 @@ char* G_Client_Connect( int32_t clientNum, qboolean firstTime, qboolean isBot )
if ( rpg_uniqueNames.integer != 0 && !isBot ) {
char name[36];
char oldName[36];
int32_t i = 0;
memset(name, 0, sizeof(name));
memset(oldName, 0, sizeof(oldName));
@ -1304,6 +1303,8 @@ char* G_Client_Connect( int32_t clientNum, qboolean firstTime, qboolean isBot )
client->sess.sessionClass = 0;
client->ps.persistant[PERS_SCORE] = 1;
} else {
int32_t tmpScore = 0;
newClass = Info_ValueForKey (userinfo, "ui_playerClass" );
newRank = Info_ValueForKey (userinfo, "ui_playerRank" );
@ -2518,11 +2519,12 @@ static void G_Client_LocationsMessage( gentity_t *ent ) {
//TiM - Modified to work with RPG-X
void G_Client_CheckClientStatus(void) {
int32_t i = 0;
gentity_t* loc = NULL;
gentity_t* ent = NULL;
if (level.time - level.lastTeamLocationTime > TEAM_LOCATION_UPDATE_TIME) {
int32_t i = 0;
level.lastTeamLocationTime = level.time;
for ( ; i < g_maxclients.integer; i++) {
@ -2659,10 +2661,8 @@ FIXME: for elimination, the last man standing must be ranked first
============
*/
void G_Client_CalculateRanks( qboolean fromExit ) {
int i;
int rank;
int score;
int newScore;
int32_t i = 0;
gclient_t *cl;
level.follow1 = -1;
@ -2671,7 +2671,7 @@ void G_Client_CalculateRanks( qboolean fromExit ) {
level.numNonSpectatorClients = 0;
level.numPlayingClients = 0;
level.numVotingClients = 0; // don't count bots
for ( i = 0 ; i < level.maxclients ; i++ ) {
for ( ; i < level.maxclients ; i++ ) {
if ( level.clients[i].pers.connected != CON_DISCONNECTED ) {
level.sortedClients[level.numConnectedClients] = i;
level.numConnectedClients++;
@ -2712,9 +2712,11 @@ void G_Client_CalculateRanks( qboolean fromExit ) {
}
}
} else {
rank = -1;
score = 0;
int32_t rank = -1;
int32_t score = 0;
for ( i = 0; i < level.numPlayingClients; i++ ) {
int32_t newScore = 0;
cl = &level.clients[ level.sortedClients[i] ];
newScore = cl->ps.persistant[PERS_SCORE];
if ( i == 0 || newScore != score ) {