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: Player view is distorted in intermission if you have ridden an vehicle, mounted a tank
Next bug: Spawnpoints not movable

Bugfix 090 - Sorting the maps, campaigns and mods list

Problem:

The list of maps, campaigns and mods are not sorted.

Solution:

Sort them using 3 new functions.

2.60 Code

ui_gameinfo.c @ 237 return; }
/* ============= UI_SortArenas CHRUKER: b090 - Sorting the map list ============= */ int QDECL UI_SortArenas( const void *a, const void *b ) { mapInfo ca = *(mapInfo*)a; mapInfo cb = *(mapInfo*)b; char cleanNameA[MAX_STRING_CHARS]; char cleanNameB[MAX_STRING_CHARS]; Q_strncpyz(cleanNameA, ca.mapName, sizeof(cleanNameA)); Q_strncpyz(cleanNameB, cb.mapName, sizeof(cleanNameB)); Q_CleanStr(cleanNameA); Q_CleanStr(cleanNameB); return strcmp(cleanNameA, cleanNameB); } // b090
/* =============== UI_LoadArenas
ui_gameinfo.c @ 389 break; } }*/
// CHRUKER: b090 - Sorting the map list qsort( uiInfo.mapList, uiInfo.mapCount, sizeof(uiInfo.mapList[0]), UI_SortArenas );
} mapInfo* UI_FindMapInfoByMapname( const char* name ) {
ui_gameinfo.c @ 774 return( -1 ); }
/* ================ UI_SortCampaigns CHRUKER: b090 - Sorting the campaign list ================ */ int QDECL UI_SortCampaigns( const void *a, const void *b ) { char cleanNameA[MAX_STRING_CHARS]; char cleanNameB[MAX_STRING_CHARS]; campaignInfo_t ca = *(campaignInfo_t*)a; campaignInfo_t cb = *(campaignInfo_t*)b; Q_strncpyz(cleanNameA, ca.campaignName, sizeof(cleanNameA)); Q_strncpyz(cleanNameB, cb.campaignName, sizeof(cleanNameB)); Q_CleanStr(cleanNameA); Q_CleanStr(cleanNameB); return strcmp(cleanNameA, cleanNameB); } // b090
/* =============== UI_LoadCampaigns
ui_gameinfo.c @ 880 uiInfo.campaignList[i].cpsCampaign = NULL; }*/ }
// CHRUKER: b090 - Sorting the campaign list qsort( uiInfo.campaignList, uiInfo.campaignCount, sizeof(uiInfo.campaignList[0]), UI_SortCampaigns );
} /*
ui_main.c @ 3893
/* =========== UI_LoadMods CHRUKER: b090 - Sorting the mods list =========== */ int QDECL UI_SortMods( const void *a, const void *b ) { modInfo_t ca = *(modInfo_t*)a; modInfo_t cb = *(modInfo_t*)b; return strcmp(ca.modName, cb.modName); } // b090
/* =============== UI_LoadMods
ui_main.c @ 3936 break; } }
// CHRUKER: b090 - Sorting the mods list qsort( uiInfo.modList, uiInfo.modCount, sizeof(uiInfo.modList[0]), UI_SortMods );
} /*

Show index
Previous bug: Player view is distorted in intermission if you have ridden an vehicle, mounted a tank
Next bug: Spawnpoints not movable

Color coding

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

©2017 Chruker