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: Error messages in the scripting system were printing the wrong index ranges
Next bug: Skull never leaving in menu after teamswitch

Bugfix 056 - Various typos in the scripting system

Problem:

The error messages in the scripting system have typos. Mainly in the globalaccum functionality. It was probably copied from accum and then they forgot the error messages.

Solution:

Updating them with the changes below.

Notes:

The bug is still present in version 2.60

2.56 & 2.60 Code

g_script_actions.c @ 589 (2.56) @ 590 (2.60) token = COM_ParseExt( &pString, qfalse ); if (!token[0]) {
// CHRUKER: b056 - Help text said accum
G_Error( "G_Scripting: globalaccum without a buffer index\n" ); } bufferIndex = atoi(token); // CHRUKER: b055 - Was using G_MAX_SCRIPT_ACCUM_BUFFERS, which can result in a wrong index if (bufferIndex < 0 || bufferIndex >= MAX_SCRIPT_ACCUM_BUFFERS) { // CHRUKER: b055 - Was using G_MAX_SCRIPT_ACCUM_BUFFERS, which can result in a wrong index
// b056 - Help text said accum
G_Error( "G_Scripting: globalaccum buffer is outside range (0 - %i)\n", MAX_SCRIPT_ACCUM_BUFFERS-1 ); }
g_script_actions.c @ 966 (2.56) @ 971 (2.60) token = COM_ParseExt( &pString, qfalse ); if (!token[0]) {
// CHRUKER: b056 - Said setposition instead of disablemessage
G_Error( "G_Scripting: disablemessage must have an targetname\n" ); }
g_script_actions.c @ 2142 (2.56) @ 2149 (2.60) token = COM_ParseExt( &pString, qfalse ); if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "G_Scripting: globalaccum without a buffer index\n" ); } bufferIndex = atoi(token); // CHRUKER: b055 - Was using G_MAX_SCRIPT_ACCUM_BUFFERS, which would result in invalid indexes if (bufferIndex >= MAX_SCRIPT_ACCUM_BUFFERS) { // CHRUKER: b055 - Was printing 10 as the last bufferindex, but its actually 7
// b056 - Help text said accum instead of globalaccum
G_Error( "G_Scripting: globalaccum buffer is outside range (0 - %i)\n", MAX_SCRIPT_ACCUM_BUFFERS-1 ); } token = COM_ParseExt( &pString, qfalse ); if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "G_Scripting: globalaccum without a command\n" ); } Q_strncpyz( lastToken, token, sizeof(lastToken) ); token = COM_ParseExt( &pString, qfalse ); if (!Q_stricmp(lastToken, "inc")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } level.globalAccumBuffer[bufferIndex] += atoi(token); } else if (!Q_stricmp(lastToken, "abort_if_less_than")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] < atoi(token)) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "abort_if_greater_than")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] > atoi(token)) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "abort_if_not_equal") || !Q_stricmp(lastToken, "abort_if_not_equals")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] != atoi(token)) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "abort_if_equal")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] == atoi(token)) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "bitset")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } level.globalAccumBuffer[bufferIndex] |= (1<<atoi(token)); } else if (!Q_stricmp(lastToken, "bitreset")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } level.globalAccumBuffer[bufferIndex] &= ~(1<<atoi(token)); } else if (!Q_stricmp(lastToken, "abort_if_bitset")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] & (1<<atoi(token))) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "abort_if_not_bitset")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (!(level.globalAccumBuffer[bufferIndex] & (1<<atoi(token)))) { // abort the current script ent->scriptStatus.scriptStackHead = ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack.numItems; } } else if (!Q_stricmp(lastToken, "set")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } level.globalAccumBuffer[bufferIndex] = atoi(token); } else if (!Q_stricmp(lastToken, "random")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } level.globalAccumBuffer[bufferIndex] = rand() % atoi(token); } else if (!Q_stricmp(lastToken, "trigger_if_equal")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] == atoi(token)) {
g_script_actions.c @ 2275 (2.56) @ 2299 (2.60) } else if (!Q_stricmp(lastToken, "wait_while_equal")) { if (!token[0]) {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s requires a parameter\n", lastToken ); } if (level.globalAccumBuffer[bufferIndex] == atoi(token)) { return qfalse; } } else {
// CHRUKER: b056 - Corrected help text, to say globalaccum instead of accum
G_Error( "Scripting: globalaccum %s: unknown command\n", params ); }

Show index
Previous bug: Error messages in the scripting system were printing the wrong index ranges
Next bug: Skull never leaving in menu after teamswitch

Color coding

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

©2017 Chruker