mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Fortification feature fixes (by Flugente)
- fixed a bug that prohibited building a structure in turnbased mode - fixed a bug that caused a wrong AP cost for fortification actions - fixed itemflag - fixed cursor animations for fortifications git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5343 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -14392,6 +14392,11 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
else
|
||||
this->ChangeSoldierState( CUTTING_FENCE, 0, 0 );
|
||||
|
||||
// ugly, ugly hack: as e do not have a special animation for this action, we use the 'cut a fence' animations
|
||||
// however, APs are directly deducted because of this. So we can't use the AP_FORTIFICATION costs
|
||||
// for this reason, we deduct the APS still missing here
|
||||
INT16 restAPs = max(0, APBPConstants[AP_FORTIFICATION] - APBPConstants[AP_USEWIRECUTTERS]);
|
||||
|
||||
if ( HasItemFlag(this->inv[ HANDPOS ].usItem, (FULL_SANDBAG|CONCERTINA)) )
|
||||
{
|
||||
// Build the thing
|
||||
@@ -14404,6 +14409,8 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 4, TRUE );
|
||||
StatChange( this, HEALTHAMT, 2, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -14432,8 +14439,31 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 1, TRUE );
|
||||
StatChange( this, HEALTHAMT, 1, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullsandbagnr = 2824;
|
||||
if ( HasItemFlag(fullsandbagnr, FULL_SANDBAG) )
|
||||
{
|
||||
// Erase 'material' item from our hand - we 'used' it to build the structure
|
||||
INT8 bObjSlot = HANDPOS;
|
||||
|
||||
CreateItem( fullsandbagnr, 100, &gTempObject );
|
||||
|
||||
SwapObjs( this, bObjSlot, &gTempObject, TRUE );
|
||||
|
||||
// we gain a bit of experience...
|
||||
StatChange( this, STRAMT, 1, TRUE );
|
||||
StatChange( this, HEALTHAMT, 1, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14458,8 +14488,32 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
StatChange( this, STRAMT, 3, TRUE );
|
||||
StatChange( this, HEALTHAMT, 2, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fullsandbagnr = 2824;
|
||||
if ( HasItemFlag(fullsandbagnr, FULL_SANDBAG) )
|
||||
{
|
||||
// Erase 'material' item from our hand - we 'used' it to build the structure
|
||||
INT8 bObjSlot = HANDPOS;
|
||||
|
||||
CreateItem( fullsandbagnr, 100, &gTempObject );
|
||||
|
||||
// now add a tripwire item to the floor, simulating that activating tripwire deactivates it
|
||||
AddItemToPool( sGridNo, &gTempObject, 1, 0, 0, -1 );
|
||||
|
||||
// we gain a bit of experience...
|
||||
StatChange( this, STRAMT, 3, TRUE );
|
||||
StatChange( this, HEALTHAMT, 2, TRUE );
|
||||
|
||||
DeductPoints( this, restAPs, 0, AFTERACTION_INTERRUPT );
|
||||
|
||||
fSuccess = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user