Enemy Territory

Project: Bug Fix

The objective

The goal of this project is to provide modders in the ET community with a SDK code base that contains fixes for various bugs which are present in the stock etmain game (version 2.60).

26th september 2006: Sadly bugfix 088 had a bug :-( There were 3 lines that should have been deleted for the fix to work correctly.

Show index
Previous bug: 'callvote' command erros could be delayed
Next bug: Cleanups in both side code 1

Bugfix 068 - Cleanups in serverside code 1

Problem:

The code is full of compiler warnings. Also there are some typos and unused code, which could be cleaned up.

Solution:

Use these changes.

Notes:

The bug is still present in version 2.60

2.56 & 2.60 Code

g_cmds.c @ 23 // send the latest information on all clients numSorted = level.numConnectedClients; if ( numSorted > MAX_CLIENTS ) { // CHRUKER: b068 - Had 64 hardcoded as the limit numSorted = MAX_CLIENTS; // CHRUKER: b068 - Had 64 hardcoded as the limit }
g_cmds.c @ 213 (2.56) @ 218 (2.60) // See if its a number or string for(idnum=0; idnum<(int)strlen(s) && s[idnum] != 0; idnum++) { // CHRUKER: b068 - Added the (int) type casting if(s[idnum] < '0' || s[idnum] > '9') { fIsNumber = qfalse;
g_cmds.c @ 2449 (2.56) @ 2467 (2.60) G_AddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 5.f ); G_DebugAddSkillPoints( ent, SK_MILITARY_INTELLIGENCE_AND_SCOPED_WEAPONS, 5.f, "stealing uniform" ); // CHRUKER: b068 - Passed 5 as integer instead of float Q_strncpyz( ent->client->disguiseNetname, g_entities[traceEnt->s.clientNum].client->pers.netname, sizeof(ent->client->disguiseNetname) );
g_cmds_ext.c @ 246 (2.56) @ 249 (2.60) return; } else { AP("print \"\n^3Match is ^5UNPAUSED^3 ... resuming in 10 seconds!\n\n\""); // CHRUKER: b068 - Had extra linebreaks, before and after. level.match_pause = PAUSE_UNPAUSING; G_globalSound("sound/osp/prepare.wav");
g_cmds_ext.c @ 571 (2.56) @ 574 (2.60) // These map to WS_* weapon indexes const unsigned int cQualifyingShots[WS_MAX] = { 10, // 0 15, // 1
g_cmds_ext.c @ 628 (2.56) @ 631 (2.60) void G_weaponStatsLeaders_cmd(gentity_t* ent, qboolean doTop, qboolean doWindow) { int i, iWeap, shots, wBestAcc, cClients, cPlaces;
unsigned shots;
int aClients[MAX_CLIENTS]; float acc;
g_cmds_ext.c @ 682 (2.56) @ 684 (2.60) void G_weaponRankings_cmd(gentity_t *ent, unsigned int dwCommand, qboolean state) { gclient_t *cl; int c = 0, i, shots, wBestAcc;
unsigned shots;
char z[MAX_STRING_CHARS];
g_local.h @ 714 (2.56) @ 715 (2.60) #define MAX_CLIENT_MARKERS 10
#define NUM_SOLDIERKILL_TIMES 10 // CHRUKER: b068 - These two are only referenced in g_stats.c and there they don't do anything #define SOLDIERKILL_MAXTIME 60000 // CHRUKER: b068 - These two are only referenced in g_stats.c and there they don't do anything
#define LT_SPECIAL_PICKUP_MOD 3 // JPW NERVE # of times (minus one for modulo) LT must drop ammo before scoring a point
g_local.h @ 814 (2.56) @ 812 (2.60) int lastConstructibleBlockingWarnEnt;
int soldierKillMarker; // CHRUKER: b068 - These two are only referenced in g_stats.c and there they don't do anything int soliderKillTimes[NUM_SOLDIERKILL_TIMES]; // CHRUKER: b068 - These two are only referenced in g_stats.c and there they don't do anything
int landmineSpottedTime;
g_referee.c @ 43 // List commands only for enabled refs. if(ent) {
// CHRUKER: b068 - This seems like a very redundant check since the function is only called // from the server console or through G_ref_cmd (the function just below). if(!ent->client->sess.referee) { CP("cpm \"Sorry, you are not a referee!\n"); return; }
CP("print \"\n^3Referee commands:^7\n\"");
g_stats.c @ 21 }
// CHRUKER: b068 - This block didn't do anything, so it has been commented out. // The variables 'soliderKillTimes', 'soldierKillMarker', 'NUM_SOLDIERKILL_TIMES', 'SOLDIERKILL_MAXTIME' // and 'pass' have also been commented out. The first 4 was defined in g_local.h if(ent->client->sess.playerType == PC_SOLDIER) { int i, j; qboolean pass = qtrue; ent->client->soliderKillTimes[ent->client->soldierKillMarker++] = level.timeCurrent; if ( ent->client->soldierKillMarker >= NUM_SOLDIERKILL_TIMES ) { ent->client->soldierKillMarker = 0; } for( i = 0, j = ent->client->soldierKillMarker; i < NUM_SOLDIERKILL_TIMES; i++ ) { if( !ent->client->soliderKillTimes[j] || (ent->client->soliderKillTimes[j] < level.timeCurrent - SOLDIERKILL_MAXTIME) ) { pass = qfalse; break; } if( ++j == NUM_SOLDIERKILL_TIMES ) { j = 0; } } }
ent->client->pers.playerStats.weaponStats[weap].kills++;
g_weapon.c @ 2620 (2.56) @ 2699 (2.60) bomb->think = artillerySpotterThink; } else {
// CHRUKER: b068 - this seems odd... if level 3 or above signal skills, do this. if not, do it anyway... if( ent->client->sess.skill[SK_SIGNALS] >= 3 ) bomb->nextthink = level.time + 8950 + 2000 * i + crandom() * 800; else
bomb->nextthink = level.time + 8950 + 2000 * i + crandom() * 800;
g_weapon.c @ 3970 (2.56) @ 4084 (2.60) if( ent->client->sess.skill[SK_HEAVY_WEAPONS] >= 1 ) {
// CHRUKER: b068 - Was using "0.5f*(1-0.3f)", however the 0.33f is used everywhere else, and is more precise
ent->client->ps.classWeaponTime += .33f * level.soldierChargeTime[ent->client->sess.sessionTeam-1]; } else { ent->client->ps.classWeaponTime += .5f * level.soldierChargeTime[ent->client->sess.sessionTeam-1];

Show index
Previous bug: 'callvote' command erros could be delayed
Next bug: Cleanups in both side code 1

Color coding

Sample = New code
Sample = Changed code (the new version is what is displayed)
Sample = Deleted code

©2017 Chruker