This commit fixes all warnings (on my system). -Werror added for

debug builds. Hopefully this will not cause too much pain, but
rather increase code quality for the future.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1144 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-02-19 14:10:44 +00:00
parent 929c4bf2ab
commit 79b3875fc4
29 changed files with 108 additions and 102 deletions

View File

@ -107,7 +107,8 @@ AC_MSG_CHECKING([whether to compile in debug mode])
AC_MSG_RESULT([$debug])
if test "x$debug" = "xyes" ; then
# -O0 turns off all optimizations; this is necessary for accurate debugging
WZ_CFLAGS="${WZ_CFLAGS} -g -O0 -DDEBUG -Wall"
# -Wno-unused-label is necessary because flex produces unused labels that we cannot fix
WZ_CFLAGS="${WZ_CFLAGS} -g -O0 -DDEBUG -Wall -Wno-unused-label -Werror"
# add these when the code is ready for them
# -Wextra -Wwrite-strings -Wcast-qual -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition"
else
@ -284,7 +285,6 @@ else
AC_DEFINE(WZ_NOMP3, 1, [Disable mp3 support])
fi
# add some required C flags here
# -DYY_STATIC is required by flex
WZ_CFLAGS="${WZ_CFLAGS} -DYY_STATIC -DDEFAULT_DATADIR=\\\"${datadir}/warzone2100\\\""

View File

@ -23,6 +23,8 @@
#ifndef _frame_h
#define _frame_h
#include <string.h>
#include "platform.h"
#include "macros.h"

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include "frame.h"
#include "frameresource.h"
#include "resly.h"

View File

@ -38,7 +38,7 @@
/***************************************************************************/
void * anim_GetShapeFunc( char * pStr );
iIMDShape * anim_GetShapeFunc( char * pStr );
/***************************************************************************/

View File

@ -126,8 +126,8 @@ BOOL pie_PNGLoadMem(char *pngimage, iSprite *s)
{
png_bytep* row_pointers = (png_bytep*)malloc(s->height*sizeof(png_bytep));
unsigned char* pdata;
unsigned int i;
char* pdata;
int i;
const unsigned int line_size = s->width*info_ptr->channels;
for (i = 0, pdata = s->bmp;

View File

@ -687,7 +687,7 @@ static void pie_DrawShadows(void)
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT);
glStencilFunc(GL_ALWAYS, 0, ~0);
pie_ShadowDrawLoop(&pos_lgt0);
pie_ShadowDrawLoop(pos_lgt0);
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
} else {
@ -702,14 +702,14 @@ static void pie_DrawShadows(void)
glCullFace(GL_BACK);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
pie_ShadowDrawLoop(&pos_lgt0);
pie_ShadowDrawLoop(pos_lgt0);
// Setup stencil for front faces.
glCullFace(GL_FRONT);
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
// Draw shadows again
pie_ShadowDrawLoop(&pos_lgt0);
pie_ShadowDrawLoop(pos_lgt0);
}
glEnable(GL_CULL_FACE);

View File

@ -9,6 +9,9 @@ AM_YFLAGS = -d
AM_CPPFLAGS = -I$(top_srcdir)
BUILT_SOURCES = script_parser.tab.h chat_parser.tab.h
# This is necessary for -Werror to parse script_parser.y
CFLAGS += -Wno-nonnull
noinst_LIBRARIES = libscript.a
noinst_HEADERS = chat_processing.h codeprint.h event.h evntsave.h interp.h \
parse.h script.h stack.h

View File

@ -45,16 +45,11 @@
#define YYLMAX 255
#endif
/* Store for any string values */
static char aText[TEXT_BUFFERS][YYLMAX];
static UDWORD currText=0;
/* Pointer to the input buffer */
static char *pInputBuffer = NULL;
static char *pEndBuffer = NULL;
static SDWORD playerIndex;
static INTERP_VAL parameter;
#define YY_INPUT(buf,result,max_size) \
if (pInputBuffer != pEndBuffer) { \

View File

@ -38,12 +38,6 @@
/* Holds information about a processed player chat message */
CHAT_MSG chat_msg;
// The current script code
static SCRIPT_CODE *psCurrScript;
// The current script context
static SCRIPT_CONTEXT *psCurrContext;
// Parameter variable
static INTERP_VAL scrParameter;

View File

@ -154,7 +154,7 @@ void cpPrintPackedVal(INTERP_VAL *ip)
{
debug( LOG_NEVER, "type: " );
cpPrintType(type);
debug( LOG_NEVER, " value: %x", data );
debug( LOG_NEVER, " value: %x", data.type );
return;
}
@ -186,7 +186,7 @@ void cpPrintPackedVal(INTERP_VAL *ip)
{
if (asScrTypeTab[i].typeID == type)
{
debug( LOG_NEVER, "type: %s value: %x", asScrTypeTab[i].pIdent, data.v.oval );
debug( LOG_NEVER, "type: %s value: %x", asScrTypeTab[i].pIdent, data.v.ival );
return;
}
}
@ -577,7 +577,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
ip += aOpSize[opcode];
break;
default:
ASSERT( FALSE,"cpPrintProgram: Unknown opcode: %x", *ip );
ASSERT( FALSE,"cpPrintProgram: Unknown opcode: %x", ip->type );
break;
}

View File

@ -1294,9 +1294,11 @@ BOOL eventSetTrigger(void)
return FALSE;
}
#ifdef REALLY_DEBUG_THIS
DB_TRACE(("eventSetTrigger %s %s\n",
eventGetEventID(psFiringTrigger->psContext->psCode, event),
eventGetTriggerID(psFiringTrigger->psContext->psCode, trigger)),2);
#endif
// See if this is the event that is running
psContext = psFiringTrigger->psContext;

View File

@ -150,9 +150,7 @@ static SCRIPT_CODE *psCurProg = NULL;
static BOOL bCurCallerIsEvent = FALSE;
/* Print out trace info if tracing is turned on */
#define TRCPRINTF(x) \
if (interpTrace) \
debug( LOG_NEVER, (#x))
#define TRCPRINTF(...) do { if (interpTrace) { fprintf( stderr, __VA_ARGS__ ); } } while (FALSE)
#define TRCPRINTVAL(x) \
if (interpTrace) \
@ -426,7 +424,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
}
instructionCount++;
TRCPRINTF(("%-6d ", InstrPointer - psProg->pCode));
TRCPRINTF( "%-6d ", InstrPointer - psProg->pCode );
opcode = (OPCODE)(InstrPointer->v.ival >> OPCODE_SHIFT); //get opcode
data = (SDWORD)(InstrPointer->v.ival & OPCODE_DATAMASK); //get data - only used with packed opcodes
switch (opcode)
@ -542,9 +540,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
/* get local variable */
sVal.v.oval = &(psContext->psCode->ppsLocalVarVal[CurEvent][data]);
TRCPRINTF(("PUSHREF "));
TRCPRINTF( "PUSHREF " );
TRCPRINTVAL(&sVal);
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (!stackPush(&sVal))
{
@ -567,9 +565,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
/* copy value */
memcpy(&sVal, (INTERP_VAL *)(InstrPointer + 1), sizeof(INTERP_VAL));
TRCPRINTF(("PUSH "));
TRCPRINTF( "PUSH " );
TRCPRINTVAL(&sVal);
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (!stackPush(&sVal))
{
// Eeerk, out of memory
@ -585,9 +583,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
// store pointer to INTERP_VAL
sVal.v.oval = interpGetVarData(psGlobals, ((INTERP_VAL *)(InstrPointer + 1))->v.ival);
TRCPRINTF(("PUSHREF "));
TRCPRINTF( "PUSHREF " );
TRCPRINTVAL(&sVal);
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (!stackPush(&sVal))
{
// Eeerk, out of memory
@ -600,7 +598,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_OPCODE,
"wrong value type passed for OP_POP: %d", InstrPointer->type);
TRCPRINTF(("POP\n"));
TRCPRINTF( "POP\n" );
if (!stackPop(&sVal))
{
debug( LOG_ERROR, "interpRunScript: could not do stack pop" );
@ -619,7 +617,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
goto exit_with_error;
}
TRCPRINTSTACKTOP();
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
InstrPointer += aOpSize[opcode];
break;
case OP_UNARYOP:
@ -633,7 +631,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
goto exit_with_error;
}
TRCPRINTSTACKTOP();
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
InstrPointer += aOpSize[opcode];
break;
case OP_PUSHGLOBAL:
@ -641,7 +639,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_PUSHGLOBAL: %d", InstrPointer->type);
TRCPRINTF(("PUSHGLOBAL %d\n", data));
TRCPRINTF( "PUSHGLOBAL %d\n", data );
if (data >= numGlobals)
{
debug( LOG_ERROR, "interpRunScript: variable index out of range" );
@ -658,9 +656,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_POPGLOBAL: %d", InstrPointer->type);
TRCPRINTF(("POPGLOBAL %d ", data));
TRCPRINTF( "POPGLOBAL %d ", data );
TRCPRINTSTACKTOP();
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (data >= numGlobals)
{
debug( LOG_ERROR, "interpRunScript: variable index out of range" );
@ -677,13 +675,13 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_PUSHARRAYGLOBAL: %d", InstrPointer->type);
TRCPRINTF(("PUSHARRAYGLOBAL "));
TRCPRINTF( "PUSHARRAYGLOBAL " );
if (!interpGetArrayVarData(&InstrPointer, psGlobals, psProg, &psVar))
{
debug( LOG_ERROR, "interpRunScript: could not get array var data, CurEvent=%d", CurEvent );
goto exit_with_error;
}
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (!stackPush(psVar))
{
debug( LOG_ERROR, "interpRunScript: could not do stack push" );
@ -694,14 +692,14 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_POPARRAYGLOBAL: %d", InstrPointer->type);
TRCPRINTF(("POPARRAYGLOBAL "));
TRCPRINTF( "POPARRAYGLOBAL " );
if (!interpGetArrayVarData(&InstrPointer, psGlobals, psProg, &psVar))
{
debug( LOG_ERROR, "interpRunScript: could not get array var data" );
goto exit_with_error;
}
TRCPRINTSTACKTOP();
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
if (!stackPopType(psVar))
{
debug( LOG_ERROR, "interpRunScript: could not do pop stack of type" );
@ -713,8 +711,8 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_JUMPFALSE: %d", InstrPointer->type);
TRCPRINTF(("JUMPFALSE %d (%d)",
(SWORD)data, InstrPointer - psProg->pCode + (SWORD)data));
TRCPRINTF( "JUMPFALSE %d (%d)",
(SWORD)data, InstrPointer - psProg->pCode + (SWORD)data );
if (!stackPop(&sVal))
{
@ -724,7 +722,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
if (!sVal.v.bval)
{
// Do the jump
TRCPRINTF((" - done -\n"));
TRCPRINTF( " - done -\n" );
InstrPointer += (SWORD)data;
if (InstrPointer < pCodeStart || InstrPointer > pCodeEnd)
{
@ -734,7 +732,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
}
else
{
TRCPRINTF(("\n"));
TRCPRINTF( "\n" );
InstrPointer += aOpSize[opcode];
}
break;
@ -742,8 +740,8 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_JUMP: %d", InstrPointer->type);
TRCPRINTF(("JUMP %d (%d)\n",
(SWORD)data, InstrPointer - psProg->pCode + (SWORD)data));
TRCPRINTF( "JUMP %d (%d)\n",
(SWORD)data, InstrPointer - psProg->pCode + (SWORD)data );
// Do the jump
InstrPointer += (SWORD)data;
if (InstrPointer < pCodeStart || InstrPointer > pCodeEnd)
@ -758,8 +756,8 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_OPCODE,
"wrong value type passed for OP_CALL: %d", InstrPointer->type);
TRCPRINTFUNC( ((INTERP_VAL *)(InstrPointer+1))->v.pFuncExtern );
TRCPRINTF(("\n"));
TRCPRINTFUNC( ((INTERP_VAL *)(InstrPointer+1))->v.pFuncExtern );
TRCPRINTF( "\n" );
scriptFunc = ((INTERP_VAL *)(InstrPointer+1))->v.pFuncExtern;
//debug(LOG_SCRIPT, "OP_CALL 1");
if (!scriptFunc())
@ -775,9 +773,9 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_VARCALL: %d", InstrPointer->type);
TRCPRINTF(("VARCALL "));
TRCPRINTF( "VARCALL " );
TRCPRINTVARFUNC( ((INTERP_VAL *)(InstrPointer+1))->v.pObjGetSet, data );
TRCPRINTF(("(%d)\n", data));
TRCPRINTF( "(%d)\n", data );
ASSERT( ((INTERP_VAL *)(InstrPointer+1))->type == VAL_OBJ_GETSET,
"wrong set/get function pointer type passed for OP_VARCALL: %d", ((INTERP_VAL *)(InstrPointer+1))->type);
@ -801,7 +799,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
ASSERT( InstrPointer->type == VAL_PKOPCODE,
"wrong value type passed for OP_PAUSE: %d", InstrPointer->type);
TRCPRINTF(("PAUSE %d\n", data));
TRCPRINTF( "PAUSE %d\n", data );
ASSERT( stackEmpty(),
"interpRunScript: OP_PAUSE without empty stack" );
@ -922,7 +920,7 @@ BOOL interpRunScript(SCRIPT_CONTEXT *psContext, INTERP_RUNTYPE runType, UDWORD i
//debug(LOG_SCRIPT, "interpRunScript 3");
psCurProg = NULL;
TRCPRINTF(("%-6d EXIT\n", InstrPointer - psProg->pCode));
TRCPRINTF( "%-6d EXIT\n", InstrPointer - psProg->pCode );
bInterpRunning = FALSE;
return TRUE;
@ -944,7 +942,7 @@ exit_with_error:
scrOutputCallTrace();
psCurProg = NULL;
TRCPRINTF(("*** ERROR EXIT ***\n"));
TRCPRINTF( "*** ERROR EXIT ***\n" );
ASSERT(FALSE, "interpRunScript: error while executing a script");
@ -1141,13 +1139,11 @@ void scrOutputCallTrace(void)
pEvent = eventGetEventID(psCurProg, retStack[i].CallerIndex);
}
debug(LOG_SCRIPT,"%d: %s (return address: %d)", i, pEvent, retStack[i].ReturnAddress);
debug(LOG_SCRIPT,"%d: %s (return address: %p)", i, pEvent, retStack[i].ReturnAddress);
}
}
else
{
debug(LOG_SCRIPT, "<No debug information available>");
}
debug(LOG_SCRIPT, "");
}

View File

@ -630,7 +630,6 @@ void script_debug(const char *pFormat, ...);
/* Macro to combine the debugging information in two blocks into a third block */
static UDWORD _dbEntry;
static SCRIPT_DEBUG *_psCurr;
static UDWORD _baseOffset;
#define COMBINE_DEBUG(psFinal, psBlock1, psBlock2) \
if (genDebugInfo) \
{ \
@ -841,6 +840,7 @@ static UDWORD checkFuncParamTypes(EVENT_SYMBOL *psFSymbol, // The function bei
return 0; //all ok
}
#ifdef UNUSED
/*
* function call
*/
@ -881,7 +881,7 @@ static CODE_ERROR scriptCodeCallFunction(FUNC_SYMBOL *psFSymbol, // The functio
return CE_OK;
}
#endif
/* Generate the code for a parameter callback, checking the parameter
* types match.
@ -1624,7 +1624,7 @@ static CODE_ERROR scriptCodeVarRef(VAR_SYMBOL *psVariable, // The object variab
return CE_OK;
}
#ifdef UNUSED
/* Generate the code for a trigger and store it in the trigger list */
static CODE_ERROR scriptCodeTrigger(char *pIdent, CODE_BLOCK *psCode)
{
@ -1664,8 +1664,9 @@ static CODE_ERROR scriptCodeTrigger(char *pIdent, CODE_BLOCK *psCode)
return CE_OK;
}
#endif
#ifdef UNUSED
/* Generate the code for an event and store it in the event list */
static CODE_ERROR scriptCodeEvent(EVENT_SYMBOL *psEvent, TRIGGER_SYMBOL *psTrig, CODE_BLOCK *psCode)
{
@ -1703,7 +1704,7 @@ static CODE_ERROR scriptCodeEvent(EVENT_SYMBOL *psEvent, TRIGGER_SYMBOL *psTrig,
return CE_OK;
}
#endif
/* Store the types of a list of variables into a code block.
* The order of the list is reversed so that the type of the

View File

@ -17,6 +17,7 @@
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <ctype.h>
#include <stdlib.h>
#ifdef WIN32
#include <windows.h>

View File

@ -611,8 +611,8 @@ void sound_SetPlayerOrientation( SDWORD iX, SDWORD iY, SDWORD iZ )
//~~~~~~~~~~~
// convert params to rad
float pitch = (float)iX * M_PI / 180;
float roll = (float)iY * M_PI / 180;
// float pitch = (float)iX * M_PI / 180;
// float roll = (float)iY * M_PI / 180;
float yaw = (float)iZ * M_PI / 180;
ori[0] = -sin( yaw );

View File

@ -372,7 +372,7 @@ put_scrap(int type, int srclen, char *src)
Lock_Display();
convert_data(type, dst, src, srclen);
XChangeProperty(SDL_Display, DefaultRootWindow(SDL_Display),
XA_CUT_BUFFER0, format, 8, PropModeReplace, dst, dstlen);
XA_CUT_BUFFER0, format, 8, PropModeReplace, (unsigned char *)dst, dstlen);
free(dst);
if ( lost_scrap() )
XSetSelectionOwner(SDL_Display, XA_PRIMARY, SDL_Window, CurrentTime);

View File

@ -311,6 +311,14 @@ SDWORD targetAttackWeight(BASE_OBJECT *psTarget, BASE_OBJECT *psAttacker, SDWORD
/* See if this type of a droid should be prioritized */
switch (targetDroid->droidType)
{
case DROID_SENSOR:
case DROID_ECM:
case DROID_PERSON:
case DROID_TRANSPORTER:
case DROID_DEFAULT:
case DROID_ANY:
break;
case DROID_CYBORG:
case DROID_WEAPON:
case DROID_CYBORG_SUPER:

View File

@ -33,8 +33,7 @@
/***************************************************************************/
void *
anim_GetShapeFunc( char * pStr )
iIMDShape *anim_GetShapeFunc( char * pStr )
{
return resGetData( "IMD", pStr );
}

View File

@ -278,7 +278,7 @@ static FP_NODE *fpathHashPresent(FP_NODE *apsTable[], SDWORD x, SDWORD y)
return psFound;
}*/
#if OPEN_LIST == 0 || OPEN_LIST == 1
// Remove a node from the hash table
static FP_NODE *fpathHashRemove(FP_NODE *apsTable[], SDWORD x, SDWORD y)
{
@ -311,7 +311,9 @@ static FP_NODE *fpathHashRemove(FP_NODE *apsTable[], SDWORD x, SDWORD y)
return psFound;
}
#endif
#if OPEN_LIST == 0 || OPEN_LIST == 1
// Remove a node from the hash table
static FP_NODE *fpathHashCondRemove(FP_NODE *apsTable[], SDWORD x, SDWORD y, SDWORD dist)
{
@ -349,7 +351,7 @@ static FP_NODE *fpathHashCondRemove(FP_NODE *apsTable[], SDWORD x, SDWORD y, SDW
return psFound;
}
#endif
// Reset the hash tables
static void fpathHashReset(void)
@ -714,7 +716,7 @@ static FP_NODE *fpathOpenGet(void)
#endif
#if OPEN_LIST == 1 || OPEN_LIST == 2
#if OPEN_LIST == 0 || OPEN_LIST == 1
// Remove a node from the open list
static void fpathOpenRemove(FP_NODE *psNode)
{
@ -750,7 +752,6 @@ static void fpathOpenRemove(FP_NODE *psNode)
}
}
}
#endif

View File

@ -406,11 +406,9 @@ BOOL droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weapo
psDroid->armour -= armourDamage;
}*/
debug( LOG_ATTACK, " body left: %d armour left: %d\n",
psDroid->body, psDroid->armour);
/* now check for auto return on droid's secondary orders */
secondaryCheckDamageLevel(psDroid);
/* now check for scripted run-away based on health */
orderHealthCheck(psDroid);

View File

@ -25,7 +25,7 @@
* return a filename to use for the ops.
*/
#include <string.h>
#include <ctype.h>
#include <physfs.h>
#include "lib/framework/frame.h"
@ -91,7 +91,7 @@ void drawBlueBox (UDWORD x,UDWORD y, UDWORD w, UDWORD h);
BOOL closeLoadSave (void);
BOOL runLoadSave (BOOL bResetMissionWidgets);
BOOL displayLoadSave (void);
static BOOL _addLoadSave (BOOL bLoad, const char *sSearchPath, const char *sExtension, const char *title);
static BOOL _addLoadSave (BOOL bLoad, const char *sSearchPath, const char *sExtension, char *title);
static BOOL _runLoadSave (BOOL bResetMissionWidgets);
static void displayLoadBanner (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
static void displayLoadSlot (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD *pColours);
@ -127,7 +127,7 @@ BOOL saveMidMission(void)
}
// ////////////////////////////////////////////////////////////////////////////
BOOL addLoadSave(LOADSAVE_MODE mode, const char *sSearchPath, const char *sExtension, const char *title)
BOOL addLoadSave(LOADSAVE_MODE mode, const char *sSearchPath, const char *sExtension, char *title)
{
BOOL bLoad;
@ -154,7 +154,7 @@ BOOL bLoad;
//****************************************************************************************
// Load menu/save menu?
//*****************************************************************************************
static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExtension, const char *title)
static BOOL _addLoadSave(BOOL bLoad, const char *sSearchPath, const char *sExtension, char *title)
{
W_FORMINIT sFormInit;
W_BUTINIT sButInit;

View File

@ -63,7 +63,7 @@ extern BOOL bRequestLoad;
extern void drawBlueBox (UDWORD x,UDWORD y, UDWORD w, UDWORD h);
extern BOOL addLoadSave (LOADSAVE_MODE mode, const char *defaultdir, const char *extension,const char *title);
extern BOOL addLoadSave(LOADSAVE_MODE mode, const char *defaultdir, const char *extension, char *title);
extern BOOL closeLoadSave (void);
extern BOOL runLoadSave (BOOL bResetMissionWidgets);
extern BOOL displayLoadSave (void);

View File

@ -852,15 +852,17 @@ VIEWDATA *loadViewData(char *pViewMsgData, UDWORD bufferSize)
if (psViewData->pData == NULL)
{
debug( LOG_ERROR, "Unable to allocate memory" );
abort();
assert( FALSE );
return NULL;
} else {
int tmp;
audioName[0] = '\0';
sscanf( pViewMsgData, ", %d,%d,%d,%[^','],%d%n", &LocX, &LocY, &LocZ,
audioName, &tmp, &cnt);
proxType = tmp;
}
audioName[0] = '\0';
sscanf(pViewMsgData, ",%d,%d,%d,%[^','],%d%n", &LocX, &LocY, &LocZ,
audioName,&proxType,&cnt);
pViewMsgData += cnt;
pViewMsgData += cnt;
//allocate audioID
if ( strcmp( audioName, "0" ) == 0 )

View File

@ -957,6 +957,19 @@ proj_InFlightIndirectFunc( PROJ_OBJECT *psObj )
{
switch(psStats->weaponSubClass)
{
case WSC_MGUN:
case WSC_CANNON:
case WSC_MORTARS:
case WSC_ENERGY:
case WSC_GAUSS:
case WSC_HOWITZERS:
case WSC_AAGUN:
case WSC_LAS_SAT:
case WSC_BOMB:
case WSC_COUNTER:
case NUM_WEAPON_SUBCLASS:
case INVALID_SUBCLASS:
break;
case WSC_FLAME:
effectGiveAuxVar(PERCENT(iDist,iRad));
pos.x = psObj->x;

View File

@ -457,8 +457,6 @@ void drawRadar(void)
scrollMaxY = scrollMinY+127;
#endif
CalcRadarPixelSize(&boxSizeH,&boxSizeV);
CalcRadarScroll(boxSizeH,boxSizeV);
@ -474,14 +472,11 @@ void drawRadar(void)
iV_TransBoxFill( RADTLX,RADTLY, RADTLX + RADWIDTH, RADTLY + RADHEIGHT);
pie_RenderRadar(&RadarImage,radarBuffer,RadarWidth,RADTLX,RADTLY);
pie_RenderRadar( &RadarImage, (char*)radarBuffer, RadarWidth, RADTLX, RADTLY );
DrawRadarExtras(boxSizeH,boxSizeV);
UpdateRadar(boxSizeH,boxSizeV);
RadarRedraw = FALSE;
}
void downloadAtStartOfFrame( void )

View File

@ -224,11 +224,8 @@ var_init_list: /* NULL token */
var_init: var_entry TYPE var_value
{
INTERP_VAL data; /* structure to to hold all types */
DROID_TEMPLATE *psTemplate;
BASE_OBJECT *psObj;
VIEWDATA *psViewData;
char *pString;
RESEARCH *psResearch;
SDWORD compIndex;
/* set type */

View File

@ -367,7 +367,7 @@ void seq_SetVideoPath(void)
if (!bHardPath)
{
strcpy(aHardPath, "sequences/");
/*#ifdef WIN32
#ifdef WAS_WIN32_NOW_UNUSED
fileHandle = FindFirstFile("sequences/*.rpl",&findData);
if (fileHandle == INVALID_HANDLE_VALUE)
{
@ -382,10 +382,8 @@ void seq_SetVideoPath(void)
return;
}
#else
*/
bHardPath=TRUE; //yes, always true, as it should be on windows ALSO.
//#endif
#endif
}
}

View File

@ -1227,7 +1227,7 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
WeaponName[j][0] = '\0';
}
sscanf(pWeaponData, "%[^','],%[^','],%[^','],%[^','],%[^','],%*d", StructureName, &WeaponName[0], &WeaponName[1], &WeaponName[2], &WeaponName[3]);
sscanf(pWeaponData, "%[^','],%[^','],%[^','],%[^','],%[^','],%*d", StructureName, WeaponName[0], WeaponName[1], WeaponName[2], WeaponName[3]);
if (!getResourceName(StructureName))
{

View File

@ -231,7 +231,7 @@ BOOL getTileRadarColours(void)
{
UDWORD x, y, i, j, w, h, t;
iBitmap *b, *s;
UBYTE tempBMP[TILE_WIDTH * TILE_HEIGHT];
char tempBMP[TILE_WIDTH * TILE_HEIGHT];
w = tilesPCX.width / TILE_WIDTH;
h = tilesPCX.height / TILE_HEIGHT;