+ const, - unused

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1795 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-06-03 13:46:50 +00:00
parent a8a091a604
commit 6fa36aa0e9
32 changed files with 861 additions and 2436 deletions

View File

@ -31,7 +31,7 @@
#define RESID_MAXCHAR 40
/* Function pointer for a function that loads from a memory buffer */
typedef BOOL (*RES_BUFFERLOAD)(char *pBuffer, UDWORD size, void **pData);
typedef BOOL (*RES_BUFFERLOAD)(const char *pBuffer, UDWORD size, void **pData);
/* Function pointer for a function that loads from a filename */
typedef BOOL (*RES_FILELOAD)(const char *pFile, void **pData);

View File

@ -52,8 +52,8 @@ static UDWORD currText=0;
static BOOL inComment = FALSE;
/* Pointer to the input buffer */
static char *pInputBuffer = NULL;
static char *pEndBuffer = NULL;
static const char *pInputBuffer = NULL;
static const char *pEndBuffer = NULL;
#define YY_INPUT(buf,result,max_size) \
if (pInputBuffer != pEndBuffer) { \

View File

@ -242,12 +242,11 @@ BOOL strresGetIDNum(STR_RES *psRes, const char *pIDStr, UDWORD *pIDNum)
/* Return the ID stored ID string that matches the string passed in */
BOOL strresGetIDString(STR_RES *psRes, char *pIDStr, char **ppStoredID)
BOOL strresGetIDString(STR_RES *psRes, const char *pIDStr, char **ppStoredID)
{
STR_ID *psID;
STR_ID *psID;
ASSERT( psRes != NULL,
"strresGetIDString: Invalid string res pointer" );
ASSERT( psRes != NULL, "strresGetIDString: Invalid string res pointer" );
psID = (STR_ID*)TREAP_FIND(psRes->psIDTreap, (void*)pIDStr);
if (!psID)
@ -257,7 +256,6 @@ BOOL strresGetIDString(STR_RES *psRes, char *pIDStr, char **ppStoredID)
}
*ppStoredID = psID->pIDStr;
return TRUE;
}
@ -390,7 +388,7 @@ BOOL strresLoad(STR_RES* psRes, const char* fileName)
PHYSFS_file* fileHandle = PHYSFS_openRead(fileName);
if (!fileHandle)
{
debug(LOG_ERROR, "strresLoadFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());
debug(LOG_ERROR, "strresLoadFile: PHYSFS_openRead(\"%s\") failed with error: %s\n", fileName, PHYSFS_getLastError());
return FALSE;
}
@ -433,25 +431,23 @@ void stringCpy(char *pDest, const char *pSrc)
/* Get the ID number for a string*/
UDWORD strresGetIDfromString(STR_RES *psRes, char *pString)
UDWORD strresGetIDfromString(STR_RES *psRes, const char *pString)
{
STR_BLOCK *psBlock, *psNext = NULL;
UDWORD i;
STR_BLOCK *psBlock, *psNext = NULL;
unsigned int i;
ASSERT( psRes != NULL,
"strresGetID: Invalid string res pointer" );
// Search through all the blocks to find the string
for(psBlock = psRes->psStrings; psBlock; psBlock=psNext)
for(psBlock = psRes->psStrings; psBlock != NULL; psBlock=psNext)
{
for(i=psBlock->idStart; i<=psBlock->idEnd; i++)
for(i = psBlock->idStart; i <= psBlock->idEnd; i++)
{
if (psBlock->apStrings[i - psBlock->idStart])
if ( psBlock->apStrings[i - psBlock->idStart] &&
!strcmp(psBlock->apStrings[i - psBlock->idStart], pString) )
{
if (!strcmp(psBlock->apStrings[i - psBlock->idStart], pString))
{
return i;
}
return i;
}
}
psNext = psBlock->psNext;

View File

@ -74,7 +74,7 @@ extern BOOL strresLoadFixedID(STR_RES *psRes, STR_ID *psID, UDWORD numID);
extern BOOL strresGetIDNum(STR_RES *psRes, const char *pIDStr, UDWORD *pIDNum);
/* Return the stored ID string that matches the string passed in */
extern BOOL strresGetIDString(STR_RES *psRes, char *pIDStr, char **ppStoredID);
extern BOOL strresGetIDString(STR_RES *psRes, const char *pIDStr, char **ppStoredID);
/* Get the string from an ID number */
extern char *strresGetString(STR_RES *psRes, UDWORD id);
@ -89,7 +89,7 @@ extern UDWORD stringLen(const char *pStr);
extern void stringCpy(char *pDest, const char *pSrc);
/* Get the ID number for a string*/
extern UDWORD strresGetIDfromString(STR_RES *psRes, char *pString);
extern UDWORD strresGetIDfromString(STR_RES *psRes, const char *pString);
#endif

View File

@ -43,7 +43,7 @@
//*************************************************************************
extern iIMDShape *iV_ProcessIMD(char **ppFileData, char *FileDataEnd );
extern iIMDShape *iV_ProcessIMD(const char **ppFileData, const char *FileDataEnd );
extern BOOL iV_IMDSave(char *filename, iIMDShape *s, BOOL PieIMD);
extern void iV_IMDRelease(iIMDShape *s);

View File

@ -45,9 +45,9 @@
static VERTEXID vertexTable[iV_IMD_MAX_POINTS];
// local prototypes
static iIMDShape *_imd_load_level(char **FileData, char *FileDataEnd, int nlevels);
static iIMDShape *_imd_load_level(const char **FileData, const char *FileDataEnd, int nlevels);
static BOOL AtEndOfFile(char *CurPos, char *EndOfFile)
static BOOL AtEndOfFile(const char *CurPos, const char *EndOfFile)
{
while ( *CurPos == 0x00 || *CurPos == 0x09 || *CurPos == 0x0a || *CurPos == 0x0d || *CurPos == 0x20 )
{
@ -66,19 +66,17 @@ static BOOL AtEndOfFile(char *CurPos, char *EndOfFile)
}
// ppFileData is incremented to the end of the file on exit!
iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
iIMDShape *iV_ProcessIMD( const char **ppFileData, const char *FileDataEnd )
{
char texfile[MAX_PATH]; // Last loaded texture page filename
char *pFileData = *ppFileData;
int cnt;
char buffer[MAX_PATH], texType[MAX_PATH], ch; //, *str;
int i, nlevels, pwidth, pheight;
iIMDShape *s, *psShape;
UDWORD level;
Sint32 imd_version;
Uint32 imd_flags; // FIXME UNUSED
char *pFileName = GetLastResourceFilename();
BOOL bTextured = FALSE;
const char *pFileName = GetLastResourceFilename(); // Last loaded texture page filename
const char *pFileData = *ppFileData;
char buffer[MAX_PATH], texfile[MAX_PATH];
int cnt, nlevels;
iIMDShape *shape, *psShape;
UDWORD level;
Sint32 imd_version;
Uint32 imd_flags; // FIXME UNUSED
BOOL bTextured = FALSE;
if (sscanf(pFileData, "%s %d%n", buffer, &imd_version, &cnt) != 2)
{
@ -120,6 +118,9 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
// get texture page if specified
if (strncmp(buffer, "TEXTURE", 7) == 0)
{
int i, pwidth, pheight;
char ch, texType[MAX_PATH];
/* the first parameter for textures is always ignored; which is why we ignore
* nlevels read in above */
ch = *pFileData++;
@ -144,6 +145,7 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
return NULL;
}
strcat(texfile, ".png");
pie_MakeTexPageName(texfile);
if (sscanf(pFileData, "%d %d%n", &pwidth, &pheight, &cnt) != 2)
{
@ -151,7 +153,6 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
return NULL;
}
pFileData += cnt;
pie_MakeTexPageName(texfile);
/* Now read in LEVELS directive */
if (sscanf(pFileData, "%s %d%n", buffer, &nlevels, &cnt) != 2)
@ -184,8 +185,8 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
return NULL;
}
s = _imd_load_level(&pFileData, FileDataEnd, nlevels);
if (s == NULL)
shape = _imd_load_level(&pFileData, FileDataEnd, nlevels);
if (shape == NULL)
{
debug(LOG_ERROR, "iV_ProcessIMD %s unsuccessful", pFileName);
return NULL;
@ -203,14 +204,14 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
return NULL;
}
/* assign tex page to levels */
for (psShape = s; psShape != NULL; psShape = psShape->next)
for (psShape = shape; psShape != NULL; psShape = psShape->next)
{
psShape->texpage = texpage;
}
}
*ppFileData = pFileData;
return s;
return shape;
}
@ -225,9 +226,9 @@ iIMDShape *iV_ProcessIMD( char **ppFileData, char *FileDataEnd )
* \post s->polys allocated (iFSDPoly * s->npolys)
* \post s->pindex allocated for each poly
*/
static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
static BOOL _imd_load_polys( const char **ppFileData, iIMDShape *s )
{
char *pFileData = *ppFileData;
const char *pFileData = *ppFileData;
int i, j, cnt;
iIMDPoly *poly;
int nFrames, pbRate, tWidth, tHeight;
@ -367,9 +368,9 @@ static BOOL _imd_load_polys( char **ppFileData, iIMDShape *s )
}
static BOOL ReadPoints( char **ppFileData, iIMDShape *s )
static BOOL ReadPoints( const char **ppFileData, iIMDShape *s )
{
char *pFileData = *ppFileData;
const char *pFileData = *ppFileData;
int cnt, i, j, lastPoint = 0, match = -1;
Vector3f newVector = {0.0f, 0.0f, 0.0f};
@ -425,9 +426,8 @@ static BOOL ReadPoints( char **ppFileData, iIMDShape *s )
}
static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
static BOOL _imd_load_points( const char **ppFileData, iIMDShape *s )
{
int i;
Vector3f *p = NULL;
Sint32 tempXMax, tempXMin, tempZMax, tempZMin, extremeX, extremeZ;
Sint32 xmax, ymax, zmax;
@ -457,7 +457,7 @@ static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
vxmin.x = vymin.y = vzmin.z = FP12_MULTIPLIER;
// set up bounding data for minimum number of vertices
for (i = 0, p = s->points; i < s->npoints; i++, p++)
for (p = s->points; p < s->points + s->npoints; p++)
{
if (p->x > s->xmax)
s->xmax = p->x;
@ -609,7 +609,7 @@ static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
rad = sqrt(rad_sq);
// second pass (find tight sphere)
for (i = 0, p = s->points; i < s->npoints; i++, p++)
for (p = s->points; p < s->points + s->npoints; p++)
{
dx = p->x - cen.x;
dy = p->y - cen.y;
@ -655,10 +655,10 @@ static BOOL _imd_load_points( char **ppFileData, iIMDShape *s )
* \pre s->nconnectors set
* \post s->connectors allocated
*/
static BOOL _imd_load_connectors(char **ppFileData, iIMDShape *s)
static BOOL _imd_load_connectors(const char **ppFileData, iIMDShape *s)
{
char *pFileData = *ppFileData;
int cnt, i;
const char *pFileData = *ppFileData;
int cnt;
Vector3f *p = NULL, newVector = {0.0f, 0.0f, 0.0f};
s->connectors = (Vector3f*)malloc(sizeof(Vector3f) * s->nconnectors);
@ -668,7 +668,7 @@ static BOOL _imd_load_connectors(char **ppFileData, iIMDShape *s)
return FALSE;
}
for (i = 0, p = s->connectors; i < s->nconnectors; i++, p++)
for (p = s->connectors; p < s->connectors + s->nconnectors; p++)
{
if (sscanf(pFileData, "%f %f %f%n", &newVector.x, &newVector.y, &newVector.z, &cnt) != 3)
{
@ -694,12 +694,12 @@ static BOOL _imd_load_connectors(char **ppFileData, iIMDShape *s)
* \pre ppFileData loaded
* \post s allocated
*/
static iIMDShape *_imd_load_level(char **ppFileData, char *FileDataEnd, int nlevels)
static iIMDShape *_imd_load_level(const char **ppFileData, const char *FileDataEnd, int nlevels)
{
char *pFileData = *ppFileData;
const char *pFileData = *ppFileData;
char buffer[MAX_PATH] = {'\0'};
int cnt = 0, n = 0;
iIMDShape *s = NULL;
char buffer[MAX_PATH] = {'\0'};
if (nlevels == 0)
return NULL;

View File

@ -45,8 +45,6 @@
// ////////////////////////////////////////////////////////////////////////
// Prototypes
UDWORD NEThashBuffer(char *pData, UDWORD size);
BOOL NETsetKey (UDWORD c1,UDWORD c2,UDWORD c3, UDWORD c4);
NETMSG* NETmanglePacket (NETMSG *msg);
void NETunmanglePacket (NETMSG *msg);
@ -57,19 +55,16 @@ BOOL NETunmangleData ( UDWORD *input, UDWORD *result, UDWORD dataSize);
// ////////////////////////////////////////////////////////////////////////
// return a hash from a data buffer.
UDWORD NEThashBuffer(char *pData, UDWORD size)
UDWORD NEThashBuffer(const char *pData, UDWORD size)
{
UDWORD hashval,*val;
UDWORD pt;
const uint32_t *xData = (uint32_t*)pData; // remember that we read 4 bytes at once
UDWORD hashval = 0, i = 0;
hashval =0;
pt =0;
size /= sizeof(uint32_t);
while(pt <= size-4) // remember that we read 4 bytes at once
for(i = 0; i <= size; i++)
{
val = (UDWORD*)(pData+pt);
hashval = hashval ^ *val;
pt += 4;
hashval = hashval ^ xData[i];
}
return hashval;

View File

@ -168,8 +168,8 @@ extern NETMSG* NETmanglePacket(NETMSG *msg);
extern void NETunmanglePacket(NETMSG *msg);
extern BOOL NETmangleData(UDWORD *input, UDWORD *result, UDWORD dataSize);
extern BOOL NETunmangleData(UDWORD *input, UDWORD *result, UDWORD dataSize);
extern UBYTE NEThashVal(UDWORD value);
extern UDWORD NEThashBuffer(char *pData, UDWORD size);
extern UBYTE NEThashVal(UDWORD value);
extern UDWORD NEThashBuffer(const char *pData, UDWORD size);
extern void NETsetMasterserverName(const char* hostname);
extern void NETsetMasterserverPort(unsigned int port);

View File

@ -46,8 +46,8 @@
#endif
/* Pointer to the input buffer */
static char *pInputBuffer = NULL;
static char *pEndBuffer = NULL;
static const char *pInputBuffer = NULL;
static const char *pEndBuffer = NULL;
static SDWORD playerIndex;

View File

@ -42,7 +42,7 @@ typedef struct _w_slider
UWORD barSize; // Thickness of slider bar
UWORD pos; // Current stop position of the slider
UWORD state; // Slider state
char *pTip; // Tool tip
const char *pTip; // Tool tip
} W_SLIDER;
/* Create a slider widget data structure */

View File

@ -1054,53 +1054,52 @@ void *widgGetLastUserData(W_SCREEN *psScreen)
}
/* Set tip string for a widget */
void widgSetTip( W_SCREEN *psScreen, UDWORD id, char *pTip )
void widgSetTip( W_SCREEN *psScreen, UDWORD id, const char *pTip )
{
WIDGET *psWidget;
WIDGET *psWidget = widgGetFromID(psScreen, id);
psWidget = widgGetFromID(psScreen, id);
if ( psWidget )
{
switch (psWidget->type)
{
case WIDG_FORM:
if (psWidget->style & WFORM_CLICKABLE)
{
((W_CLICKFORM *) psWidget)->pTip = pTip;
}
else if (psWidget->style & WFORM_TABBED)
{
ASSERT( FALSE, "widgSetTip: tabbed forms do not have a tip" );
}
else
{
ASSERT( FALSE, "widgSetTip: plain forms do not have a tip" );
}
break;
if (psWidget->style & WFORM_CLICKABLE)
{
((W_CLICKFORM *) psWidget)->pTip = pTip;
}
else if (psWidget->style & WFORM_TABBED)
{
ASSERT( FALSE, "widgSetTip: tabbed forms do not have a tip" );
}
else
{
ASSERT( FALSE, "widgSetTip: plain forms do not have a tip" );
}
break;
case WIDG_LABEL:
((W_LABEL *) psWidget)->pTip = pTip;
break;
((W_LABEL *) psWidget)->pTip = pTip;
break;
case WIDG_BUTTON:
((W_BUTTON *) psWidget)->pTip = pTip;
break;
((W_BUTTON *) psWidget)->pTip = pTip;
break;
case WIDG_BARGRAPH:
((W_BARGRAPH *) psWidget)->pTip = pTip;
break;
((W_BARGRAPH *) psWidget)->pTip = pTip;
break;
case WIDG_SLIDER:
((W_SLIDER *) psWidget)->pTip = pTip;
break;
((W_SLIDER *) psWidget)->pTip = pTip;
break;
case WIDG_EDITBOX:
ASSERT( FALSE, "widgSetTip: edit boxes do not have a tip" );
break;
ASSERT( FALSE, "widgSetTip: edit boxes do not have a tip" );
break;
default:
ASSERT( FALSE,"widgSetTip: Unknown widget type" );
break;
ASSERT( FALSE,"widgSetTip: Unknown widget type" );
break;
}
}
}
@ -1234,57 +1233,55 @@ void widgSetButtonState(W_SCREEN *psScreen, UDWORD id, UDWORD state)
/* Return a pointer to a buffer containing the current string of a widget.
* NOTE: The string must be copied out of the buffer
*/
char *widgGetString(W_SCREEN *psScreen, UDWORD id)
const char *widgGetString(W_SCREEN *psScreen, UDWORD id)
{
WIDGET *psWidget;
const WIDGET *psWidget = widgGetFromID(psScreen, id);
ASSERT( psScreen != NULL,
"widgGetString: Invalid screen pointer" );
ASSERT( psScreen != NULL, "widgGetString: Invalid screen pointer" );
/* Get the widget */
psWidget = widgGetFromID(psScreen, id);
if (psWidget != NULL)
{
switch (psWidget->type)
{
case WIDG_FORM:
ASSERT( FALSE, "widgGetString: Forms do not have a string" );
aStringRetBuffer[0]=0;
break;
case WIDG_LABEL:
strcpy(aStringRetBuffer, ((W_LABEL *)psWidget)->aText);
break;
case WIDG_BUTTON:
if (((W_BUTTON *)psWidget)->pText)
{
strcpy(aStringRetBuffer, ((W_BUTTON *)psWidget)->pText);
}
else
{
case WIDG_FORM:
ASSERT( FALSE, "widgGetString: Forms do not have a string" );
aStringRetBuffer[0] = '\0';
break;
case WIDG_LABEL:
strcpy(aStringRetBuffer, ((W_LABEL *)psWidget)->aText);
break;
case WIDG_BUTTON:
if (((W_BUTTON *)psWidget)->pText)
{
strcpy(aStringRetBuffer, ((W_BUTTON *)psWidget)->pText);
}
else
{
aStringRetBuffer[0]=0;
}
break;
case WIDG_EDITBOX:
strcpy(aStringRetBuffer, ((W_EDITBOX *)psWidget)->aText);
break;
case WIDG_BARGRAPH:
ASSERT( FALSE, "widgGetString: Bar Graphs do not have a string" );
aStringRetBuffer[0]=0;
}
break;
case WIDG_EDITBOX:
strcpy(aStringRetBuffer, ((W_EDITBOX *)psWidget)->aText);
break;
case WIDG_BARGRAPH:
ASSERT( FALSE, "widgGetString: Bar Graphs do not have a string" );
aStringRetBuffer[0]=0;
break;
case WIDG_SLIDER:
ASSERT( FALSE, "widgGetString: Sliders do not have a string" );
aStringRetBuffer[0]=0;
break;
default:
ASSERT( FALSE,"widgGetString: Unknown widget type" );
aStringRetBuffer[0]=0;
break;
break;
case WIDG_SLIDER:
ASSERT( FALSE, "widgGetString: Sliders do not have a string" );
aStringRetBuffer[0]=0;
break;
default:
ASSERT( FALSE,"widgGetString: Unknown widget type" );
aStringRetBuffer[0]=0;
break;
}
}
else
{
ASSERT( FALSE, "widgGetString: couldn't get widget from id" );
aStringRetBuffer[0]=0;
aStringRetBuffer[0] = '\0';
}
return aStringRetBuffer;

View File

@ -148,8 +148,8 @@ typedef struct _w_init
#define TAB_MINOR 0 // Tab types passed into tab display callbacks.
#define TAB_MAJOR 1
typedef void (*TAB_DISPLAY)(WIDGET *psWidget,UDWORD TabType,UDWORD Position,UDWORD Number,BOOL Selected,BOOL Hilight,UDWORD x,UDWORD y,UDWORD Width,UDWORD Height);
typedef void (*FONT_DISPLAY)(UDWORD x,UDWORD y,char *String);
typedef void (*TAB_DISPLAY)(WIDGET *psWidget, UDWORD TabType, UDWORD Position, UDWORD Number, BOOL Selected, BOOL Hilight, UDWORD x, UDWORD y, UDWORD Width, UDWORD Height);
typedef void (*FONT_DISPLAY)(UDWORD x, UDWORD y, char *String);
/* Form initialisation structure */
typedef struct _w_forminit
@ -250,7 +250,7 @@ typedef struct _w_sldinit
UWORD numStops; // Number of stops on the slider
UWORD barSize; // Size of the bar
UWORD pos; // Initial position of the slider bar
char *pTip; // Tip string
const char *pTip; // Tip string
} W_SLDINIT;
/***********************************************************************************/
@ -324,7 +324,7 @@ extern void widgReveal(W_SCREEN *psScreen, UDWORD id);
* This will always return a valid string pointer.
* NOTE: The string must be copied out of the buffer
*/
extern char *widgGetString(W_SCREEN *psScreen, UDWORD id);
extern const char *widgGetString(W_SCREEN *psScreen, UDWORD id);
/* Set the text in a widget */
extern void widgSetString(W_SCREEN *psScreen, UDWORD id, const char *pText);
@ -357,13 +357,13 @@ extern UDWORD widgGetMouseOver(W_SCREEN *psScreen);
extern void *widgGetUserData(W_SCREEN *psScreen, UDWORD id);
/* Set the user data for a widget */
extern void widgSetUserData(W_SCREEN *psScreen, UDWORD id,void *UserData);
extern void widgSetUserData(W_SCREEN *psScreen, UDWORD id, void *UserData);
/* Return the user data for a widget */
UDWORD widgGetUserData2(W_SCREEN *psScreen, UDWORD id);
extern UDWORD widgGetUserData2(W_SCREEN *psScreen, UDWORD id);
/* Set the user data for a widget */
void widgSetUserData2(W_SCREEN *psScreen, UDWORD id,UDWORD UserData);
extern void widgSetUserData2(W_SCREEN *psScreen, UDWORD id,UDWORD UserData);
/* Return the user data for the returned widget */
extern void *widgGetLastUserData(W_SCREEN *psScreen);
@ -372,7 +372,7 @@ extern void *widgGetLastUserData(W_SCREEN *psScreen);
extern WIDGET *widgGetFromID(W_SCREEN *psScreen, UDWORD id);
/* Set tip string for a widget */
extern void widgSetTip( W_SCREEN *psScreen, UDWORD id, char *pTip );
extern void widgSetTip( W_SCREEN *psScreen, UDWORD id, const char *pTip );
/* Colour numbers */
enum _w_colour
@ -456,10 +456,10 @@ extern SWORD WidgGetHilightAudioID(void);
// Get current audio ID for clicked.
extern SWORD WidgGetClickedAudioID(void);
void sliderEnableDrag(BOOL Enable);
extern void sliderEnableDrag(BOOL Enable);
void setWidgetsStatus( BOOL var );
BOOL getWidgetsStatus( void );
extern void setWidgetsStatus( BOOL var );
extern BOOL getWidgetsStatus( void );
#endif

View File

@ -1,4 +1,4 @@
%.tab.h %.tab.c: %.y
%.tab.c: %.y
$(YACC) $(YFLAGS) $(AM_YFLAGS) -o$@ $<
%.lex.c: %.l

View File

@ -90,7 +90,7 @@ extern int scr_lineno;
* Source
*
*********************************************************/
static void calcCheatHash(char *pBuffer, UDWORD size, UDWORD cheat)
static void calcCheatHash(const char *pBuffer, UDWORD size, UDWORD cheat)
{
if(!bMultiPlayer)
{
@ -98,7 +98,7 @@ static void calcCheatHash(char *pBuffer, UDWORD size, UDWORD cheat)
}
// create the hash for that data block.
cheatHash[cheat] =cheatHash[cheat] ^ NEThashBuffer(pBuffer,size);
cheatHash[cheat] = cheatHash[cheat] ^ NEThashBuffer(pBuffer, size);
return;
}
@ -125,7 +125,7 @@ void dataClearSaveFlag(void)
/* Load the body stats */
static BOOL bufferSBODYLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSBODYLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SBODY);
if (!loadBodyStats(pBuffer, size))
@ -151,7 +151,7 @@ static void dataReleaseStats(void *pData)
/* Load the weapon stats */
static BOOL bufferSWEAPONLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSWEAPONLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size, CHEAT_SWEAPON);
if (!loadWeaponStats(pBuffer, size))
@ -170,7 +170,7 @@ static BOOL bufferSWEAPONLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the constructor stats */
static BOOL bufferSCONSTRLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSCONSTRLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SCONSTR);
if (!loadConstructStats(pBuffer, size))
@ -189,7 +189,7 @@ static BOOL bufferSCONSTRLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the ECM stats */
static BOOL bufferSECMLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSECMLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SECM);
@ -209,7 +209,7 @@ static BOOL bufferSECMLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Propulsion stats */
static BOOL bufferSPROPLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSPROPLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SPROP);
@ -229,7 +229,7 @@ static BOOL bufferSPROPLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Sensor stats */
static BOOL bufferSSENSORLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSENSORLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SSENSOR);
@ -249,7 +249,7 @@ static BOOL bufferSSENSORLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Repair stats */
static BOOL bufferSREPAIRLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSREPAIRLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SREPAIR);
@ -269,7 +269,7 @@ static BOOL bufferSREPAIRLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Brain stats */
static BOOL bufferSBRAINLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSBRAINLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SBRAIN);
@ -289,7 +289,7 @@ static BOOL bufferSBRAINLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the PropulsionType stats */
static BOOL bufferSPROPTYPESLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSPROPTYPESLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SPROPTY);
@ -305,7 +305,7 @@ static BOOL bufferSPROPTYPESLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the propulsion type sound stats */
static BOOL bufferSPROPSNDLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSPROPSNDLoad(const char *pBuffer, UDWORD size, void **ppData)
{
if (!loadPropulsionSounds(pBuffer, size))
{
@ -318,7 +318,7 @@ static BOOL bufferSPROPSNDLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the SSPECABIL stats */
static BOOL bufferSSPECABILLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSPECABILLoad(const char *pBuffer, UDWORD size, void **ppData)
{
if (!loadSpecialAbility(pBuffer, size))
{
@ -332,7 +332,7 @@ static BOOL bufferSSPECABILLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the STERRTABLE stats */
static BOOL bufferSTERRTABLELoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSTERRTABLELoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_STERRT);
@ -348,7 +348,7 @@ static BOOL bufferSTERRTABLELoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the body/propulsion IMDs stats */
static BOOL bufferSBPIMDLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSBPIMDLoad(const char *pBuffer, UDWORD size, void **ppData)
{
if (!loadBodyPropulsionIMDs(pBuffer, size))
{
@ -362,7 +362,7 @@ static BOOL bufferSBPIMDLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the weapon sound stats */
static BOOL bufferSWEAPSNDLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSWEAPSNDLoad(const char *pBuffer, UDWORD size, void **ppData)
{
if (!loadWeaponSounds(pBuffer, size))
{
@ -376,7 +376,7 @@ static BOOL bufferSWEAPSNDLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Weapon Effect modifier stats */
static BOOL bufferSWEAPMODLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSWEAPMODLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SWEAPMOD);
@ -393,7 +393,7 @@ static BOOL bufferSWEAPMODLoad(char *pBuffer, UDWORD size, void **ppData)
/* Load the Template stats */
static BOOL bufferSTEMPLLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSTEMPLLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_STEMP);
@ -416,7 +416,7 @@ static void dataSTEMPLRelease(void *pData)
}
/* Load the Template weapons stats */
static BOOL bufferSTEMPWEAPLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSTEMPWEAPLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_STEMPWEAP);
@ -432,7 +432,7 @@ static BOOL bufferSTEMPWEAPLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Structure stats */
static BOOL bufferSSTRUCTLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSTRUCTLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SSTRUCT);
@ -459,7 +459,7 @@ static void dataSSTRUCTRelease(void *pData)
}
/* Load the Structure Weapons stats */
static BOOL bufferSSTRWEAPLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSTRWEAPLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SSTRWEAP);
@ -475,7 +475,7 @@ static BOOL bufferSSTRWEAPLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Structure Functions stats */
static BOOL bufferSSTRFUNCLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSTRFUNCLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_STRFUNC);
@ -491,7 +491,7 @@ static BOOL bufferSSTRFUNCLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Structure strength modifier stats */
static BOOL bufferSSTRMODLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSSTRMODLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SSTRMOD);
@ -506,9 +506,8 @@ static BOOL bufferSSTRMODLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the Feature stats */
static BOOL bufferSFEATLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSFEATLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SFEAT);
if (!loadFeatureStats(pBuffer, size))
@ -516,7 +515,6 @@ static BOOL bufferSFEATLoad(char *pBuffer, UDWORD size, void **ppData)
return FALSE;
}
// set a dummy value so the release function gets called
*ppData = (void *)1;
return TRUE;
@ -529,7 +527,7 @@ static void dataSFEATRelease(void *pData)
}
/* Load the Functions stats */
static BOOL bufferSFUNCLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSFUNCLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_SFUNC);
@ -560,7 +558,7 @@ static void dataRESCHRelease(void *pData)
}
/* Load the Research stats */
static BOOL bufferRESCHLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRESCHLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RESCH);
@ -586,7 +584,7 @@ static BOOL bufferRESCHLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research pre-requisites */
static BOOL bufferRPREREQLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRPREREQLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RPREREQ);
@ -601,7 +599,7 @@ static BOOL bufferRPREREQLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research components made redundant */
static BOOL bufferRCOMPREDLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRCOMPREDLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RCOMPRED);
@ -617,7 +615,7 @@ static BOOL bufferRCOMPREDLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research component results */
static BOOL bufferRCOMPRESLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRCOMPRESLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RCOMPRES);
@ -634,7 +632,7 @@ static BOOL bufferRCOMPRESLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research structures required */
static BOOL bufferRSTRREQLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRSTRREQLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RSTRREQ);
@ -651,7 +649,7 @@ static BOOL bufferRSTRREQLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research structures made redundant */
static BOOL bufferRSTRREDLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRSTRREDLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RSTRRED);
@ -666,7 +664,7 @@ static BOOL bufferRSTRREDLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research structure results */
static BOOL bufferRSTRRESLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRSTRRESLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RSTRRES);
@ -682,7 +680,7 @@ static BOOL bufferRSTRRESLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the research functions */
static BOOL bufferRFUNCLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferRFUNCLoad(const char *pBuffer, UDWORD size, void **ppData)
{
calcCheatHash(pBuffer,size,CHEAT_RFUNC);
@ -699,7 +697,7 @@ static BOOL bufferRFUNCLoad(char *pBuffer, UDWORD size, void **ppData)
}
/* Load the message viewdata */
static BOOL bufferSMSGLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL bufferSMSGLoad(const char *pBuffer, UDWORD size, void **ppData)
{
VIEWDATA *pViewData;
@ -723,10 +721,10 @@ static void dataSMSGRelease(void *pData)
}
/* Load an imd */
static BOOL dataIMDBufferLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL dataIMDBufferLoad(const char *pBuffer, UDWORD size, void **ppData)
{
iIMDShape *psIMD;
char *pBufferPosition = pBuffer;
const char *pBufferPosition = pBuffer;
psIMD = iV_ProcessIMD( &pBufferPosition, pBufferPosition + size );
if (psIMD == NULL) {
@ -1057,7 +1055,7 @@ static void dataStrResRelease(void *pData)
/* Load a script file */
// All scripts, binary or otherwise are now passed through this routine
static BOOL dataScriptLoad(char *pBuffer, UDWORD size, void **ppData)
static BOOL dataScriptLoad(const char *pBuffer, UDWORD size, void **ppData)
{
SCRIPT_CODE *psProg=NULL;
BOOL printHack = FALSE;
@ -1084,7 +1082,7 @@ static BOOL dataScriptLoad(char *pBuffer, UDWORD size, void **ppData)
}
// Load a script variable values file
static BOOL dataScriptLoadVals(char *pBuffer, UDWORD size, void **ppData)
static BOOL dataScriptLoadVals(const char *pBuffer, UDWORD size, void **ppData)
{
*ppData = NULL;

View File

@ -1512,8 +1512,8 @@ intChooseSystemStats( DROID_TEMPLATE *psTemplate )
static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
{
COMP_BASE_STATS *psStats;
char *pStr;
COMP_BASE_STATS *psStats = NULL;
/*
First we check for the special cases of the Transporter & Cyborgs
*/
@ -1521,13 +1521,12 @@ static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
{
return _("Transporter");
}
/*
Now get the normal default droid name based on its components
*/
aCurrName[0]=0; // Reset string to null
aCurrName[0] = '\0'; // Reset string to null
psStats = intChooseSystemStats( psTemplate );
if ( psTemplate->asWeaps[0] != 0 ||
psTemplate->asParts[COMP_CONSTRUCT] != 0 ||
psTemplate->asParts[COMP_SENSOR] != 0 ||
@ -1535,11 +1534,9 @@ static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
psTemplate->asParts[COMP_REPAIRUNIT] != 0 ||
psTemplate->asParts[COMP_BRAIN] != 0 )
{
pStr = getStatName( psStats );
const char * pStr = getStatName( psStats );
strcpy( aCurrName, pStr );
strcat( aCurrName, " " );
// DBPRINTF(("%s",aCurrName));
// DBPRINTF(("a) templ=%p stat=%p name=%s\n",psTemplate,psStats,pStr);
}
if ( psTemplate->numWeaps > 1 )
@ -1550,7 +1547,7 @@ static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
psStats = (COMP_BASE_STATS *) (asBodyStats + psTemplate->asParts[COMP_BODY]);
if ( psTemplate->asParts[COMP_BODY] != 0 )
{
pStr = getStatName( psStats );
const char * pStr = getStatName( psStats );
if ( strlen( aCurrName ) + strlen( pStr ) > WIDG_MAXSTR )
{
@ -1560,13 +1557,12 @@ static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
strcat( aCurrName, pStr );
strcat( aCurrName, " " );
// DBPRINTF(("b) templ=%p stat=%p name=%s\n",psTemplate,psStats,pStr);
}
psStats = (COMP_BASE_STATS *) (asPropulsionStats + psTemplate->asParts[COMP_PROPULSION]);
if ( psTemplate->asParts[COMP_PROPULSION] != 0 )
{
pStr = getStatName( psStats );
const char * pStr = getStatName( psStats );
if ( strlen( aCurrName ) + strlen( pStr ) > WIDG_MAXSTR )
{
@ -1575,11 +1571,8 @@ static const char *GetDefaultTemplateName(DROID_TEMPLATE *psTemplate)
}
strcat( aCurrName, pStr );
// DBPRINTF(("c) templ=%p stat=%p name=%s\n",psTemplate,psStats,pStr);
}
// DBPRINTF(("TEMPLATE NAME [%s]\n",aCurrName);
return aCurrName;
}
@ -3054,12 +3047,9 @@ static BOOL intAddExtraSystemButtons(UDWORD sensorIndex, UDWORD ecmIndex,
/* Set the bar graphs for the system clickable */
static void intSetSystemStats(COMP_BASE_STATS *psStats)
{
W_FORM *psForm;
W_FORM *psForm;
ASSERT( psStats != NULL,
// (((UBYTE *)psStats >= (UBYTE *)asCommandDroids) &&
// ((UBYTE *)psStats < (UBYTE *)asCommandDroids + sizeof(asCommandDroids))),
"intSetSystemStats: Invalid stats pointer" );
ASSERT( psStats != NULL, "intSetSystemStats: Invalid stats pointer" );
/* set form tip to stats string */
widgSetTip( psWScreen, IDDES_SYSTEMFORM, getStatName(psStats) );

View File

@ -159,22 +159,16 @@ static void featureType(FEATURE_STATS* psFeature, char *pType)
}
/* Load the feature stats */
BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
BOOL loadFeatureStats(const char *pFeatureData, UDWORD bufferSize)
{
char *pData;
FEATURE_STATS *psFeature;
UDWORD i;
unsigned int i;
char featureName[MAX_NAME_SIZE], GfxFile[MAX_NAME_SIZE],
type[MAX_NAME_SIZE];
//compName[MAX_NAME_SIZE], compType[MAX_NAME_SIZE];
//keep the start so we release it at the end
pData = pFeatureData;
numFeatureStats = numCR(pFeatureData, bufferSize);
asFeatureStats = (FEATURE_STATS *)malloc(sizeof(FEATURE_STATS)*
numFeatureStats);
asFeatureStats = (FEATURE_STATS*)malloc(sizeof(FEATURE_STATS) * numFeatureStats);
if (asFeatureStats == NULL)
{
@ -184,32 +178,26 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
}
psFeature = asFeatureStats;
for (i=0; i < numFeatureStats; i++)
for (i = 0; i < numFeatureStats; i++)
{
UDWORD Width,Breadth;
UDWORD Width, Breadth;
memset(psFeature, 0, sizeof(FEATURE_STATS));
featureName[0] = '\0';
GfxFile[0] = '\0';
type[0] = '\0';
//read the data into the storage - the data is delimeted using comma's
/* sscanf(pFeatureData,"%[^','],%d,%d,%d,%d,%d,%[^','],%[^','],%[^','],%[^','],%d,%d,%d",
&featureName, &psFeature->baseWidth, &psFeature->baseBreadth,
&psFeature->damageable, &psFeature->armour, &psFeature->body,
&GfxFile, &type, &compType, &compName,
&psFeature->tileDraw, &psFeature->allowLOS, &psFeature->visibleAtStart);*/
//read the data into the storage - the data is delimeted using comma's
sscanf(pFeatureData,"%[^','],%d,%d,%d,%d,%d,%[^','],%[^','],%d,%d,%d",
featureName, &Width, &Breadth,
&psFeature->damageable, &psFeature->armour, &psFeature->body,
GfxFile, type, &psFeature->tileDraw, &psFeature->allowLOS,
&psFeature->visibleAtStart);
// These are now only 16 bits wide - so we need to copy them
psFeature->baseWidth=(UWORD)Width;
psFeature->baseBreadth=(UWORD)Breadth;
psFeature->baseWidth = (UWORD)Width;
psFeature->baseBreadth = (UWORD)Breadth;
if (!allocateName(&psFeature->pName, featureName))
{
@ -221,11 +209,7 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
//need to know which is the wrecked droid and wrecked structure for later use
//the last stat of each type is used
/*if (psFeature->subType == FEAT_DROID)
{
droidFeature = i;
}
else */if (psFeature->subType == FEAT_BUILD_WRECK)
if (psFeature->subType == FEAT_BUILD_WRECK)
{
structFeature = i;
}
@ -244,13 +228,6 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
return FALSE;
}
//sort out the component - if any
/*if (strcmp(compType, "0"))
{
psFeature->compType = componentType(compType);
psFeature->compIndex = getCompFromName(psFeature->compType, compName);
}*/
psFeature->ref = REF_FEATURE_START + i;
//increment the pointer to the start of the next record
@ -259,362 +236,7 @@ BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize)
psFeature++;
}
// free(pData);
return TRUE;
/* Allocate the stats Array */
/* numFeatureStats = 19;
asFeatureStats = (FEATURE_STATS *)malloc(sizeof(FEATURE_STATS) * numFeatureStats);
if (!asFeatureStats)
{
DBERROR(("Out of memory"));
return FALSE;
}
memset(asFeatureStats, 0, sizeof(FEATURE_STATS) * numFeatureStats);
// Create some simple stats
ref = REF_FEATURE_START;
psStats = asFeatureStats;
psStats->pName = "Mesa Feature";
psStats->ref = ref ++;
psStats->subType = FEAT_MESA;
psStats->baseWidth = 6;
psStats->baseBreadth = 4;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mimesa1.imd");
psStats++;
psStats->pName = "Mesa Feature 2";
psStats->ref = ref ++;
psStats->subType = FEAT_MESA2;
psStats->baseWidth = 5;
psStats->baseBreadth = 4;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mimesa2.imd");
psStats++;
psStats->pName = "Cliff";
psStats->ref = ref ++;
psStats->subType = FEAT_CLIFF;
psStats->baseWidth = 7;
psStats->baseBreadth = 7;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "micliff.imd");
psStats++;
psStats->pName = "Stack";
psStats->ref = ref ++;
psStats->subType = FEAT_STACK;
psStats->baseWidth = 2;
psStats->baseBreadth = 2;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mistack.imd");
psStats++;
psStats->pName = "Wrecked Building";
psStats->ref = ref ++;
psStats->subType = FEAT_BUILD_WRECK1;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miwreck.imd");
psStats++;
psStats->pName = "Wrecked Hovercraft";
psStats->ref = ref ++;
psStats->subType = FEAT_HOVER;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miarthov.imd");
// Find the hover component for it
psStats->compType = COMP_PROPULSION;
for(comp=0; comp<numPropulsionStats; comp++)
{
if (strcmp(asPropulsionStats[comp].pName, "Hover Propulsion") == 0)
{
psStats->compIndex = comp;
}
}
psStats++;
psStats->pName = "Wrecked Tank";
psStats->ref = ref ++;
psStats->subType = FEAT_TANK;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miartecm.imd");
// Find the ecm component for it
psStats->compType = COMP_ECM;
for(comp=0; comp<numECMStats; comp++)
{
if (strcmp(asECMStats[comp].pName, "Heavy ECM #1") == 0)
{
psStats->compIndex = comp;
}
}
psStats++;
psStats->pName = "Generic Artefact";
psStats->ref = ref ++;
psStats->subType = FEAT_GEN_ARTE;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "miartgen.imd");
psStats++;
psStats->pName = "Oil Resource";
psStats->ref = ref ++;
psStats->subType = FEAT_OIL_RESOURCE;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "mislick.imd");
psStats++;
psStats->pName = "Boulder 1";
psStats->ref = ref ++;
psStats->subType = FEAT_BOULDER1;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mibould1.imd");
psStats++;
psStats->pName = "Boulder 2";
psStats->ref = ref ++;
psStats->subType = FEAT_BOULDER2;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mibould2.imd");
psStats++;
psStats->pName = "Boulder 3";
psStats->ref = ref ++;
psStats->subType = FEAT_BOULDER3;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mibould3.imd");
psStats++;
psStats->pName = "Futuristic Car";
psStats->ref = ref ++;
psStats->subType = FEAT_FUTCAR;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mifutcar.imd");
psStats++;
psStats->pName = "Fururistic Van";
psStats->ref = ref ++;
psStats->subType = FEAT_FUTVAN;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "mifutvan.imd");
psStats++;
psStats->pName = "Wrecked Droid Hub";
psStats->ref = ref ++;
psStats->subType = FEAT_DROID;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "drwreck.imd");
//Value is stored for easy access to this feature in destroyDroid()
droidFeature = psStats - asFeatureStats;
psStats++;
//Value is stored for easy access to this feature in destroyStruct
structFeature = psStats - asFeatureStats;
psStats->pName = "Wrecked Building1";
psStats->ref = ref++;
psStats->subType = FEAT_BUILD_WRECK1;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miwrek1.imd");
psStats++;
psStats->pName = "Wrecked Building2";
psStats->ref = ref++;
psStats->subType = FEAT_BUILD_WRECK2;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miwrek2.imd");
psStats++;
psStats->pName = "Wrecked Building3";
psStats->ref = ref++;
psStats->subType = FEAT_BUILD_WRECK3;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miwrek3.imd");
psStats++;
psStats->pName = "Wrecked Building4";
psStats->ref = ref++;
psStats->subType = FEAT_BUILD_WRECK4;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = FALSE;
psStats->allowLOS = TRUE;
psStats->psImd = resGetData("IMD", "miwrek4.imd");
// These are test features for the LOS code
psStats++;
psStats->pName = "Cube 1,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_1_1.imd");
psStats++;
psStats->pName = "Cube 1,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_1_3.imd");
psStats++;
psStats->pName = "Cube 2,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 2;
psStats->baseBreadth = 2;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_2_1.imd");
psStats++;
psStats->pName = "Cube 2,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 2;
psStats->baseBreadth = 2;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_2_3.imd");
psStats++;
psStats->pName = "Cube 3,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 3;
psStats->baseBreadth = 3;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_3_1.imd");
psStats++;
psStats->pName = "Cube 3,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 3;
psStats->baseBreadth = 3;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cube_3_3.imd");
psStats++;
psStats->pName = "Cyl 1,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_1_1.imd");
psStats++;
psStats->pName = "Cyl 1,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 1;
psStats->baseBreadth = 1;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_1_3.imd");
psStats++;
psStats->pName = "Cyl 2,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 2;
psStats->baseBreadth = 2;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_2_1.imd");
psStats++;
psStats->pName = "Cyl 2,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 2;
psStats->baseBreadth = 2;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_2_3.imd");
psStats++;
psStats->pName = "Cyl 3,1";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 3;
psStats->baseBreadth = 3;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_3_1.imd");
psStats++;
psStats->pName = "Cyl 3,3";
psStats->ref = ref++;
psStats->subType = FEAT_LOS_OBJ;
psStats->baseWidth = 3;
psStats->baseBreadth = 3;
psStats->tileDraw = TRUE;
psStats->allowLOS = FALSE;
psStats->psImd = resGetData("IMD", "cyl_3_3.imd");
psStats++;
ASSERT( psStats - asFeatureStats == (SDWORD)numFeatureStats,
"loadFeatureStats: incorrect number of features" );
return TRUE;*/
}
/* Release the feature stats memory */
@ -1159,18 +781,17 @@ void destroyFeature(FEATURE *psDel)
removeFeature(psDel);
}
SDWORD getFeatureStatFromName( char *pName )
SDWORD getFeatureStatFromName( const char *pName )
{
UDWORD inc;
FEATURE_STATS *psStat;
unsigned int inc;
FEATURE_STATS *psStat;
#ifdef RESOURCE_NAMES
if (!getResourceName(pName))
{
return -1;
}
#endif
for (inc = 0; inc < numFeatureStats; inc++)
@ -1184,6 +805,7 @@ SDWORD getFeatureStatFromName( char *pName )
return -1;
}
/*looks around the given droid to see if there is any building
wreckage to clear*/
FEATURE * checkForWreckage(DROID *psDroid)

View File

@ -40,7 +40,7 @@ extern UDWORD structFeature;
extern UDWORD oilResFeature;
/* Load the feature stats */
extern BOOL loadFeatureStats(char *pFeatureData, UDWORD bufferSize);
extern BOOL loadFeatureStats(const char *pFeatureData, UDWORD bufferSize);
/* Release the feature stats memory */
extern void featureStatsShutDown(void);
@ -64,9 +64,9 @@ extern void removeFeature(FEATURE *psDel);
extern void destroyFeature(FEATURE *psDel);
/* get a feature stat id from its name */
extern SDWORD getFeatureStatFromName( char *pName );
extern SDWORD getFeatureStatFromName(const char *pName);
/*looks around the given droid to see if there is any building
/*looks around the given droid to see if there is any building
wreckage to clear*/
extern FEATURE * checkForWreckage(DROID *psDroid);

File diff suppressed because it is too large Load Diff

View File

@ -30,59 +30,10 @@
//holder for all functions
extern FUNCTION **asFunctions;
extern UDWORD numFunctions;
extern FUNCTION **asFunctions;
extern UDWORD numFunctions;
//lists the current Upgrade level that can be applied to a structure through research
//extern FUNCTION_UPGRADE *apProductionUpgrades[MAX_PLAYERS];
//extern UDWORD numProductionUpgrades;
//extern FUNCTION_UPGRADE *apResearchUpgrades[MAX_PLAYERS];
//extern UDWORD numResearchUpgrades;
//extern FUNCTION_UPGRADE *apArmourUpgrades[MAX_PLAYERS];
//extern UDWORD numArmourUpgrades;
//extern FUNCTION_UPGRADE *apBodyUpgrades[MAX_PLAYERS];
//extern UDWORD numBodyUpgrades;
//extern FUNCTION_UPGRADE *apRepairUpgrades[MAX_PLAYERS];
//extern UDWORD numRepairUpgrades;
//extern FUNCTION_UPGRADE *apResistanceUpgrades[MAX_PLAYERS];
//extern UDWORD numResistanceUpgrades;
//extern FUNCTION_UPGRADE *apWeaponUpgrades[MAX_PLAYERS];
//extern UDWORD numWeaponUpgrades;
extern BOOL loadFunctionStats(char *pFunctionData, UDWORD bufferSize);
//load the specific stats for each function
extern BOOL loadRepairDroidFunction(char *pData);
extern BOOL loadPowerGenFunction(char *pData);
extern BOOL loadResourceFunction(char *pData);
extern BOOL loadProduction(char *pData);
extern BOOL loadProductionUpgradeFunction(char *pData);
extern BOOL loadResearchFunction(char *pData);
extern BOOL loadResearchUpgradeFunction(char *pData);
extern BOOL loadHQFunction(char *pData);
extern BOOL loadWeaponUpgradeFunction(char *pData);
extern BOOL loadWallFunction(char *pData);
extern BOOL loadStructureUpgradeFunction(char *pData);
extern BOOL loadWallDefenceUpgradeFunction(char *pData);
extern BOOL loadRepairUpgradeFunction(char *pData);
extern BOOL loadPowerUpgradeFunction(char *pData);
extern BOOL loadDroidRepairUpgradeFunction(char *pData);
extern BOOL loadDroidECMUpgradeFunction(char *pData);
extern BOOL loadDroidBodyUpgradeFunction(char *pData);
extern BOOL loadDroidSensorUpgradeFunction(char *pData);
extern BOOL loadDroidConstUpgradeFunction(char *pData);
extern BOOL loadReArmFunction(char *pData);
extern BOOL loadReArmUpgradeFunction(char *pData);
//extern BOOL loadFunction(char *pData, UDWORD functionType);
//extern BOOL loadDefensiveStructFunction(char *pData);
//extern BOOL loadArmourUpgradeFunction(char *pData);
//extern BOOL loadPowerRegFunction(char *pData);
//extern BOOL loadPowerRelayFunction(char *pData);
//extern BOOL loadRadarMapFunction(char *pData);
//extern BOOL loadRepairUpgradeFunction(char *pData);
//extern BOOL loadResistanceUpgradeFunction(char *pData);
//extern BOOL loadBodyUpgradeFunction(char *pData);
extern BOOL loadFunctionStats(const char *pFunctionData, UDWORD bufferSize);
extern void productionUpgrade(FUNCTION *pFunction, UBYTE player);
extern void researchUpgrade(FUNCTION *pFunction, UBYTE player);
@ -110,14 +61,9 @@ extern void bodyUpgrade(FUNCTION *pFunction, UBYTE player);
extern void droidSensorUpgrade(DROID *psDroid);
extern void droidECMUpgrade(DROID *psDroid);
extern void droidBodyUpgrade(FUNCTION *pFunction, DROID *psDroid);
extern void upgradeTransporterDroids(DROID *psTransporter,
extern void upgradeTransporterDroids(DROID *psTransporter,
void(*pUpgradeFunction)(DROID *psDroid));
//extern void armourUpgrade(FUNCTION *pFunction, STRUCTURE *psBuilding);
//extern void repairUpgrade(FUNCTION *pFunction, STRUCTURE *psBuilding);
//extern void bodyUpgrade(FUNCTION *pFunction, STRUCTURE *psBuilding);
//extern void resistanceUpgrade(FUNCTION *pFunction, STRUCTURE *psBuilding);
extern BOOL FunctionShutDown(void);
#endif //_function_h

View File

@ -44,8 +44,8 @@ static char aText[YYLMAX];
static BOOL inComment = FALSE;
/* Pointer to the input buffer */
static char *pInputBuffer = NULL;
static char *pEndBuffer = NULL;
static const char *pInputBuffer = NULL;
static const char *pEndBuffer = NULL;
#define YY_INPUT(buf, result, max_size) \
if (pInputBuffer != pEndBuffer) { \

View File

@ -508,7 +508,7 @@ static BOOL addToViewDataList(VIEWDATA *psViewData, UBYTE numData)
}
/*load the view data for the messages from the file */
VIEWDATA *loadViewData(char *pViewMsgData, UDWORD bufferSize)
VIEWDATA *loadViewData(const char *pViewMsgData, UDWORD bufferSize)
{
UDWORD i, id, dataInc, seqInc, numFrames, numData, count, count2;
VIEWDATA *psViewData, *pData;
@ -894,14 +894,12 @@ VIEWDATA *loadViewData(char *pViewMsgData, UDWORD bufferSize)
}
/*get the view data identified by the name */
VIEWDATA * getViewData(char *pName)
VIEWDATA * getViewData(const char *pName)
{
//VIEWDATA *psViewData;// = asViewData;
VIEWDATA_LIST *psList;
//UDWORD i;
UBYTE i;
VIEWDATA_LIST *psList = NULL;
unsigned int i = 0;
ASSERT( strlen(pName)< MAX_STR_SIZE,"getViewData: verbose message name" );
ASSERT( strlen(pName) < MAX_STR_SIZE, "getViewData: verbose message name" );
for (psList = apsViewData; psList != NULL; psList = psList->psNext)
{

View File

@ -33,7 +33,7 @@
/* The lists of messages allocated */
extern MESSAGE *apsMessages[MAX_PLAYERS];
/* The current tutorial message - there is only ever one at a time. They are displayed
/* The current tutorial message - there is only ever one at a time. They are displayed
when called by the script. They are not to be re-displayed*/
//extern MESSAGE tutorialMessage;
/* The IMD to use for the proximity messages */
@ -63,16 +63,16 @@ extern void freeMessages(void);
extern void releaseAllProxDisp(void);
/*load the view data for the messages from the file exported from the world editor*/
extern VIEWDATA* loadViewData(char *pViewMsgData, UDWORD bufferSize);
extern VIEWDATA* loadViewData(const char *pViewMsgData, UDWORD bufferSize);
/*get the view data that contains the text message pointer passed in */
extern VIEWDATA* getViewData(char *pTextMsg);
extern VIEWDATA* getViewData(const char *pTextMsg);
/* Release the viewdata memory */
extern void viewDataShutDown(VIEWDATA *psViewData);
//extern void storeProximityScreenCoords(MESSAGE *psMessage, SDWORD x, SDWORD y);
extern PROXIMITY_DISPLAY * getProximityDisplay(MESSAGE *psMessage);
/* Looks through the players list of messages to find one with the same viewData
/* Looks through the players list of messages to find one with the same viewData
pointer and which is the same type of message - used in scriptFuncs */
extern MESSAGE* findMessage(MSG_VIEWDATA *pViewdata, MESSAGE_TYPE type, UDWORD player);

File diff suppressed because it is too large Load Diff

View File

@ -85,17 +85,15 @@ extern UDWORD aDefaultECM[MAX_PLAYERS];
extern UDWORD aDefaultRepair[MAX_PLAYERS];
//extern BOOL loadResearch(void);
extern BOOL loadResearch(char *pResearchData, UDWORD bufferSize);
extern BOOL loadResearch(const char *pResearchData, UDWORD bufferSize);
//Load the pre-requisites for a research list
extern BOOL loadResearchPR(char *pPRData, UDWORD bufferSize);
extern BOOL loadResearchPR(const char *pPRData, UDWORD bufferSize);
//Load the artefacts for a research list
extern BOOL loadResearchArtefacts(char *pArteData, UDWORD bufferSize,
UDWORD listNumber);
extern BOOL loadResearchArtefacts(const char *pArteData, UDWORD bufferSize, UDWORD listNumber);
//Load the pre-requisites for a research list
extern BOOL loadResearchFunctions(char *pFunctionData, UDWORD bufferSize);
extern BOOL loadResearchFunctions(const char *pFunctionData, UDWORD bufferSize);
//Load the Structures for a research list
extern BOOL loadResearchStructures(char *pStructData, UDWORD bufferSize,
UDWORD listNumber);
extern BOOL loadResearchStructures(const char *pStructData, UDWORD bufferSize, UDWORD listNumber);
/*function to check what can be researched for a particular player at any one
instant. Returns the number to research*/
@ -114,7 +112,7 @@ extern BOOL ResearchShutDown(void);
extern BOOL ResearchRelease(void);
/* For a given view data get the research this is related to */
extern RESEARCH * getResearch(char *pName, BOOL resName);
extern RESEARCH * getResearch(const char *pName, BOOL resName);
/* sets the status of the topic to cancelled and stores the current research
points accquired */

View File

@ -258,9 +258,9 @@ BOOL scrvGetBaseObj(UDWORD id, BASE_OBJECT **ppsObj)
}
// Find a string from it's (string)id
BOOL scrvGetString(char *pStringID, char **ppString)
BOOL scrvGetString(const char *pStringID, char **ppString)
{
UDWORD id;
UDWORD id;
//get the ID for the string
if (!strresGetIDNum(psStringRes, pStringID, &id))
@ -269,6 +269,7 @@ BOOL scrvGetString(char *pStringID, char **ppString)
abort();
return FALSE;
}
//get the string from the id
*ppString = strresGetString(psStringRes, id);

View File

@ -53,7 +53,7 @@ typedef struct _array_indexes
} ARRAY_INDEXES;
/* Set the current input buffer for the lexer */
extern void scrvSetInputBuffer(char *pBuffer, UDWORD size);
extern void scrvSetInputBuffer(const char *pBuffer, UDWORD size);
extern void scrvGetErrorData(int *pLine, char **ppText);
@ -66,13 +66,13 @@ extern void scrv_error(const char *pMessage,...);
extern int scrv_parse(void);
// Lookup a type
extern BOOL scrvLookUpType(char *pIdent, INTERP_TYPE *pType);
extern BOOL scrvLookUpType(const char *pIdent, INTERP_TYPE *pType);
// Lookup a variable identifier
extern BOOL scrvLookUpVar(char *pIdent, UDWORD *pIndex);
extern BOOL scrvLookUpVar(const char *pIdent, UDWORD *pIndex);
// Lookup an array identifier
extern BOOL scrvLookUpArray(char *pIdent, UDWORD *pIndex);
extern BOOL scrvLookUpArray(const char *pIdent, UDWORD *pIndex);
// Whether the script is run immediately or stored for later use
typedef enum _scrv_type
@ -112,7 +112,7 @@ extern void scrvShutDown(void);
extern void scrvReset(void);
// Load a script value file
extern BOOL scrvLoad(char *pData, UDWORD size);
extern BOOL scrvLoad(const char *pData, UDWORD size);
// Link any object types to the actual pointer values
//extern BOOL scrvLinkValues(void);
@ -121,6 +121,6 @@ extern BOOL scrvLoad(char *pData, UDWORD size);
extern BOOL scrvGetBaseObj(UDWORD id, BASE_OBJECT **ppsObj);
// Find a string from it's (string)id
extern BOOL scrvGetString(char *pStringID, char **ppString);
extern BOOL scrvGetString(const char *pStringID, char **ppString);
#endif

View File

@ -47,8 +47,8 @@ static UDWORD currText=0;
static BOOL inComment = FALSE;
/* Pointer to the input buffer */
static char *pInputBuffer = NULL;
static char *pEndBuffer = NULL;
static const char *pInputBuffer = NULL;
static const char *pEndBuffer = NULL;
#define YY_INPUT(buf,result,max_size) \
if (pInputBuffer != pEndBuffer) { \
@ -151,7 +151,7 @@ FALSE { scrv_lval.bval = FALSE; return BOOLEAN_T; }
%%
/* Set the current input buffer for the lexer */
void scrvSetInputBuffer(char *pBuffer, UDWORD size)
void scrvSetInputBuffer(const char *pBuffer, UDWORD size)
{
pInputBuffer = pBuffer;
pEndBuffer = pBuffer + size;

View File

@ -757,7 +757,7 @@ var_value: BOOLEAN_T
%%
// Lookup a type
BOOL scrvLookUpType(char *pIdent, INTERP_TYPE *pType)
BOOL scrvLookUpType(const char *pIdent, INTERP_TYPE *pType)
{
TYPE_SYMBOL *psCurr;
@ -775,7 +775,7 @@ BOOL scrvLookUpType(char *pIdent, INTERP_TYPE *pType)
// Lookup a variable identifier
BOOL scrvLookUpVar(char *pIdent, UDWORD *pIndex)
BOOL scrvLookUpVar(const char *pIdent, UDWORD *pIndex)
{
UDWORD i;
@ -799,7 +799,7 @@ BOOL scrvLookUpVar(char *pIdent, UDWORD *pIndex)
// Lookup an array identifier
BOOL scrvLookUpArray(char *pIdent, UDWORD *pIndex)
BOOL scrvLookUpArray(const char *pIdent, UDWORD *pIndex)
{
UDWORD i;
@ -823,7 +823,7 @@ BOOL scrvLookUpArray(char *pIdent, UDWORD *pIndex)
// Load a script value file
BOOL scrvLoad(char *pData, UDWORD size)
BOOL scrvLoad(const char *pData, UDWORD size)
{
scrvSetInputBuffer(pData, size);

File diff suppressed because it is too large Load Diff

View File

@ -153,55 +153,55 @@ extern UWORD weaponROF(WEAPON_STATS *psStat);
extern UDWORD numCR(const char *pFileBuffer, UDWORD fileSize);
/*Load the weapon stats from the file exported from Access*/
extern BOOL loadWeaponStats(char *pWeaponData, UDWORD bufferSize);
extern BOOL loadWeaponStats(const char *pWeaponData, UDWORD bufferSize);
/*Load the armour stats from the file exported from Access*/
//extern BOOL loadArmourStats(void);
/*Load the body stats from the file exported from Access*/
extern BOOL loadBodyStats(char *pBodyData, UDWORD bufferSize);
extern BOOL loadBodyStats(const char *pBodyData, UDWORD bufferSize);
/*Load the brain stats from the file exported from Access*/
extern BOOL loadBrainStats(char *pBrainData, UDWORD bufferSize);
extern BOOL loadBrainStats(const char *pBrainData, UDWORD bufferSize);
/*Load the power stats from the file exported from Access*/
//extern BOOL loadPowerStats(void);
/*Load the propulsion stats from the file exported from Access*/
extern BOOL loadPropulsionStats(char *pPropulsionData, UDWORD bufferSize);
extern BOOL loadPropulsionStats(const char *pPropulsionData, UDWORD bufferSize);
/*Load the sensor stats from the file exported from Access*/
extern BOOL loadSensorStats(char *pSensorData, UDWORD bufferSize);
extern BOOL loadSensorStats(const char *pSensorData, UDWORD bufferSize);
/*Load the ecm stats from the file exported from Access*/
extern BOOL loadECMStats(char *pECMData, UDWORD bufferSize);
extern BOOL loadECMStats(const char *pECMData, UDWORD bufferSize);
/*Load the repair stats from the file exported from Access*/
extern BOOL loadRepairStats(char *pRepairData, UDWORD bufferSize);
extern BOOL loadRepairStats(const char *pRepairData, UDWORD bufferSize);
/*Load the construct stats from the file exported from Access*/
extern BOOL loadConstructStats(char *pConstructData, UDWORD bufferSize);
extern BOOL loadConstructStats(const char *pConstructData, UDWORD bufferSize);
/*Load the Propulsion Types from the file exported from Access*/
extern BOOL loadPropulsionTypes(char *pPropTypeData, UDWORD bufferSize);
extern BOOL loadPropulsionTypes(const char *pPropTypeData, UDWORD bufferSize);
/*Load the propulsion sounds from the file exported from Access*/
extern BOOL loadPropulsionSounds(char *pSoundData, UDWORD bufferSize);
extern BOOL loadPropulsionSounds(const char *pSoundData, UDWORD bufferSize);
/*Load the Terrain Table from the file exported from Access*/
extern BOOL loadTerrainTable(char *pTerrainTableData, UDWORD bufferSize);
extern BOOL loadTerrainTable(const char *pTerrainTableData, UDWORD bufferSize);
/*Load the Special Ability stats from the file exported from Access*/
extern BOOL loadSpecialAbility(char *pSAbilityData, UDWORD bufferSize);
extern BOOL loadSpecialAbility(const char *pSAbilityData, UDWORD bufferSize);
/* load the IMDs to use for each body-propulsion combination */
extern BOOL loadBodyPropulsionIMDs(char *pData, UDWORD bufferSize);
extern BOOL loadBodyPropulsionIMDs(const char *pData, UDWORD bufferSize);
/*Load the weapon sounds from the file exported from Access*/
extern BOOL loadWeaponSounds(char *pSoundData, UDWORD bufferSize);
extern BOOL loadWeaponSounds(const char *pSoundData, UDWORD bufferSize);
/*Load the Weapon Effect Modifiers from the file exported from Access*/
extern BOOL loadWeaponModifiers(char *pWeapModData, UDWORD bufferSize);
extern BOOL loadWeaponModifiers(const char *pWeapModData, UDWORD bufferSize);
/*******************************************************************************
* Set stats functions
*******************************************************************************/
@ -260,7 +260,7 @@ extern CONSTRUCT_STATS *statsGetConstruct(UDWORD ref);
extern BOOL statsShutDown(void);
/*Deallocate the stats passed in as parameter */
extern void statsDealloc(COMP_BASE_STATS* pStats, UDWORD listSize,
extern void statsDealloc(COMP_BASE_STATS* pStats, UDWORD listSize,
UDWORD structureSize);
extern void deallocPropulsionTypes(void);
@ -275,32 +275,32 @@ extern UDWORD statType(UDWORD ref);
//return the REF_START value of this type of stat
extern UDWORD statRefStart(UDWORD stat);
/*Returns the component type based on the string - used for reading in data */
extern UDWORD componentType(char* pType);
extern UDWORD componentType(const char* pType);
//get the component Inc for a stat based on the name
extern SDWORD getCompFromName(UDWORD compType, char *pName);
extern SDWORD getCompFromName(UDWORD compType, const char *pName);
//get the component Inc for a stat based on the Resource name held in Names.txt
extern SDWORD getCompFromResName(UDWORD compType, char *pName);
extern SDWORD getCompFromResName(UDWORD compType, const char *pName);
/*sets the tech level for the stat passed in */
extern BOOL setTechLevel(BASE_STATS *psStats, char *pLevel);
/*returns the weapon sub class based on the string name passed in */
extern WEAPON_SUBCLASS getWeaponSubClass(char *pSubClass);
extern WEAPON_SUBCLASS getWeaponSubClass(const char *pSubClass);
/*either gets the name associated with the resource (if one) or allocates space and copies pName*/
extern BOOL allocateName(char **ppStore, char *pName);
extern BOOL allocateName(char **ppStore, const char *pName);
//converts the name read in from Access into the name which is used in the Stat lists (or ignores it)
extern BOOL getResourceName(char *pName);
extern BOOL getResourceName(const char *pName);
/*return the name to display for the interface - valid for OBJECTS and STATS*/
extern char* getName(char *pNameID);
/*sets the store to the body size based on the name passed in - returns FALSE
extern const char* getName(const char *pNameID);
/*sets the store to the body size based on the name passed in - returns FALSE
if doesn't compare with any*/
extern BOOL getBodySize(char *pSize, UBYTE *pStore);
extern BOOL getBodySize(const char *pSize, UBYTE *pStore);
// Pass in a stat and get its name
extern char* getStatName(void * pStat);
extern const char* getStatName(void * pStat);
/*returns the propulsion type based on the string name passed in */
extern PROPULSION_TYPE getPropulsionType(char *pType);
extern PROPULSION_TYPE getPropulsionType(const char *pType);
/*returns the weapon effect based on the string name passed in */
extern WEAPON_EFFECT getWeaponEffect(char *pWeaponEffect);
extern WEAPON_EFFECT getWeaponEffect(const char *pWeaponEffect);
extern UWORD weaponROF(WEAPON_STATS *psStat);
/*Access functions for the upgradeable stats of a weapon*/
@ -322,13 +322,13 @@ extern UDWORD repairPoints(REPAIR_STATS *psStats, UBYTE player);
extern UDWORD constructorPoints(CONSTRUCT_STATS *psStats, UBYTE player);
/*Access functions for the upgradeable stats of a body*/
extern UDWORD bodyPower(BODY_STATS *psStats, UBYTE player, UBYTE bodyType);
extern UDWORD bodyArmour(BODY_STATS *psStats, UBYTE player, UBYTE bodyType,
extern UDWORD bodyArmour(BODY_STATS *psStats, UBYTE player, UBYTE bodyType,
WEAPON_CLASS weaponClass, int side);
/*dummy function for John*/
extern void brainAvailable(BRAIN_STATS *psStat);
void adjustMaxDesignStats(void);
extern void adjustMaxDesignStats(void);
//Access functions for the max values to be used in the Design Screen
extern UDWORD getMaxComponentWeight(void);

View File

@ -466,13 +466,13 @@ static void structureType(STRUCTURE_STATS *pStructure, char *pType)
}
static char *getStructName(STRUCTURE_STATS *psStruct)
static const char *getStructName(STRUCTURE_STATS *psStruct)
{
return getName(psStruct->pName);
}
/*returns the structure strength based on the string name passed in */
static UBYTE getStructStrength(char *pStrength)
static UBYTE getStructStrength(const char *pStrength)
{
if (!strcmp(pStrength, "SOFT"))
{
@ -490,10 +490,8 @@ static UBYTE getStructStrength(char *pStrength)
{
return STRENGTH_BUNKER;
}
else
{
return INVALID_STRENGTH;
}
return INVALID_STRENGTH;
}
@ -712,15 +710,15 @@ void initModulePIEsNoMods(char *GfxFile,UDWORD i,STRUCTURE_STATS *psStructure)
#endif
/* load the Structure stats from the Access database */
BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
BOOL loadStructureStats(const char *pStructData, UDWORD bufferSize)
{
char *pData;
UDWORD NumStructures = 0, i, inc, player, numWeaps, weapSlots;
const unsigned int NumStructures = numCR(pStructData, bufferSize);
UDWORD i, inc, player, numWeaps, weapSlots;
char StructureName[MAX_NAME_SIZE], foundation[MAX_NAME_SIZE],
type[MAX_NAME_SIZE], techLevel[MAX_NAME_SIZE],
strength[MAX_NAME_SIZE];
char GfxFile[MAX_NAME_SIZE], baseIMD[MAX_NAME_SIZE];
char ecmType[MAX_NAME_SIZE],sensorType[MAX_NAME_SIZE];
char ecmType[MAX_NAME_SIZE], sensorType[MAX_NAME_SIZE];
STRUCTURE_STATS *psStructure, *pStartStats;
ECM_STATS* pECMType;
SENSOR_STATS* pSensorType;
@ -747,12 +745,6 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
powerModuleIMDs[module] = NULL;
}
//keep the start so we release it at the end
pData = pStructData;
NumStructures = numCR(pStructData, bufferSize);
asStructureStats = (STRUCTURE_STATS*)malloc(sizeof(STRUCTURE_STATS)* NumStructures);
numStructureStats = NumStructures;
@ -769,9 +761,10 @@ BOOL loadStructureStats(char *pStructData, UDWORD bufferSize)
//get the start of the structure_stats storage
psStructure = asStructureStats;
for (i=0; i < NumStructures; i++)
for (i = 0; i < NumStructures; i++)
{
memset(psStructure, 0, sizeof(STRUCTURE_STATS));
//read the data into the storage - the data is delimeted using comma's
GfxFile[0] = '\0';
StructureName[0] = '\0';
@ -1039,10 +1032,10 @@ void setCurrentStructQuantity(BOOL displayError)
}
//Load the weapons assigned to Structure in the Access database
BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
BOOL loadStructureWeapons(const char *pWeaponData, UDWORD bufferSize)
{
char *pStartWeaponData;
UDWORD NumToAlloc = 0, i,incS, incW;
const unsigned int NumToAlloc = numCR(pWeaponData, bufferSize);
UDWORD i, incS, incW;
char StructureName[MAX_NAME_SIZE];//, WeaponName[MAX_NAME_SIZE];
//Watermelon:weaponName array
char WeaponName[STRUCT_MAXWEAPS][MAX_NAME_SIZE];
@ -1051,10 +1044,6 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
BOOL weaponFound, structureFound;
UBYTE j;
pStartWeaponData = pWeaponData;
NumToAlloc = numCR(pWeaponData, bufferSize);
for (i=0; i < NumToAlloc; i++)
{
//read the data into the storage - the data is delimeted using comma's
@ -1120,18 +1109,16 @@ BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize)
}
//Load the programs assigned to Droids in the Access database
BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
BOOL loadStructureFunctions(const char *pFunctionData, UDWORD bufferSize)
{
char *pStartFunctionData;
UDWORD NumToAlloc = 0,i,incS, incF;
const unsigned int NumToAlloc = numCR(pFunctionData, bufferSize);
UDWORD i, incS, incF;
char StructureName[MAX_NAME_SIZE], FunctionName[MAX_NAME_SIZE];
STRUCTURE_STATS *pStructure = asStructureStats;
FUNCTION *pFunction, **pStartFunctions = asFunctions;
BOOL functionFound, structureFound;
pStartFunctionData = pFunctionData;
NumToAlloc = numCR(pFunctionData, bufferSize);
for (i=0; i < NumToAlloc; i++)
{
@ -1233,11 +1220,12 @@ BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize)
}
/*Load the Structure Strength Modifiers from the file exported from Access*/
BOOL loadStructureStrengthModifiers(char *pStrengthModData, UDWORD bufferSize)
BOOL loadStructureStrengthModifiers(const char *pStrengthModData, UDWORD bufferSize)
{
const unsigned int NumRecords = numCR(pStrengthModData, bufferSize);
STRUCT_STRENGTH strengthInc;
WEAPON_EFFECT effectInc;
UDWORD NumRecords = 0, i, j, modifier;
UDWORD i, j, modifier;
char weaponEffectName[MAX_NAME_SIZE], strengthName[MAX_NAME_SIZE];
//initialise to 100%
@ -1249,8 +1237,6 @@ BOOL loadStructureStrengthModifiers(char *pStrengthModData, UDWORD bufferSize)
}
}
NumRecords = numCR(pStrengthModData, bufferSize);
for (i=0; i < NumRecords; i++)
{
//read the data into the storage - the data is delimeted using comma's

View File

@ -100,11 +100,11 @@ extern BOOL IsPlayerDroidLimitReached(UDWORD PlayerNumber);
extern BOOL IsPlayerStructureLimitReached(UDWORD PlayerNumber);
extern BOOL CheckHaltOnMaxUnitsReached(STRUCTURE *psStructure);
extern BOOL loadStructureStats(char *pStructData, UDWORD bufferSize);
extern BOOL loadStructureWeapons(char *pWeaponData, UDWORD bufferSize);
extern BOOL loadStructureFunctions(char *pFunctionData, UDWORD bufferSize);
extern BOOL loadStructureStats(const char *pStructData, UDWORD bufferSize);
extern BOOL loadStructureWeapons(const char *pWeaponData, UDWORD bufferSize);
extern BOOL loadStructureFunctions(const char *pFunctionData, UDWORD bufferSize);
/*Load the Structure Strength Modifiers from the file exported from Access*/
extern BOOL loadStructureStrengthModifiers(char *pStrengthModData, UDWORD bufferSize);
extern BOOL loadStructureStrengthModifiers(const char *pStrengthModData, UDWORD bufferSize);
extern BOOL structureStatsShutDown(void);