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-861f7616d084master
parent
edea97a633
commit
28bf4191b6
|
@ -1392,7 +1392,6 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
|
||||||
SDWORD neighbourType, scanType;
|
SDWORD neighbourType, scanType;
|
||||||
STRUCTURE_STATS *psStats;
|
STRUCTURE_STATS *psStats;
|
||||||
UDWORD sx,sy;
|
UDWORD sx,sy;
|
||||||
UDWORD oldBuildPoints;
|
|
||||||
|
|
||||||
// scan around the location looking for walls
|
// scan around the location looking for walls
|
||||||
memset(aWallPresent, 0, sizeof(aWallPresent));
|
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_WALL ||
|
||||||
psStruct->pStructureType->type == REF_GATE ||
|
psStruct->pStructureType->type == REF_GATE ||
|
||||||
psStruct->pStructureType->type == REF_WALLCORNER ||
|
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;
|
aWallPresent[xdiff+2][ydiff+2] = true;
|
||||||
apsStructs[xdiff+2][ydiff+2] = psStruct;
|
apsStructs[xdiff+2][ydiff+2] = psStruct;
|
||||||
|
@ -1454,37 +1454,23 @@ static SDWORD structChooseWallType(UDWORD player, UDWORD mapX, UDWORD mapY)
|
||||||
// change to a corner
|
// change to a corner
|
||||||
if (psStruct->pStructureType->asFuncList[0]->type == WALL_TYPE)
|
if (psStruct->pStructureType->asFuncList[0]->type == WALL_TYPE)
|
||||||
{
|
{
|
||||||
const int oldBody = psStruct->body;
|
const int oldBody = psStruct->body;
|
||||||
|
UDWORD oldBuildPoints = psStruct->currentBuildPts;
|
||||||
|
STRUCT_STATES oldStatus = psStruct->status;
|
||||||
|
|
||||||
/* Still being built - so save and load build points */
|
psStats = ((WALL_FUNCTION *)psStruct->pStructureType->asFuncList[0])->pCornerStat;
|
||||||
if(psStruct->status == SS_BEING_BUILT)
|
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)
|
||||||
{
|
{
|
||||||
oldBuildPoints = psStruct->currentBuildPts;
|
psStruct->status = oldStatus;
|
||||||
psStats = ((WALL_FUNCTION *)psStruct->pStructureType->asFuncList[0])->pCornerStat;
|
psStruct->body = oldBody;
|
||||||
sx = psStruct->pos.x; sy = psStruct->pos.y;
|
psStruct->currentBuildPts = (SWORD)oldBuildPoints;
|
||||||
removeStruct(psStruct, true);
|
if (oldStatus != SS_BEING_BUILT)
|
||||||
powerCalc(false);
|
|
||||||
psStruct = buildStructure(psStats, sx,sy, player, true);
|
|
||||||
powerCalc(true);
|
|
||||||
if(psStruct !=NULL)
|
|
||||||
{
|
{
|
||||||
psStruct->status = SS_BEING_BUILT;
|
|
||||||
psStruct->body = oldBody;
|
|
||||||
psStruct->currentBuildPts = (SWORD)oldBuildPoints;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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);
|
buildingComplete(psStruct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue