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: stoprecord was missing from COMMANDS list
Next bug: Changed some ints to floats where they were being misused

Bugfix 013 - XP points are sometimes displayed with many decimals

Problem:

A couple of places where the server writes the XP to logs or the console, it displayed the XP with up to 8 decimals.

Solution:

Simply change the format to %.0f, so that no decimals are displayed.

Notes:

The bug is still present in version 2.60
For some reason the server game part of ET uses floats to store the XP. Integers are used in the client game, and it is what gets transmitted.

2.56 & 2.60 Code

g_stats.c @ 208 }
// CHRUKER: b013 - Was printing this with many many decimals
G_Printf( "%s just lost %.0f skill points for skill %s\n", ent->client->pers.netname, oldskillpoints - ent->client->sess.skillpoints[skill], skillNames[skill] ); trap_PbStat ( ent - g_entities , "loseskill" ,
g_stats.c @ 244 (2.56) @ 245 (2.60) level.teamScores[ ent->client->ps.persistant[PERS_TEAM] ] += points;
// CHRUKER: b013 - Was printing this with many many decimals
// G_Printf( "%s just got %.0f skill points for skill %s\n", ent->client->pers.netname, points, skillNames[skill] ); trap_PbStat ( ent - g_entities , "addskill" ,
g_stats.c @ 534 (2.56) @ 545 (2.60) return;
// CHRUKER: b013 - Was printing the float with 6.2 as max. numbers
trap_SendServerCommand( ent-g_entities, va( "sdbg \"^%c(SK: %2i XP: %.0f) %s: You raised your skill level to %i.\"\n", COLOR_RED + skill, ent->client->sess.skill[skill], ent->client->sess.skillpoints[skill], skillNames[skill], ent->client->sess.skill[skill] ) ); trap_RealTime( &ct ); if( g_debugSkills.integer >= 2 && skillDebugLog != -1 ) {
// CHRUKER: b013 - Was printing the float with 6.2 as max. numbers
char *s = va( "%02d:%02d:%02d : ^%c(SK: %2i XP: %.0f) %s: %s raised in skill level to %i.\n", ct.tm_hour, ct.tm_min, ct.tm_sec, COLOR_RED + skill, ent->client->sess.skill[skill], ent->client->sess.skillpoints[skill], skillNames[skill], ent->client->pers.netname, ent->client->sess.skill[skill] );
g_stats.c @ 554 (2.56) @ 567 (2.60) return;
// CHRUKER: b013 - Was printing the float with 6.2 as max. numbers
trap_SendServerCommand( ent-g_entities, va( "sdbg \"^%c(SK: %2i XP: %.0f) %s: You gained %.0fXP, reason: %s.\"\n", COLOR_RED + skill, ent->client->sess.skill[skill], ent->client->sess.skillpoints[skill], skillNames[skill], points, reason ) ); trap_RealTime( &ct ); if( g_debugSkills.integer >= 2 && skillDebugLog != -1 ) {
// CHRUKER: b013 - Was printing the float with 6.2 as max. numbers
char *s = va( "%02d:%02d:%02d : ^%c(SK: %2i XP: %.0f) %s: %s gained %.0fXP, reason: %s.\n", ct.tm_hour, ct.tm_min, ct.tm_sec, COLOR_RED + skill, ent->client->sess.skill[skill], ent->client->sess.skillpoints[skill], skillNames[skill], ent->client->pers.netname, points, reason );

Show index
Previous bug: stoprecord was missing from COMMANDS list
Next bug: Changed some ints to floats where they were being misused

Color coding

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

©2017 Chruker