Skip to content

Commit

Permalink
Fix uninitialised variable usage on removing repair facilities.
Browse files Browse the repository at this point in the history
See previous commit.
  • Loading branch information
Cyp committed Jun 23, 2012
1 parent 67b2a62 commit 88e9439
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/structure.cpp
Expand Up @@ -4541,7 +4541,6 @@ static void removeStructFromMap(STRUCTURE *psStruct)
bool removeStruct(STRUCTURE *psDel, bool bDestroy)
{
bool resourceFound = false;
FACTORY *psFactory;
SDWORD cluster;
FLAG_POSITION *psAssemblyPoint=NULL;

Expand Down Expand Up @@ -4598,7 +4597,7 @@ bool removeStruct(STRUCTURE *psDel, bool bDestroy)
//if it is a factory - need to reset the factoryNumFlag
if (StructIsFactory(psDel))
{
psFactory = &psDel->pFunctionality->factory;
FACTORY *psFactory = &psDel->pFunctionality->factory;

//need to initialise the production run as well
cancelProduction(psDel, ModeImmediate);
Expand All @@ -4618,13 +4617,9 @@ bool removeStruct(STRUCTURE *psDel, bool bDestroy)
}

//need to cancel the repositioning of the DP if selectedPlayer and currently moving
if (psDel->player == selectedPlayer)
if (psDel->player == selectedPlayer && psAssemblyPoint->selected)
{
//if currently trying to place a DP
if (psFactory->psAssemblyPoint && psFactory->psAssemblyPoint->selected)
{
cancelDeliveryRepos();
}
cancelDeliveryRepos();
}
}

Expand Down

0 comments on commit 88e9439

Please sign in to comment.