Apply patch #1462 - Fix redundant components remaining available if researched after being made redundant.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9402 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-01-22 18:02:24 +00:00 committed by Git SVN Gateway
parent c78a3aad2c
commit 352666ff0e
5 changed files with 21 additions and 14 deletions

View File

@ -874,7 +874,7 @@ void processMouseClickInput(void)
{
for (i=0;(i<numStructureStats)&&(asStructureStats[i].type != REF_RESOURCE_EXTRACTOR);i++); // find resource stat
{
if( (i < numStructureStats) && (apStructTypeLists[selectedPlayer][i] == UNAVAILABLE)) // check if you can build it!
if( (i < numStructureStats) && (apStructTypeLists[selectedPlayer][i] != AVAILABLE)) // check if you can build it!
{
item = MT_BLOCKING; // don't allow build pointer.
}

View File

@ -9579,7 +9579,7 @@ BOOL loadSaveCompListV9(char *pFileData, UDWORD filesize, UDWORD numRecords, UDW
continue;
}
if (psSaveCompList->state != UNAVAILABLE && psSaveCompList->state !=
AVAILABLE && psSaveCompList->state != FOUND)
AVAILABLE && psSaveCompList->state != FOUND && psSaveCompList->state != REDUNDANT)
{
//ignore this record
continue;
@ -9631,7 +9631,7 @@ BOOL loadSaveCompListV(char *pFileData, UDWORD filesize, UDWORD numRecords, UDWO
continue;
}
if (psSaveCompList->state != UNAVAILABLE && psSaveCompList->state !=
AVAILABLE && psSaveCompList->state != FOUND)
AVAILABLE && psSaveCompList->state != FOUND && psSaveCompList->state != REDUNDANT)
{
//ignore this record
continue;
@ -9885,7 +9885,7 @@ BOOL loadSaveStructTypeListV7(char *pFileData, UDWORD filesize, UDWORD numRecord
continue;
}
if (psSaveStructList->state != UNAVAILABLE && psSaveStructList->state !=
AVAILABLE && psSaveStructList->state != FOUND)
AVAILABLE && psSaveStructList->state != FOUND && psSaveStructList->state != REDUNDANT)
{
//ignore this record
continue;
@ -9944,7 +9944,7 @@ BOOL loadSaveStructTypeListV(char *pFileData, UDWORD filesize, UDWORD numRecords
continue;
}
if (psSaveStructList->state != UNAVAILABLE && psSaveStructList->state !=
AVAILABLE && psSaveStructList->state != FOUND)
AVAILABLE && psSaveStructList->state != FOUND && psSaveStructList->state != REDUNDANT)
{
//ignore this record
continue;

View File

@ -1133,13 +1133,16 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay, STRUCTURE
//check for structures to be made available
for (inc = 0; inc < pResearch->numStructResults; inc++)
{
apStructTypeLists[player][pResearch->pStructureResults[inc]] = AVAILABLE;
if (apStructTypeLists[player][pResearch->pStructureResults[inc]] != REDUNDANT)
{
apStructTypeLists[player][pResearch->pStructureResults[inc]] = AVAILABLE;
}
}
//check for structures to be made redundant
for (inc = 0; inc < pResearch->numRedStructs; inc++)
{
apStructTypeLists[player][pResearch->pRedStructs[inc]] = UNAVAILABLE;
apStructTypeLists[player][pResearch->pRedStructs[inc]] = REDUNDANT;
}
//check for artefacts to be made available
@ -1149,7 +1152,10 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay, STRUCTURE
type = statType(pResearch->pArtefactResults[inc]->ref);
//set the component state to AVAILABLE
compInc = pResearch->pArtefactResults[inc]->ref - statRefStart(type);
apCompLists[player][type][compInc] = AVAILABLE;
if (apCompLists[player][type][compInc] != REDUNDANT)
{
apCompLists[player][type][compInc] = AVAILABLE;
}
//check for default sensor
if (type == COMP_SENSOR)
{
@ -1181,9 +1187,9 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay, STRUCTURE
pReplacedArtefacts[inc], player);
//set the 'old' component to unavailable
type = statType(pResearch->pReplacedArtefacts[inc]->ref);
//set the component state to AVAILABLE
//set the component state to REDUNDANT
compInc = pResearch->pReplacedArtefacts[inc]->ref - statRefStart(type);
apCompLists[player][type][compInc] = UNAVAILABLE;
apCompLists[player][type][compInc] = REDUNDANT;
}
//check if the component is a brain
if (type == COMP_BRAIN)
@ -1205,9 +1211,9 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay, STRUCTURE
{
//determine the type of artefact
type = statType(pResearch->pRedArtefacts[inc]->ref);
//set the component state to UNAVAILABLE
//set the component state to REDUNDANT
apCompLists[player][type][pResearch->pRedArtefacts[inc]->ref -
statRefStart(type)] = UNAVAILABLE;
statRefStart(type)] = REDUNDANT;
}
//check for technology effects

View File

@ -90,7 +90,7 @@ static UDWORD maxWeaponDamage;
static UDWORD maxWeaponROF;
static UDWORD maxPropulsionSpeed;
//stores for each players component states - can be either UNAVAILABLE, FOUND or AVAILABLE
//stores for each players component states - can be either UNAVAILABLE, REDUNDANT, FOUND or AVAILABLE
UBYTE *apCompLists[MAX_PLAYERS][COMP_NUMCOMPONENTS];
//store for each players Structure states
@ -174,7 +174,7 @@ void statsInitVars(void)
numConstructStats = 0;
numSpecialAbility = 0;
//stores for each players component states - can be either UNAVAILABLE, FOUND or AVAILABLE
//stores for each players component states - can be either UNAVAILABLE, REDUNDANT, FOUND or AVAILABLE
for(i=0; i<MAX_PLAYERS; i++) {
for(j=0; j<COMP_NUMCOMPONENTS; j++) {
apCompLists[i][j] = NULL;

View File

@ -104,6 +104,7 @@ extern UBYTE *apStructTypeLists[MAX_PLAYERS];
#define AVAILABLE 0x01 //this item can be used to design droids
#define UNAVAILABLE 0x02 //the player does not know about this item
#define FOUND 0x04 //this item has been found, but is unresearched
#define REDUNDANT 0x0A //the player no longer needs this item
/*******************************************************************************
* Allocate stats functions