- Sandbags no longer need to be filled.

- Item flags 1 and 4 (EMPTY_SANDAG and SHOVEL) are no longer used.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7968 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-08-12 21:14:48 +00:00
parent 80bdeff0e4
commit 7fed5fd5dd
20 changed files with 84 additions and 234 deletions
-2
View File
@@ -3157,7 +3157,6 @@ void LoadGameAPBPConstants()
APBPConstants[AP_JUMPOFFWALL] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_JUMPOFFWALL",24),24); APBPConstants[AP_JUMPOFFWALL] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_JUMPOFFWALL",24),24);
APBPConstants[AP_FORTIFICATION] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_FORTIFICATION", 250), 250); APBPConstants[AP_FORTIFICATION] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_FORTIFICATION", 250), 250);
APBPConstants[AP_REMOVE_FORTIFICATION] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_REMOVE_FORTIFICATION", 150), 150); APBPConstants[AP_REMOVE_FORTIFICATION] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_REMOVE_FORTIFICATION", 150), 150);
APBPConstants[AP_FILL_SANDBAG] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_FILL_SANDBAG", 200), 200);
APBPConstants[AP_EAT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_EAT",80),80); APBPConstants[AP_EAT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_EAT",80),80);
APBPConstants[AP_CLEANINGKIT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_CLEANINGKIT",80),80); APBPConstants[AP_CLEANINGKIT] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_CLEANINGKIT",80),80);
APBPConstants[AP_DISGUISE] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_DISGUISE",80),80); APBPConstants[AP_DISGUISE] = DynamicAdjustAPConstants(iniReader.ReadInteger("APConstants","AP_DISGUISE",80),80);
@@ -3228,7 +3227,6 @@ void LoadGameAPBPConstants()
APBPConstants[BP_JUMPWALL] = iniReader.ReadInteger("BPConstants","BP_JUMPWALL",500); APBPConstants[BP_JUMPWALL] = iniReader.ReadInteger("BPConstants","BP_JUMPWALL",500);
APBPConstants[BP_FORTIFICATION] = iniReader.ReadInteger("BPConstants","BP_FORTIFICATION", 700); APBPConstants[BP_FORTIFICATION] = iniReader.ReadInteger("BPConstants","BP_FORTIFICATION", 700);
APBPConstants[BP_REMOVE_FORTIFICATION] = iniReader.ReadInteger("BPConstants","BP_REMOVE_FORTIFICATION", 400); APBPConstants[BP_REMOVE_FORTIFICATION] = iniReader.ReadInteger("BPConstants","BP_REMOVE_FORTIFICATION", 400);
APBPConstants[BP_FILL_SANDBAG] = iniReader.ReadInteger("BPConstants","BP_FILL_SANDBAG", 500);
APBPConstants[BP_HANDCUFF] = iniReader.ReadInteger("BPConstants","BP_HANDCUFF", 100); APBPConstants[BP_HANDCUFF] = iniReader.ReadInteger("BPConstants","BP_HANDCUFF", 100);
APBPConstants[BP_APPLYITEM] = iniReader.ReadInteger("BPConstants","BP_APPLYITEM", 50); APBPConstants[BP_APPLYITEM] = iniReader.ReadInteger("BPConstants","BP_APPLYITEM", 50);
APBPConstants[BP_INVENTORY_ARM] = iniReader.ReadInteger("BPConstants","BP_INVENTORY_ARM", 10); APBPConstants[BP_INVENTORY_ARM] = iniReader.ReadInteger("BPConstants","BP_INVENTORY_ARM", 10);
-2
View File
@@ -147,7 +147,6 @@ AP_JUMPWALL,
AP_JUMPOFFWALL, AP_JUMPOFFWALL,
AP_FORTIFICATION, AP_FORTIFICATION,
AP_REMOVE_FORTIFICATION, AP_REMOVE_FORTIFICATION,
AP_FILL_SANDBAG,
AP_EAT, AP_EAT,
AP_CLEANINGKIT, AP_CLEANINGKIT,
AP_DISGUISE, AP_DISGUISE,
@@ -215,7 +214,6 @@ BP_JUMPOFFWALL,
BP_JUMPWALL, BP_JUMPWALL,
BP_FORTIFICATION, BP_FORTIFICATION,
BP_REMOVE_FORTIFICATION, BP_REMOVE_FORTIFICATION,
BP_FILL_SANDBAG,
BP_HANDCUFF, BP_HANDCUFF,
BP_APPLYITEM, BP_APPLYITEM,
BP_INVENTORY_ARM, BP_INVENTORY_ARM,
+2 -2
View File
@@ -1296,7 +1296,7 @@ BOOLEAN RetreatBandagingPending()
} }
// return the ID of best doctor that has a medkit and is travelling with pPatient // return the ID of best doctor that has a medkit and is travelling with pPatient
UINT8 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ) UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient )
{ {
// if this is a travelling, bleeding merc, can somebody who travels with him bandage him/her? // if this is a travelling, bleeding merc, can somebody who travels with him bandage him/her?
if ( pPatient && pPatient->bActive && pPatient->flags.fBetweenSectors && pPatient->bBleeding ) if ( pPatient && pPatient->bActive && pPatient->flags.fBetweenSectors && pPatient->bBleeding )
@@ -1341,7 +1341,7 @@ void HandleRetreatBandaging()
BOOLEAN needhelpinsector = FALSE; BOOLEAN needhelpinsector = FALSE;
INT16 sX = -1; INT16 sX = -1;
INT16 sY = -1; INT16 sY = -1;
UINT8 possiblepatient = NOBODY; UINT16 possiblepatient = NOBODY;
UINT16 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; UINT16 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID;
SOLDIERTYPE* pSoldier = NULL; SOLDIERTYPE* pSoldier = NULL;
+1 -1
View File
@@ -21,7 +21,7 @@ void SetRetreatBandaging( BOOLEAN aVal );
BOOLEAN RetreatBandagingPending( ); BOOLEAN RetreatBandagingPending( );
// return the ID of best doctor that has a medkit and is travelling with pPatient // return the ID of best doctor that has a medkit and is travelling with pPatient
UINT8 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ); UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient );
void HandleRetreatBandaging( ); void HandleRetreatBandaging( );
+10 -33
View File
@@ -1153,47 +1153,24 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
// Flugente: (de-)construct structures // Flugente: (de-)construct structures
if ( HasItemFlag( usHandItem, EMPTY_SANDBAG ) || IsStructureDeconstructItem( usHandItem, sGridNo, pSoldier ) || IsStructureConstructItem( usHandItem, sGridNo, pSoldier ) ) if ( IsStructureDeconstructItem( usHandItem, sGridNo, pSoldier ) || IsStructureConstructItem( usHandItem, sGridNo, pSoldier ) )
{ {
// if we have an empty sandbag in our hands, we also need to have a shovel in our second hand, otherwise we can't fill it // if there is a structure, see if we can deconstruct it, if not, see if we can construct something
if ( HasItemFlag(usHandItem, EMPTY_SANDBAG) ) STRUCTURE* pStruct = FindStructure( sGridNo, (STRUCTURE_GENERIC | STRUCTURE_WIREFENCE) );
if ( pStruct )
{ {
sAPCost = GetAPsForMultiTurnAction( pSoldier, MTA_FILL_SANDBAG ); if ( !IsStructureDeconstructItem( usHandItem, sGridNo, pSoldier ) )
// we can only do this on certain terraintypes
INT8 bOverTerrainType = GetTerrainType( sGridNo );
if ( bOverTerrainType != FLAT_GROUND && bOverTerrainType != DIRT_ROAD && bOverTerrainType != LOW_GRASS )
{
return(ITEM_HANDLE_REFUSAL); return(ITEM_HANDLE_REFUSAL);
}
// check if we have a shovel in our second hand sAPCost = GetAPsForMultiTurnAction( pSoldier, MTA_REMOVE_FORTIFY );
OBJECTTYPE* pShovelObj = &(pSoldier->inv[SECONDHANDPOS]);
if ( !pShovelObj || !(pShovelObj->exists()) || !HasItemFlag(pSoldier->inv[ SECONDHANDPOS ].usItem, (SHOVEL)) )
{
return( ITEM_HANDLE_REFUSAL );
}
} }
else else
{ {
// if there is a structure, see if we can deconstruct it, if not, see if we can construct something if ( !IsStructureConstructItem( usHandItem, sGridNo, pSoldier ) )
STRUCTURE* pStruct = FindStructure( sGridNo, (STRUCTURE_GENERIC | STRUCTURE_WIREFENCE) ); return(ITEM_HANDLE_REFUSAL);
if ( pStruct ) sAPCost = GetAPsForMultiTurnAction( pSoldier, MTA_FORTIFY );
{
if ( !IsStructureDeconstructItem( usHandItem, sGridNo, pSoldier ) )
return(ITEM_HANDLE_REFUSAL);
sAPCost = GetAPsForMultiTurnAction( pSoldier, MTA_REMOVE_FORTIFY );
}
else
{
if ( !IsStructureConstructItem( usHandItem, sGridNo, pSoldier ) )
return(ITEM_HANDLE_REFUSAL);
sAPCost = GetAPsForMultiTurnAction( pSoldier, MTA_FORTIFY );
}
} }
// we are at pSoldier->sGridNo and the action takes place at sGridNo // we are at pSoldier->sGridNo and the action takes place at sGridNo
-15
View File
@@ -4511,21 +4511,6 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier )
if ( pSoldier->pathing.bLevel == 0 ) if ( pSoldier->pathing.bLevel == 0 )
{ {
if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, (EMPTY_SANDBAG)) )
{
// check if we have a shovel in our second hand
OBJECTTYPE* pShovelObj = &(pSoldier->inv[SECONDHANDPOS]);
if ( pShovelObj && pShovelObj->exists() && HasItemFlag(pSoldier->inv[ SECONDHANDPOS ].usItem, (SHOVEL)) )
{
INT8 bOverTerrainType = GetTerrainType( usMapPos );
if( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS )
{
return( TRUE );
}
}
}
if ( IsFortificationPossibleAtGridNo( usMapPos ) && IsStructureConstructItem( pSoldier->inv[HANDPOS].usItem, usMapPos, pSoldier ) ) if ( IsFortificationPossibleAtGridNo( usMapPos ) && IsStructureConstructItem( pSoldier->inv[HANDPOS].usItem, usMapPos, pSoldier ) )
{ {
return(TRUE); return(TRUE);
+2 -2
View File
@@ -730,9 +730,9 @@ extern OBJECTTYPE gTempObject;
// -------- added by Flugente: various item flags -------- // -------- added by Flugente: various item flags --------
// flags used for various item properties (easier than adding 32 differently named variables). DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!! // flags used for various item properties (easier than adding 32 differently named variables). DO NOT CHANGE THEM, UNLESS YOU KNOW WHAT YOU ARE DOING!!!
// note that these should not be used to determine what kind of an attachment an item is, that is determined by attachmentclass and the AC_xxx flags above // note that these should not be used to determine what kind of an attachment an item is, that is determined by attachmentclass and the AC_xxx flags above
#define EMPTY_SANDBAG 0x00000001 //1 //#define EMPTY_SANDBAG 0x00000001 //1
//#define FULL_SANDBAG 0x00000002 //2 //#define FULL_SANDBAG 0x00000002 //2
#define SHOVEL 0x00000004 //4 // a shovel is used for filling sandbags and other building-related tasks //#define SHOVEL 0x00000004 //4 // a shovel is used for filling sandbags and other building-related tasks
//#define CONCERTINA 0x00000008 //8 //#define CONCERTINA 0x00000008 //8
#define WATER_DRUM 0x00000010 //16 // water drums allow to refill canteens in the sector they are in #define WATER_DRUM 0x00000010 //16 // water drums allow to refill canteens in the sector they are in
+1 -4
View File
@@ -4004,12 +4004,9 @@ INT16 GetAPsForMultiTurnAction( SOLDIERTYPE *pSoldier, UINT8 usActionType )
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
sAPCost += APBPConstants[AP_REMOVE_FORTIFICATION]; sAPCost += APBPConstants[AP_REMOVE_FORTIFICATION];
break; break;
case MTA_FILL_SANDBAG:
sAPCost += APBPConstants[AP_FILL_SANDBAG];
break;
} }
if ( usActionType == MTA_FORTIFY || usActionType == MTA_REMOVE_FORTIFY || usActionType == MTA_FILL_SANDBAG ) if ( usActionType == MTA_FORTIFY || usActionType == MTA_REMOVE_FORTIFY )
{ {
sAPCost = (sAPCost * (100 + pSoldier->GetBackgroundValue(BG_FORTIFY))) / 100; sAPCost = (sAPCost * (100 + pSoldier->GetBackgroundValue(BG_FORTIFY))) / 100;
} }
+65 -142
View File
@@ -16039,7 +16039,6 @@ void SOLDIERTYPE::StartMultiTurnAction( UINT8 usActionType, INT32 asGridNo )
{ {
case MTA_FORTIFY: case MTA_FORTIFY:
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
case MTA_FILL_SANDBAG:
if ( this->pathing.bLevel != 0 ) if ( this->pathing.bLevel != 0 )
return; return;
break; break;
@@ -16094,8 +16093,7 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction( )
{ {
case MTA_FORTIFY: case MTA_FORTIFY:
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
case MTA_FILL_SANDBAG: // building on a roof is forbidden! stop this!
// building on a roof is forbidden! stopt his!
if ( this->pathing.bLevel != 0 ) if ( this->pathing.bLevel != 0 )
{ {
CancelMultiTurnAction( FALSE ); CancelMultiTurnAction( FALSE );
@@ -16123,7 +16121,7 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction( )
OBJECTTYPE* pObj = &(this->inv[HANDPOS]); OBJECTTYPE* pObj = &(this->inv[HANDPOS]);
// error if the gridno we started working on is not the gridno we are currently looking at // error if the gridno we started working on is not the gridno we are currently looking at
if ( usMultiTurnAction == MTA_FORTIFY || usMultiTurnAction == MTA_REMOVE_FORTIFY || usMultiTurnAction == MTA_FILL_SANDBAG ) if ( usMultiTurnAction == MTA_FORTIFY || usMultiTurnAction == MTA_REMOVE_FORTIFY )
{ {
if ( !pObj || !(pObj->exists( )) ) if ( !pObj || !(pObj->exists( )) )
fActionStillValid = FALSE; fActionStillValid = FALSE;
@@ -16141,49 +16139,26 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction( )
INT16 entirebpcost = 0; INT16 entirebpcost = 0;
switch ( usMultiTurnAction ) switch ( usMultiTurnAction )
{ {
case MTA_FORTIFY: case MTA_FORTIFY:
{ {
entireapcost = GetAPsForMultiTurnAction( this, MTA_FORTIFY ); entireapcost = GetAPsForMultiTurnAction( this, MTA_FORTIFY );
entirebpcost = APBPConstants[BP_FORTIFICATION]; entirebpcost = APBPConstants[BP_FORTIFICATION];
if ( !IsFortificationPossibleAtGridNo( this->sMTActionGridNo ) ) if ( !IsFortificationPossibleAtGridNo( this->sMTActionGridNo ) )
fActionStillValid = FALSE; fActionStillValid = FALSE;
else if ( !IsStructureConstructItem( this->inv[HANDPOS].usItem, this->sMTActionGridNo, this ) ) else if ( !IsStructureConstructItem( this->inv[HANDPOS].usItem, this->sMTActionGridNo, this ) )
fActionStillValid = FALSE; fActionStillValid = FALSE;
} }
break; break;
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
{ {
entireapcost = GetAPsForMultiTurnAction( this, MTA_REMOVE_FORTIFY ); entireapcost = GetAPsForMultiTurnAction( this, MTA_REMOVE_FORTIFY );
entirebpcost = APBPConstants[BP_REMOVE_FORTIFICATION]; entirebpcost = APBPConstants[BP_REMOVE_FORTIFICATION];
if ( !IsStructureDeconstructItem( this->inv[HANDPOS].usItem, this->sMTActionGridNo, this ) ) if ( !IsStructureDeconstructItem( this->inv[HANDPOS].usItem, this->sMTActionGridNo, this ) )
fActionStillValid = FALSE; fActionStillValid = FALSE;
} }
break;
case MTA_FILL_SANDBAG:
{
entireapcost = GetAPsForMultiTurnAction( this, MTA_FILL_SANDBAG );
entirebpcost = APBPConstants[BP_FILL_SANDBAG];
if ( !HasItemFlag( this->inv[HANDPOS].usItem, EMPTY_SANDBAG ) )
fActionStillValid = FALSE;
else
{
INT8 bOverTerrainType = GetTerrainType( sGridNo );
if ( bOverTerrainType != FLAT_GROUND && bOverTerrainType != DIRT_ROAD && bOverTerrainType != LOW_GRASS )
fActionStillValid = FALSE;
else
{
// check if we have a shovel in our second hand
OBJECTTYPE* pShovelObj = &(this->inv[SECONDHANDPOS]);
if ( !pShovelObj || !(pShovelObj->exists( )) || !HasItemFlag( this->inv[SECONDHANDPOS].usItem, SHOVEL ) )
fActionStillValid = FALSE;
}
}
}
break; break;
} }
@@ -16196,25 +16171,24 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction( )
// refresh animations // refresh animations
switch ( usMultiTurnAction ) switch ( usMultiTurnAction )
{ {
case MTA_FORTIFY: case MTA_FORTIFY:
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
case MTA_FILL_SANDBAG: {
{ // if we are not in turnbased and no enemies are around, we reduce the number of necessary action points to 0. No need to keep waiting if there's nobody around anyway
// if we are not in turnbased and no enemies are around, we reduce the number of necessary action points to 0. No need to keep waiting if there's nobody around anyway if ( !(gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) )
if ( !(gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) ) bOverTurnAPS = 0;
bOverTurnAPS = 0; // otherwise this might take longer, so we refresh our animation
// otherwise this might take longer, so we refresh our animation else
else {
{ if ( !is_networked )
if ( !is_networked ) this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0, FALSE );
this->EVENT_InitNewSoldierAnim( CUTTING_FENCE, 0, FALSE ); else
else this->ChangeSoldierState( CUTTING_FENCE, 0, 0 );
this->ChangeSoldierState( CUTTING_FENCE, 0, 0 );
// as setting the new animation costs APBPConstants[AP_USEWIRECUTTERS] APs every time, account for that // as setting the new animation costs APBPConstants[AP_USEWIRECUTTERS] APs every time, account for that
bOverTurnAPS = max( 0, bOverTurnAPS - APBPConstants[AP_USEWIRECUTTERS] ); bOverTurnAPS = max( 0, bOverTurnAPS - APBPConstants[AP_USEWIRECUTTERS] );
} }
} }
break; break;
} }
@@ -16223,59 +16197,27 @@ BOOLEAN SOLDIERTYPE::UpdateMultiTurnAction( )
{ {
switch ( usMultiTurnAction ) switch ( usMultiTurnAction )
{ {
case MTA_FORTIFY: case MTA_FORTIFY:
{ {
// Build the thing // Build the thing
if ( BuildFortification( this->sMTActionGridNo, this, pObj ) ) if ( BuildFortification( this->sMTActionGridNo, this, pObj ) )
{ {
// we gain a bit of experience... // we gain a bit of experience...
StatChange( this, STRAMT, 4, TRUE ); StatChange( this, STRAMT, 4, TRUE );
StatChange( this, HEALTHAMT, 2, TRUE ); StatChange( this, HEALTHAMT, 2, TRUE );
} }
} }
break; break;
case MTA_REMOVE_FORTIFY: case MTA_REMOVE_FORTIFY:
{ {
if ( RemoveFortification( this->sMTActionGridNo, this, pObj ) ) if ( RemoveFortification( this->sMTActionGridNo, this, pObj ) )
{ {
// we gain a bit of experience... // we gain a bit of experience...
StatChange( this, STRAMT, 3, TRUE ); StatChange( this, STRAMT, 3, TRUE );
StatChange( this, HEALTHAMT, 2, TRUE ); StatChange( this, HEALTHAMT, 2, TRUE );
} }
} }
break;
case MTA_FILL_SANDBAG:
{
// eventually search for the number of a sandbag item
UINT16 fullsandbagnr = Item[this->inv[HANDPOS].usItem].usBuddyItem;
if ( fullsandbagnr )
{
INT8 bObjSlot = HANDPOS;
UINT16 usItem = pObj->usItem;
CreateItem( fullsandbagnr, 100, &gTempObject );
if ( !(gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT) && gfShiftBombPlant )
{
// sevenfm: drop filled sandbag to the ground and take new empty from inventory
AddItemToPool( this->sGridNo, &gTempObject, 1, 0, 0, -1 );
DeleteObj( &(this->inv[HANDPOS]) );
TakeNewItemFromInventory( usItem );
}
else
{
SwapObjs( this, bObjSlot, &gTempObject, TRUE );
}
// sevenfm: added this to correctly update interface
DirtyMercPanelInterface( this, DIRTYLEVEL2 );
// we gain a bit of experience...
StatChange( this, STRAMT, 1, TRUE );
StatChange( this, HEALTHAMT, 1, TRUE );
}
}
break; break;
} }
@@ -19793,43 +19735,24 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
// do checks here... // do checks here...
OBJECTTYPE* pObj = &(this->inv[HANDPOS]); OBJECTTYPE* pObj = &(this->inv[HANDPOS]);
if ( pObj && pObj->exists( ) && (HasItemFlag( this->inv[HANDPOS].usItem, EMPTY_SANDBAG ) || IsStructureConstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) || IsStructureDeconstructItem( this->inv[HANDPOS].usItem, sGridNo, this )) ) if ( pObj && pObj->exists( ) && ( IsStructureConstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) || IsStructureDeconstructItem( this->inv[HANDPOS].usItem, sGridNo, this )) )
{ {
if ( HasItemFlag( this->inv[HANDPOS].usItem, EMPTY_SANDBAG ) ) // it is possible that an item is used in both constructing and deconstructing. We thus check wether a structure already exists at sGridNo to dedcut the players intention
// if there is a structure, we will remove this fortification. If there isn't, then we will dig and create a earth pile
STRUCTURE* pStruct = FindStructure( sGridNo, STRUCTURE_GENERIC );
if ( !pStruct && IsStructureConstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) )
{ {
INT8 bOverTerrainType = GetTerrainType( sGridNo ); // Build the thing
if ( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS ) this->StartMultiTurnAction( MTA_FORTIFY, sGridNo );
{
// check if we have a shovel in our second hand
OBJECTTYPE* pShovelObj = &(this->inv[SECONDHANDPOS]);
if ( pShovelObj && pShovelObj->exists( ) && HasItemFlag( this->inv[SECONDHANDPOS].usItem, SHOVEL ) ) fSuccess = TRUE;
{
this->StartMultiTurnAction( MTA_FILL_SANDBAG, sGridNo );
fSuccess = TRUE;
}
}
} }
else else if ( IsStructureDeconstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) )
{ {
// it is possible that an item is used in both constructing and deconstructing. We thus check wether a structure already exists at sGridNo to dedcut the players intention this->StartMultiTurnAction( MTA_REMOVE_FORTIFY, sGridNo );
// if there is a structure, we will remove this fortification. If there isn't, then we will dig and create a earth pile
STRUCTURE* pStruct = FindStructure( sGridNo, STRUCTURE_GENERIC );
if ( !pStruct && IsStructureConstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) ) fSuccess = TRUE;
{
// Build the thing
this->StartMultiTurnAction( MTA_FORTIFY, sGridNo );
fSuccess = TRUE;
}
else if ( IsStructureDeconstructItem( this->inv[HANDPOS].usItem, sGridNo, this ) )
{
this->StartMultiTurnAction( MTA_REMOVE_FORTIFY, sGridNo );
fSuccess = TRUE;
}
} }
} }
-1
View File
@@ -561,7 +561,6 @@ enum
MTA_NONE = 0, MTA_NONE = 0,
MTA_FORTIFY, MTA_FORTIFY,
MTA_REMOVE_FORTIFY, MTA_REMOVE_FORTIFY,
MTA_FILL_SANDBAG,
NUM_MTA, NUM_MTA,
}; };
+1 -19
View File
@@ -2208,24 +2208,6 @@ UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 ui
if ( pSoldier->pathing.bLevel != 0 ) if ( pSoldier->pathing.bLevel != 0 )
return( FORTIFICATION_RED_UICURSOR ); return( FORTIFICATION_RED_UICURSOR );
// if we have an empty sandbag in our hands, we also need to have a shovel in our second hand, otherwise we can't fill it
if ( HasItemFlag( pSoldier->inv[HANDPOS].usItem, EMPTY_SANDBAG) )
{
// check if we have a shovel in our second hand
OBJECTTYPE* pShovelObj = &(pSoldier->inv[SECONDHANDPOS]);
if ( pShovelObj && (pShovelObj->exists()) && HasItemFlag(pSoldier->inv[ SECONDHANDPOS ].usItem, SHOVEL) )
{
INT8 bOverTerrainType = GetTerrainType( sGridNo );
if( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS )
{
return( FORTIFICATION_GREY_UICURSOR );
}
}
return( FORTIFICATION_RED_UICURSOR );
}
if ( IsFortificationPossibleAtGridNo( sGridNo ) && IsStructureConstructItem( pSoldier->inv[HANDPOS].usItem, sGridNo, pSoldier ) ) if ( IsFortificationPossibleAtGridNo( sGridNo ) && IsStructureConstructItem( pSoldier->inv[HANDPOS].usItem, sGridNo, pSoldier ) )
{ {
return( FORTIFICATION_GREY_UICURSOR ); return( FORTIFICATION_GREY_UICURSOR );
@@ -2820,7 +2802,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
// Flugente: cursor for constructing/deconstructing // Flugente: cursor for constructing/deconstructing
// at the moment the gridno is not required in these functions, thus 1 suffices // at the moment the gridno is not required in these functions, thus 1 suffices
if ( HasItemFlag( usInHand, EMPTY_SANDBAG ) || IsStructureConstructItem( usInHand, 1, pSoldier ) || IsStructureDeconstructItem( usInHand, 1, pSoldier ) ) if ( IsStructureConstructItem( usInHand, 1, pSoldier ) || IsStructureDeconstructItem( usInHand, 1, pSoldier ) )
ubCursor = FORTICURS; ubCursor = FORTICURS;
// Flugente: cursor for handcuffs // Flugente: cursor for handcuffs
+1 -2
View File
@@ -877,9 +877,8 @@ enum
STR_MTA_NONE, STR_MTA_NONE,
STR_MTA_FORTIFY, STR_MTA_FORTIFY,
STR_MTA_REMOVE_FORTIFY, STR_MTA_REMOVE_FORTIFY,
STR_TA_FILL_SANDBAG,
STR_MTA_CANCEL, STR_MTA_CANCEL,
STR_MTA_CANNOT_BUILD, STR_MTA_CANNOT_BUILD,
TEXT_NUM_MTA_STR TEXT_NUM_MTA_STR
}; };
-1
View File
@@ -8178,7 +8178,6 @@ STR16 szMTATextStr[]=
L"空无一物", L"空无一物",
L"建造掩体", //L"building a fortification", L"建造掩体", //L"building a fortification",
L"拆除掩体", //L"removing a fortification", L"拆除掩体", //L"removing a fortification",
L"填满沙包", //L"filling sandbags",
L"%s必须停止%s", //L"%s had to stop %s.", L"%s必须停止%s", //L"%s had to stop %s.",
L"所选的路障无法再该分区建造", L"所选的路障无法再该分区建造",
}; };
-1
View File
@@ -8189,7 +8189,6 @@ STR16 szMTATextStr[]= // TODO.Translate
L"nothing", L"nothing",
L"building a fortification", L"building a fortification",
L"removing a fortification", L"removing a fortification",
L"filling sandbags",
L"%s had to stop %s.", L"%s had to stop %s.",
L"The selected barricade cannot be built in this sector", // TODO.Translate L"The selected barricade cannot be built in this sector", // TODO.Translate
}; };
-1
View File
@@ -8176,7 +8176,6 @@ STR16 szMTATextStr[]=
L"nothing", L"nothing",
L"building a fortification", L"building a fortification",
L"removing a fortification", L"removing a fortification",
L"filling sandbags",
L"%s had to stop %s.", L"%s had to stop %s.",
L"The selected barricade cannot be built in this sector", L"The selected barricade cannot be built in this sector",
}; };
-1
View File
@@ -8175,7 +8175,6 @@ STR16 szMTATextStr[]=
L"rien, en fait.", L"rien, en fait.",
L"la construction d'une fortification", L"la construction d'une fortification",
L"le retrait d'une fortification", L"le retrait d'une fortification",
L"le remplissage des sacs de sable",
L"%s a dû arrêter... %s", L"%s a dû arrêter... %s",
L"Cette sorte de barricade ne peut pas être construite dans ce secteur", L"Cette sorte de barricade ne peut pas être construite dans ce secteur",
}; };
-1
View File
@@ -8006,7 +8006,6 @@ STR16 szMTATextStr[]=
L"nichts", L"nichts",
L"baue eine Befestigung", L"baue eine Befestigung",
L"entferne eine Befestigung", L"entferne eine Befestigung",
L"Sandsäcke befüllen",
L"%s musste %s stoppen.", L"%s musste %s stoppen.",
L"The selected barricade cannot be built in this sector", // TODO.Translate L"The selected barricade cannot be built in this sector", // TODO.Translate
}; };
-1
View File
@@ -8183,7 +8183,6 @@ STR16 szMTATextStr[]= // TODO.Translate
L"nothing", L"nothing",
L"building a fortification", L"building a fortification",
L"removing a fortification", L"removing a fortification",
L"filling sandbags",
L"%s had to stop %s.", L"%s had to stop %s.",
L"The selected barricade cannot be built in this sector", // TODO.Translate L"The selected barricade cannot be built in this sector", // TODO.Translate
}; };
-1
View File
@@ -8201,7 +8201,6 @@ STR16 szMTATextStr[]= // TODO.Translate
L"nothing", L"nothing",
L"building a fortification", L"building a fortification",
L"removing a fortification", L"removing a fortification",
L"filling sandbags",
L"%s had to stop %s.", L"%s had to stop %s.",
L"The selected barricade cannot be built in this sector", // TODO.Translate L"The selected barricade cannot be built in this sector", // TODO.Translate
}; };
-1
View File
@@ -8176,7 +8176,6 @@ STR16 szMTATextStr[]=
L"ничего", L"ничего",
L"укрепление строится", L"укрепление строится",
L"укрепление убирается", L"укрепление убирается",
L"наполнение мешков",
L"%s был вынужден прекратить %s.", L"%s был вынужден прекратить %s.",
L"Выбранное укрепление не может быть построено в этом секторе", L"Выбранное укрепление не может быть построено в этом секторе",
}; };