Revert "Remove all traces of the utterly useless apsOilList."

This reverts commit 71d5f82078.
master
Per Inge Mathisen 2010-12-15 22:25:52 +01:00
parent f945dfc029
commit 0ac282eca9
5 changed files with 34 additions and 0 deletions

View File

@ -2401,6 +2401,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
//clear all the messages?
apsProxDisp[player] = NULL;
apsSensorList[0] = NULL;
apsOilList[0] = NULL;
}
initFactoryNumFlag();
}
@ -2416,6 +2417,7 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
mission.apsFeatureLists[player] = NULL;
mission.apsFlagPosLists[player] = NULL;
}
mission.apsOilList[0] = NULL;
mission.apsSensorList[0] = NULL;
//JPS 25 feb

View File

@ -254,6 +254,7 @@ void initMission(void)
apsLimboDroids[inc] = NULL;
}
mission.apsSensorList[0] = NULL;
mission.apsOilList[0] = NULL;
offWorldKeepLists = false;
mission.time = -1;
setMissionCountDown();
@ -325,7 +326,9 @@ BOOL missionShutDown(void)
mission.apsFlagPosLists[inc] = NULL;
}
apsSensorList[0] = mission.apsSensorList[0];
apsOilList[0] = mission.apsOilList[0];
mission.apsSensorList[0] = NULL;
mission.apsOilList[0] = NULL;
psMapTiles = mission.psMapTiles;
mapWidth = mission.mapWidth;
@ -802,6 +805,7 @@ static void saveMissionData(void)
mission.apsFlagPosLists[inc] = apsFlagPosLists[inc];
}
mission.apsSensorList[0] = apsSensorList[0];
mission.apsOilList[0] = apsOilList[0];
mission.playerX = player.p.x;
mission.playerY = player.p.z;
@ -869,6 +873,7 @@ void restoreMissionData(void)
mission.apsFlagPosLists[inc] = NULL;
}
apsSensorList[0] = mission.apsSensorList[0];
apsOilList[0] = mission.apsOilList[0];
mission.apsSensorList[0] = NULL;
//swap mission data over
@ -1459,6 +1464,9 @@ void swapMissionPointers(void)
pVoid = (void*)apsSensorList[0];
apsSensorList[0] = mission.apsSensorList[0];
mission.apsSensorList[0] = (BASE_OBJECT *)pVoid;
pVoid = (void*)apsOilList[0];
apsOilList[0] = mission.apsOilList[0];
mission.apsOilList[0] = (BASE_OBJECT *)pVoid;
}
void endMission(void)

View File

@ -67,6 +67,7 @@ typedef struct _mission
DROID *apsDroidLists[MAX_PLAYERS];
FEATURE *apsFeatureLists[MAX_PLAYERS];
BASE_OBJECT *apsSensorList[1];
BASE_OBJECT *apsOilList[1];
//struct _proximity_display *apsProxDisp[MAX_PLAYERS];
FLAG_POSITION *apsFlagPosLists[MAX_PLAYERS];
int32_t asCurrentPower[MAX_PLAYERS];

View File

@ -64,6 +64,7 @@ DROID *apsDroidLists[MAX_PLAYERS];
STRUCTURE *apsStructLists[MAX_PLAYERS];
FEATURE *apsFeatureLists[MAX_PLAYERS]; ///< Only player zero is valid for features. TODO: Reduce to single list.
BASE_OBJECT *apsSensorList[1]; ///< List of sensors in the game.
BASE_OBJECT *apsOilList[1];
/*The list of Flag Positions allocated */
FLAG_POSITION *apsFlagPosLists[MAX_PLAYERS];
@ -588,6 +589,10 @@ void addStructure(STRUCTURE *psStructToAdd)
{
addObjectToFuncList(apsSensorList, (BASE_OBJECT*)psStructToAdd, 0);
}
else if (psStructToAdd->type == REF_RESOURCE_EXTRACTOR)
{
addObjectToFuncList(apsOilList, (BASE_OBJECT*)psStructToAdd, 0);
}
}
/* Destroy a structure */
@ -605,6 +610,10 @@ void killStruct(STRUCTURE *psBuilding)
{
removeObjectFromFuncList(apsSensorList, (BASE_OBJECT*)psBuilding, 0);
}
else if (psBuilding->type == REF_RESOURCE_EXTRACTOR)
{
removeObjectFromFuncList(apsOilList, (BASE_OBJECT*)psBuilding, 0);
}
for (i = 0; i < STRUCT_MAXWEAPS; i++)
{
@ -665,6 +674,10 @@ void removeStructureFromList(STRUCTURE *psStructToRemove, STRUCTURE *pList[MAX_P
{
removeObjectFromFuncList(apsSensorList, (BASE_OBJECT*)psStructToRemove, 0);
}
else if (psStructToRemove->type == REF_RESOURCE_EXTRACTOR)
{
removeObjectFromFuncList(apsOilList, (BASE_OBJECT*)psStructToRemove, 0);
}
}
/************************** FEATURE *********************************/
@ -679,6 +692,10 @@ FEATURE* createFeature()
void addFeature(FEATURE *psFeatureToAdd)
{
addObjectToList((BASE_OBJECT**)apsFeatureLists, (BASE_OBJECT*)psFeatureToAdd, 0);
if (psFeatureToAdd->psStats->subType == FEAT_OIL_RESOURCE)
{
addObjectToFuncList(apsOilList, (BASE_OBJECT*)psFeatureToAdd, 0);
}
}
/* Destroy a feature */
@ -690,6 +707,11 @@ void killFeature(FEATURE *psDel)
"killFeature: pointer is not a feature" );
psDel->player = 0;
destroyObject((BASE_OBJECT**)apsFeatureLists, (BASE_OBJECT*)psDel);
if (psDel->psStats->subType == FEAT_OIL_RESOURCE)
{
removeObjectFromFuncList(apsOilList, (BASE_OBJECT*)psDel, 0);
}
}
/* Remove all features */

View File

@ -37,6 +37,7 @@ extern STRUCTURE *apsStructLists[MAX_PLAYERS];
extern FEATURE *apsFeatureLists[MAX_PLAYERS];
extern FLAG_POSITION *apsFlagPosLists[MAX_PLAYERS];
extern BASE_OBJECT *apsSensorList[1];
extern BASE_OBJECT *apsOilList[1];
/* The list of destroyed objects */
extern BASE_OBJECT *psDestroyedObj;