Make walls rotate to match hardpoints and fortresses, but not bunkers and [most] towers. Also simplify structChooseWallType a bit.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10737 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-04-28 05:36:46 +00:00 committed by Git SVN Gateway
parent edea97a633
commit 28bf4191b6
1 changed files with 16 additions and 30 deletions

View File

@ -1392,7 +1392,6 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
SDWORD neighbourType, scanType;
STRUCTURE_STATS *psStats;
UDWORD sx,sy;
UDWORD oldBuildPoints;
// scan around the location looking for walls
memset(aWallPresent, 0, sizeof(aWallPresent));
@ -1405,7 +1404,8 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
(psStruct->pStructureType->type == REF_WALL ||
psStruct->pStructureType->type == REF_GATE ||
psStruct->pStructureType->type == REF_WALLCORNER ||
psStruct->pStructureType->type == REF_DEFENSE))
(psStruct->pStructureType->type == REF_DEFENSE && psStruct->pStructureType->strength == STRENGTH_HARD) ||
(psStruct->pStructureType->type == REF_BLASTDOOR && psStruct->pStructureType->strength == STRENGTH_HARD))) // fortresses
{
aWallPresent[xdiff+2][ydiff+2] = true;
apsStructs[xdiff+2][ydiff+2] = psStruct;
@ -1455,11 +1455,9 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
if (psStruct->pStructureType->asFuncList[0]->type == WALL_TYPE)
{
const int oldBody = psStruct->body;
UDWORD oldBuildPoints = psStruct->currentBuildPts;
STRUCT_STATES oldStatus = psStruct->status;
/* Still being built - so save and load build points */
if(psStruct->status == SS_BEING_BUILT)
{
oldBuildPoints = psStruct->currentBuildPts;
psStats = ((WALL_FUNCTION *)psStruct->pStructureType->asFuncList[0])->pCornerStat;
sx = psStruct->pos.x; sy = psStruct->pos.y;
removeStruct(psStruct, true);
@ -1468,23 +1466,11 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
powerCalc(true);
if (psStruct != NULL)
{
psStruct->status = SS_BEING_BUILT;
psStruct->status = oldStatus;
psStruct->body = oldBody;
psStruct->currentBuildPts = (SWORD)oldBuildPoints;
}
}
else
if (oldStatus != SS_BEING_BUILT)
{
psStats = ((WALL_FUNCTION *)psStruct->pStructureType->asFuncList[0])->pCornerStat;
sx = psStruct->pos.x; sy = psStruct->pos.y;
removeStruct(psStruct, true);
powerCalc(false);
psStruct = buildStructure(psStats, sx,sy, player, true);
powerCalc(true);
if(psStruct !=NULL)
{
psStruct->status = SS_BUILT;
psStruct->body = oldBody;
buildingComplete(psStruct);
}
}