Prune some dead code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1320 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
3123e32370
commit
a1d02fec76
46
src/droid.c
46
src/droid.c
|
@ -2794,7 +2794,6 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
#endif
|
||||
UDWORD id;
|
||||
|
||||
|
||||
/* init default template */
|
||||
memset( &sDefaultDesignTemplate, 0, sizeof(DROID_TEMPLATE) );
|
||||
|
||||
|
@ -2806,14 +2805,11 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
{
|
||||
if (!HEAP_ALLOC(psTemplateHeap, (void**) &pDroidDesign))
|
||||
{
|
||||
debug( LOG_ERROR, "Out of memory - Droid Templates" );
|
||||
abort();
|
||||
debug(LOG_ERROR, "Out of memory - Droid Templates");
|
||||
return FALSE;
|
||||
}
|
||||
memset(pDroidDesign, 0, sizeof(DROID_TEMPLATE));
|
||||
|
||||
//pDroidDesign->pName = pDroidDesign->aName;
|
||||
//only fill in aName now
|
||||
pDroidDesign->pName = NULL;
|
||||
|
||||
//read the data into the storage - the data is delimited using comma's
|
||||
|
@ -2821,44 +2817,11 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
sscanf(pDroidData, "%[^','],%d,%n", componentName, &templateID, &cnt);
|
||||
pDroidData += cnt;
|
||||
|
||||
|
||||
//We ain't EVER going back to the way it was so..just store the long (translated) name in aName
|
||||
/*#ifdef RESOURCE_NAMES
|
||||
//get the name associated with the resource
|
||||
if (!strresGetIDNum(psStringRes, componentName, &id))
|
||||
{
|
||||
DBERROR(("Unable to find string resource for %s", componentName));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//get the string from the id and copy into the MALLOC'ed area
|
||||
strcpy(droidName,strresGetString(psStringRes, id));
|
||||
|
||||
#elif defined STORE_RESOURCE_ID
|
||||
//find the pointer where the string ID is stored
|
||||
if (!strresGetIDString(psStringRes, componentName, &pDroidName))
|
||||
{
|
||||
DBERROR(("Unable to find string resource for %s", componentName));
|
||||
return FALSE;
|
||||
}
|
||||
strcpy(droidName,pDroidName);
|
||||
#else
|
||||
strcpy(droidName,componentName);
|
||||
#endif
|
||||
//get the string from the id and copy into the MALLOC'ed area
|
||||
strcpy(droidName,strresGetString(psStringRes, id));
|
||||
|
||||
//allocate storage for the name - constant array now (aName)
|
||||
strncpy(pDroidDesign->pName,droidName, DROID_MAXNAME);
|
||||
pDroidDesign->pName[DROID_MAXNAME-1]=0;*/
|
||||
|
||||
|
||||
/*ALWAYS get the name associated with the resource for PC regardless
|
||||
of STORE_RESOURCE_ID or RESOURCE_NAMES! - 25/06/98 AB*/
|
||||
if (!strresGetIDNum(psStringRes, componentName, &id))
|
||||
{
|
||||
debug( LOG_ERROR, "Unable to find string resource for %s", componentName );
|
||||
abort();
|
||||
debug(LOG_ERROR, "Unable to find string resource for %s", componentName);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2867,10 +2830,8 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
pDroidDesign->aName[DROID_MAXNAME-1] = 0;
|
||||
|
||||
//store the unique template id
|
||||
|
||||
pDroidDesign->multiPlayerID = templateID;
|
||||
|
||||
|
||||
//read in Body Name
|
||||
componentName[0] = '\0';
|
||||
sscanf(pDroidData, "%[^','],%n", componentName, &cnt);
|
||||
|
@ -3030,9 +2991,6 @@ BOOL loadDroidTemplates(char *pDroidData, UDWORD bufferSize)
|
|||
sscanf(pDroidData, "%d,%n", &player,&cnt);
|
||||
pDroidData += cnt;
|
||||
|
||||
|
||||
|
||||
|
||||
//read in Propulsion Name
|
||||
found = FALSE;
|
||||
componentName[0] = '\0';
|
||||
|
|
559
src/mechanics.c
559
src/mechanics.c
|
@ -24,9 +24,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/* extra structures required for demo */
|
||||
//#define DEMO
|
||||
|
||||
#include "lib/framework/frame.h"
|
||||
#include "mechanics.h"
|
||||
#include "stats.h"
|
||||
|
@ -40,118 +37,16 @@
|
|||
#include "astar.h"
|
||||
#include "visibility.h"
|
||||
|
||||
BOOL gameStatStart(void);
|
||||
void gameStatEnd(void);
|
||||
|
||||
|
||||
/* Initialise the mechanics system */
|
||||
//BOOL mechInitialise(void)
|
||||
//{
|
||||
// UBYTE *pFileData;
|
||||
// UDWORD fileSize;
|
||||
|
||||
/* Initialise the map */
|
||||
/*if (!loadFile("blank.map", &pFileData, &fileSize))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!mapLoad(pFileData, fileSize))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FREE(pFileData); */
|
||||
|
||||
//load all the component stats from the access database
|
||||
/*if (!loadStats())
|
||||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
//load the droid Templates
|
||||
/*if (!loadDroidTemplates())
|
||||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
/*if (!loadFunctionStats())
|
||||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
/*if (!loadStructureStats())
|
||||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
/*if (!loadStructureWeapons())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!loadStructureFunctions())
|
||||
{
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
//load the research stats - must have loaded the structure and functions stats first
|
||||
/* if (!loadResearch())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
/*the template weapons and programs should have been read in through the wrf file by now
|
||||
so calculate build points and power points*/
|
||||
//initTemplatePoints(); DONE IN SAVE GAME NOW SINCE ALWAYS STARTING IN ONE
|
||||
|
||||
//sets up the initial game stats - what the player's got etc
|
||||
// gameStatStart(); - moved to data.c when stats are loaded from WRF - John.
|
||||
|
||||
/*set up the Power levels for each player - again this is set up in load game now*/
|
||||
//initPlayerPower();
|
||||
|
||||
// return TRUE;
|
||||
//}
|
||||
|
||||
|
||||
/* Shutdown the mechanics system */
|
||||
BOOL mechShutdown(void)
|
||||
{
|
||||
// UDWORD i;
|
||||
// DROID *psCurr;
|
||||
BASE_OBJECT *psObj, *psNext;
|
||||
|
||||
/* for(i=0; i<MAX_PLAYERS; i++)
|
||||
{
|
||||
for(psCurr=apsDroidLists[i]; psCurr != NULL; psCurr = psCurr->psNext)
|
||||
{
|
||||
FREE(psCurr->pName);
|
||||
if (psCurr->numWeaps > 0)
|
||||
{
|
||||
FREE(psCurr->asWeaps);
|
||||
}
|
||||
if (psCurr->numProgs > 0)
|
||||
{
|
||||
FREE(psCurr->asProgs);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
BASE_OBJECT *psObj, *psNext;
|
||||
|
||||
for(psObj = psDestroyedObj; psObj; psObj = psNext)
|
||||
{
|
||||
psNext = psObj->psNext;
|
||||
if (psObj->type == OBJ_DROID)
|
||||
{
|
||||
/* FREE(((DROID *)psObj)->pName);
|
||||
if (((DROID *)psObj)->numWeaps > 0)
|
||||
{
|
||||
FREE(((DROID *)psObj)->asWeaps);
|
||||
}
|
||||
if (((DROID *)psObj)->numProgs > 0)
|
||||
{
|
||||
FREE(((DROID *)psObj)->asProgs);
|
||||
}*/
|
||||
droidRelease((DROID *)psObj);
|
||||
heapFree(psDroidHeap, (DROID *)psObj);
|
||||
}
|
||||
|
@ -168,9 +63,6 @@ BOOL mechShutdown(void)
|
|||
}
|
||||
psDestroyedObj = NULL;
|
||||
|
||||
//Free the space allocated for the players lists
|
||||
// gameStatEnd();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -268,455 +160,6 @@ void freeStructureLists(void)
|
|||
}
|
||||
|
||||
|
||||
//initialises the players list for the start of the DEMO
|
||||
BOOL gameStatStart(void)
|
||||
{
|
||||
// UDWORD inc, comp, stat;
|
||||
// BOOL builtRes = FALSE, builtGen = FALSE;
|
||||
#if 0
|
||||
STRUCTURE *psStructure;
|
||||
DROID_TEMPLATE *pTemplate;
|
||||
DROID_TEMPLATE *pNewTempl, *pCurrTempl;
|
||||
UDWORD posX, posY;
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
* All this gets done by calls from data.c to
|
||||
* allocComponentList and allocStructLists (above)
|
||||
* John.
|
||||
|
||||
//allocate the space for the Players' component lists
|
||||
for (inc=0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_BODY] = (UDWORD *) MALLOC(sizeof(UDWORD) * numBodyStats);
|
||||
if (apCompLists[inc][COMP_BODY] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_BRAIN] = (UDWORD *) MALLOC(sizeof(UDWORD) * numBrainStats);
|
||||
if (apCompLists[inc][COMP_BRAIN] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_ECM] = (UDWORD *) MALLOC(sizeof(UDWORD) * numECMStats);
|
||||
if (apCompLists[inc][COMP_ECM] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_PROPULSION] = (UDWORD *) MALLOC(sizeof(UDWORD) * numPropulsionStats);
|
||||
if (apCompLists[inc][COMP_PROPULSION] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_SENSOR] = (UDWORD *) MALLOC(sizeof(UDWORD) * numSensorStats);
|
||||
if (apCompLists[inc][COMP_SENSOR] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_REPAIRUNIT] = (UDWORD *) MALLOC(sizeof(UDWORD) * numRepairStats);
|
||||
if (apCompLists[inc][COMP_REPAIRUNIT] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_CONSTRUCT] = (UDWORD *) MALLOC(sizeof(UDWORD) * numConstructStats);
|
||||
if (apCompLists[inc][COMP_REPAIRUNIT] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_WEAPON] = (UDWORD *) MALLOC(sizeof(UDWORD) * numWeaponStats);
|
||||
if (apCompLists[inc][COMP_WEAPON] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
apCompLists[inc][COMP_PROGRAM] = (UDWORD *) MALLOC(sizeof(UDWORD) * numProgramStats);
|
||||
if (apCompLists[inc][COMP_PROGRAM] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Component Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
//initialise the players' lists
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
for (comp=0; comp <numBodyStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_BODY][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numBrainStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_BRAIN][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numPropulsionStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROPULSION][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numSensorStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_SENSOR][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numECMStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_ECM][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numRepairStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_REPAIRUNIT][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numConstructStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_CONSTRUCT][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numWeaponStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_WEAPON][comp] = UNAVAILABLE;
|
||||
}
|
||||
for (comp=0; comp < numProgramStats; comp++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROGRAM][comp] = UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
//allocate the space for the Players' structure lists
|
||||
for (inc=0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
if(numStructureStats)
|
||||
{
|
||||
#ifdef DEMO
|
||||
apStructTypeLists[inc] = (UDWORD *) MALLOC(sizeof(UDWORD) *
|
||||
(numStructureStats + NUM_DEMO_STRUCTS));
|
||||
#else
|
||||
apStructTypeLists[inc] = (UDWORD *) MALLOC(sizeof(UDWORD) *
|
||||
numStructureStats);
|
||||
#endif
|
||||
if (apStructTypeLists[inc] == NULL)
|
||||
{
|
||||
DBERROR(("Out of memory assigning Player Structure Lists"));
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef DEMO
|
||||
for (stat = 0; stat < numStructureStats + NUM_DEMO_STRUCTS; stat++)
|
||||
{
|
||||
apStructTypeLists[inc][stat] = UNAVAILABLE;
|
||||
}
|
||||
#else
|
||||
for (stat = 0; stat < numStructureStats; stat++)
|
||||
{
|
||||
apStructTypeLists[inc][stat] = UNAVAILABLE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
apStructTypeLists[inc] = NULL;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//don't want any of the next bit if using scripts
|
||||
#ifndef SCRIPTS
|
||||
//initialise the players' structure lists
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
|
||||
for (comp=0; comp <numStructureStats; comp++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
//set up the starting structures
|
||||
for (comp=0; comp < numStructureStats; comp++)
|
||||
{
|
||||
if (!strcmp(asStructureStats[comp].pName, "Droid Factory"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Factory Module"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Power Generator"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Oil Derrick"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Command Center"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Research Lab"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
if (!strcmp(asStructureStats[comp].pName, "Research Module"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set up the starting components
|
||||
for (comp=0; comp < numWeaponStats; comp++)
|
||||
{
|
||||
if (!strcmp(asWeaponStats[comp].pName, "Light Machine Gun"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_WEAPON][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (comp=0; comp < numSensorStats; comp++)
|
||||
{
|
||||
if (!strcmp(asSensorStats[comp].pName, "Default Sensor"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_SENSOR][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (comp=0; comp < numRepairStats; comp++)
|
||||
{
|
||||
if (!strcmp(asRepairStats[comp].pName, "Light Repair #1"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_REPAIRUNIT][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (comp=0; comp < numPropulsionStats; comp++)
|
||||
{
|
||||
if (!strcmp(asPropulsionStats[comp].pName, "Wheeled Propulsion"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROPULSION][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*for (comp=0; comp < numProgramStats; comp++)
|
||||
{
|
||||
if (!strcmp(asProgramStats[comp].pName, "Radar Program"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROGRAM][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(asProgramStats[comp].pName, "program #1"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROGRAM][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(asProgramStats[comp].pName, "Construct"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_PROGRAM][comp] = AVAILABLE;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
for (comp=0; comp < numConstructStats; comp++)
|
||||
{
|
||||
if (!strcmp(asConstructStats[comp].pName, "Building Constructor"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_CONSTRUCT][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (comp=0; comp < numBrainStats; comp++)
|
||||
{
|
||||
if (!strcmp(asBrainStats[comp].pName, "Standard Brain"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_BRAIN][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (comp=0; comp < numBodyStats; comp++)
|
||||
{
|
||||
if (!strcmp(asBodyStats[comp].pName, "Viper Body"))
|
||||
{
|
||||
for (inc = 0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
apCompLists[inc][COMP_BODY][comp] = AVAILABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set the default sensor and ECM
|
||||
for(comp=0; comp < numSensorStats; comp++)
|
||||
{
|
||||
if (!strcmp(asSensorStats[comp].pName, "Default Sensor"))
|
||||
{
|
||||
for(inc = 0; inc < MAX_PLAYERS; inc ++)
|
||||
{
|
||||
aDefaultSensor[inc] = comp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(comp=0; comp < numECMStats; comp++)
|
||||
{
|
||||
if (!strcmp(asECMStats[comp].pName, "Light ECM #1"))
|
||||
{
|
||||
for(inc = 0; inc < MAX_PLAYERS; inc ++)
|
||||
{
|
||||
aDefaultECM[inc] = comp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
//give each player a resource extractor and a power generator
|
||||
for (inc=0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
builtGen = builtRes = FALSE;
|
||||
//make the structures available in the lists
|
||||
for (comp = 0; comp < numStructureStats; comp++)
|
||||
{
|
||||
if (asStructureStats[comp].type == REF_RESOURCE_EXTRACTOR)
|
||||
{
|
||||
// apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
do
|
||||
{
|
||||
posX = rand()%mapWidth/2+mapWidth/4;
|
||||
posY = rand()%mapHeight/2+mapHeight/4;
|
||||
}
|
||||
while(blockingTile(posX,posY,TER_ALL));
|
||||
/* psStructure = buildStructure(&asStructureStats[comp], posX <<
|
||||
TILE_SHIFT + TILE_UNITS/2 , (posY << TILE_SHIFT) + TILE_UNITS/2,
|
||||
inc); */
|
||||
psStructure = buildStructure(&asStructureStats[comp],
|
||||
posX << TILE_SHIFT, (posY << TILE_SHIFT), inc,FALSE);
|
||||
psStructure->status = SS_BUILT;
|
||||
builtRes = TRUE;
|
||||
}
|
||||
if (asStructureStats[comp].type == REF_POWER_GEN)
|
||||
{
|
||||
// apStructTypeLists[inc][comp] = AVAILABLE;
|
||||
do
|
||||
{
|
||||
posX = rand()%mapWidth/2+mapWidth/4;
|
||||
posY = rand()%mapHeight/2+mapHeight/4;
|
||||
}
|
||||
while(blockingTile(posX,posY,TER_ALL));
|
||||
/* psStructure = buildStructure(&asStructureStats[comp], posX <<
|
||||
TILE_SHIFT + TILE_UNITS/2, (posY << TILE_SHIFT) + TILE_UNITS/2,
|
||||
inc); */
|
||||
psStructure = buildStructure(&asStructureStats[comp],
|
||||
posX << TILE_SHIFT, posY << TILE_SHIFT, inc,FALSE);
|
||||
psStructure->status = SS_BUILT;
|
||||
builtGen = TRUE;
|
||||
}
|
||||
if (builtRes & builtGen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifdef DEMO
|
||||
#if 0
|
||||
for (inc = 1; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
pCurrTempl = NULL;
|
||||
for(pTemplate = apsDroidTemplates[0]; pTemplate; pTemplate=pTemplate->psNext)
|
||||
{
|
||||
if (createTemplate(pTemplate, &pNewTempl))
|
||||
{
|
||||
if (pCurrTempl == NULL)
|
||||
{
|
||||
apsDroidTemplates[inc] = pNewTempl;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCurrTempl->psNext = pNewTempl;
|
||||
}
|
||||
pCurrTempl = pNewTempl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void gameStatEnd(void)
|
||||
{
|
||||
UDWORD inc;
|
||||
|
||||
for (inc=0; inc < MAX_PLAYERS; inc++)
|
||||
{
|
||||
//free the component lists
|
||||
FREE(apCompLists[inc][COMP_BODY]);
|
||||
FREE(apCompLists[inc][COMP_BRAIN]);
|
||||
FREE(apCompLists[inc][COMP_PROPULSION]);
|
||||
FREE(apCompLists[inc][COMP_SENSOR]);
|
||||
FREE(apCompLists[inc][COMP_ECM]);
|
||||
FREE(apCompLists[inc][COMP_REPAIRUNIT]);
|
||||
FREE(apCompLists[inc][COMP_CONSTRUCT]);
|
||||
FREE(apCompLists[inc][COMP_WEAPON]);
|
||||
//FREE(apCompLists[inc][COMP_PROGRAM]);
|
||||
|
||||
//free the structure lists
|
||||
if(apStructTypeLists[inc]) {
|
||||
FREE(apStructTypeLists[inc]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//TEST FUNCTION - MAKE EVERYTHING AVAILABLE
|
||||
void makeAllAvailable(void)
|
||||
{
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
#include "research.h"
|
||||
#include "visibility.h"
|
||||
|
||||
/* Initialise the mechanics system */
|
||||
//extern BOOL mechInitialise(void);
|
||||
|
||||
/* Shutdown the mechanics system */
|
||||
extern BOOL mechShutdown(void);
|
||||
|
||||
|
|
112
src/research.c
112
src/research.c
|
@ -2712,12 +2712,10 @@ RESEARCH * getResearch(char *pName, BOOL resName)
|
|||
|
||||
/* looks through the players lists of structures and droids to see if any are using
|
||||
the old component - if any then replaces them with the new component */
|
||||
void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldComponent,
|
||||
static void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldComponent,
|
||||
UBYTE player)
|
||||
{
|
||||
//DROID *psDroid;
|
||||
DROID_TEMPLATE *psTemplates;
|
||||
//STRUCTURE *psStructure;
|
||||
UDWORD inc, oldType, newType, oldCompInc, newCompInc;
|
||||
|
||||
|
||||
|
@ -2734,57 +2732,11 @@ void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldCompo
|
|||
return;
|
||||
}
|
||||
|
||||
replaceDroidComponent(apsDroidLists[player], oldType, oldCompInc, newCompInc);
|
||||
replaceDroidComponent(mission.apsDroidLists[player], oldType, oldCompInc, newCompInc);
|
||||
replaceDroidComponent(apsLimboDroids[player], oldType, oldCompInc, newCompInc);
|
||||
//check thru the droids
|
||||
/*for (psDroid = apsDroidLists[player]; psDroid != NULL; psDroid = psDroid->psNext)
|
||||
{
|
||||
switch(oldType)
|
||||
{
|
||||
case COMP_BODY:
|
||||
case COMP_BRAIN:
|
||||
case COMP_PROPULSION:
|
||||
case COMP_REPAIRUNIT:
|
||||
case COMP_ECM:
|
||||
case COMP_SENSOR:
|
||||
case COMP_CONSTRUCT:
|
||||
if (psDroid->asBits[oldType].nStat == oldCompInc)
|
||||
{
|
||||
psDroid->asBits[oldType].nStat = (UBYTE)newCompInc;
|
||||
}
|
||||
break;
|
||||
//case COMP_PROGRAM:
|
||||
// for (inc=0; inc < psDroid->numProgs; inc++)
|
||||
// {
|
||||
// if ((psDroid->asProgs[inc].psStats->ref - REF_PROGRAM_START) ==
|
||||
// oldCompInc)
|
||||
// {
|
||||
// psDroid->asProgs[inc].psStats = (asProgramStats + newCompInc);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case COMP_WEAPON:
|
||||
//can only be one weapon now
|
||||
//for (inc=0; inc < psDroid->numWeaps; inc++)
|
||||
if (psDroid->asWeaps[0].nStat > 0)
|
||||
{
|
||||
//if (psDroid->asWeaps[inc].nStat == oldCompInc)
|
||||
if (psDroid->asWeaps[0].nStat == oldCompInc)
|
||||
{
|
||||
//psDroid->asWeaps[inc].nStat = newCompInc;
|
||||
psDroid->asWeaps[0].nStat = newCompInc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//unknown comp type
|
||||
DBERROR(("Unknown component type - invalid droid"));
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
replaceDroidComponent(apsDroidLists[player], oldType, oldCompInc, newCompInc);
|
||||
replaceDroidComponent(mission.apsDroidLists[player], oldType, oldCompInc, newCompInc);
|
||||
replaceDroidComponent(apsLimboDroids[player], oldType, oldCompInc, newCompInc);
|
||||
|
||||
//check thru the templates
|
||||
//check thru the templates
|
||||
for (psTemplates = apsDroidTemplates[player]; psTemplates != NULL;
|
||||
psTemplates = psTemplates->psNext)
|
||||
{
|
||||
|
@ -2828,54 +2780,8 @@ void replaceComponent(COMP_BASE_STATS *pNewComponent, COMP_BASE_STATS *pOldCompo
|
|||
}
|
||||
}
|
||||
|
||||
replaceStructureComponent(apsStructLists[player], oldType, oldCompInc,
|
||||
newCompInc, player);
|
||||
replaceStructureComponent(mission.apsStructLists[player], oldType,
|
||||
oldCompInc, newCompInc, player);
|
||||
|
||||
//check thru the structures
|
||||
/*for (psStructure = apsStructLists[player]; psStructure != NULL; psStructure =
|
||||
psStructure->psNext)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case COMP_ECM:
|
||||
if (psStructure->pStructureType->pECM == (asECMStats + oldCompInc))
|
||||
{
|
||||
psStructure->ecmPower = (UWORD)(asECMStats + newCompInc)->power;
|
||||
}
|
||||
break;
|
||||
case COMP_SENSOR:
|
||||
if (psStructure->pStructureType->pSensor == (asSensorStats + oldCompInc))
|
||||
{
|
||||
//psStructure->sensorPower = (asSensorStats + newCompInc)->power;
|
||||
psStructure->sensorPower = (UWORD)sensorPower(asSensorStats +
|
||||
newCompInc,player);
|
||||
//psStructure->sensorRange = (asSensorStats + newCompInc)->range;
|
||||
psStructure->sensorRange = (UWORD)sensorRange(asSensorStats +
|
||||
newCompInc,player);
|
||||
}
|
||||
break;
|
||||
case COMP_WEAPON:
|
||||
//for (inc=0; inc < psStructure->numWeaps; inc++)
|
||||
//can only be one weapon now
|
||||
if (psStructure->asWeaps[0].nStat > 0)
|
||||
{
|
||||
//if (psStructure->asWeaps[inc].nStat == oldCompInc)
|
||||
//{
|
||||
// psStructure->asWeaps[inc].nStat = newCompInc;
|
||||
//}
|
||||
if (psStructure->asWeaps[0].nStat == oldCompInc)
|
||||
{
|
||||
psStructure->asWeaps[0].nStat = newCompInc;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//ignore all other component types
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
replaceStructureComponent(apsStructLists[player], oldType, oldCompInc, newCompInc, player);
|
||||
replaceStructureComponent(mission.apsStructLists[player], oldType, oldCompInc, newCompInc, player);
|
||||
}
|
||||
|
||||
/*Looks through all the currently allocated stats to check the name is not
|
||||
|
@ -3301,8 +3207,8 @@ void replaceStructureComponent(STRUCTURE *pList, UDWORD oldType, UDWORD oldCompI
|
|||
}
|
||||
|
||||
/*swaps the old component for the new one for a specific droid*/
|
||||
void switchComponent(DROID *psDroid, UDWORD oldType, UDWORD oldCompInc,
|
||||
UDWORD newCompInc)
|
||||
static void switchComponent(DROID *psDroid, UDWORD oldType, UDWORD oldCompInc,
|
||||
UDWORD newCompInc)
|
||||
{
|
||||
|
||||
ASSERT( PTRVALID(psDroid, sizeof(DROID)),
|
||||
|
|
76
src/stats.c
76
src/stats.c
|
@ -337,78 +337,6 @@ UDWORD numCR(char *pFileBuffer, UDWORD fileSize)
|
|||
return lines;
|
||||
}
|
||||
|
||||
/*Load the stats from the Access database*/
|
||||
//BOOL loadStats(void)
|
||||
//{
|
||||
/*if (!loadWeaponStats())
|
||||
{
|
||||
DBERROR(("Unable to load weapon stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadBodyStats())
|
||||
{
|
||||
DBERROR(("Unable to load body stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadBrainStats())
|
||||
{
|
||||
DBERROR(("Unable to load brain stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadPropulsionStats())
|
||||
{
|
||||
DBERROR(("Unable to load propulsion stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadSensorStats())
|
||||
{
|
||||
DBERROR(("Unable to load sensor stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadECMStats())
|
||||
{
|
||||
DBERROR(("Unable to load ecm stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadRepairStats())
|
||||
{
|
||||
DBERROR(("Unable to load repair stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadProgramStats())
|
||||
{
|
||||
DBERROR(("Unable to load program stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if(!loadConstructStats())
|
||||
{
|
||||
DBERROR(("Unable to load construct stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadPropulsionTypes())
|
||||
{
|
||||
DBERROR(("Unable to load propulsion types"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadTerrainTable())
|
||||
{
|
||||
DBERROR(("Unable to load terrain table"));
|
||||
return FALSE;
|
||||
}*/
|
||||
/*if (!loadSpecialAbility())
|
||||
{
|
||||
DBERROR(("Unable to load special ability stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
/*if (!loadFeatureStats())
|
||||
{
|
||||
DBERROR(("Unable to load feature stats"));
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
// return TRUE;
|
||||
//}
|
||||
|
||||
/*******************************************************************************
|
||||
* Allocate stats functions
|
||||
|
@ -725,7 +653,7 @@ BOOL loadWeaponStats(char *pWeaponData, UDWORD bufferSize)
|
|||
else if (!strcmp(weaponClass,"EXPLOSIVE"))
|
||||
{
|
||||
//psStats->weaponClass = WC_EXPLOSIVE;
|
||||
psStats->weaponClass = WC_KINETIC;
|
||||
psStats->weaponClass = WC_KINETIC; // explosives were removed from release version of Warzone
|
||||
}
|
||||
else if (!strcmp(weaponClass,"HEAT"))
|
||||
{
|
||||
|
@ -734,7 +662,7 @@ BOOL loadWeaponStats(char *pWeaponData, UDWORD bufferSize)
|
|||
else if (!strcmp(weaponClass,"MISC"))
|
||||
{
|
||||
//psStats->weaponClass = WC_MISC;
|
||||
psStats->weaponClass = WC_HEAT;
|
||||
psStats->weaponClass = WC_HEAT; // removed from release version of Warzone
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -268,8 +268,6 @@ extern CONSTRUCT_STATS *statsGetConstruct(UDWORD ref);
|
|||
/*******************************************************************************
|
||||
* Generic stats functions
|
||||
*******************************************************************************/
|
||||
/*Load the stats from the Access database*/
|
||||
//extern BOOL loadStats(void);
|
||||
|
||||
/*calls the STATS_DEALLOC macro for each set of stats*/
|
||||
extern BOOL statsShutDown(void);
|
||||
|
|
Loading…
Reference in New Issue