mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Bugfixes (by Flugente)
- fixed a bug that caused wrong cursors to be dispalyed in NCTH - fixed an oversight that caused the scope mode toggle not to be working - corrected fortification cursor issues git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5345 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+11
-9
@@ -4450,23 +4450,21 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier )
|
||||
|
||||
if ( pSoldier->pathing.bLevel == 0 )
|
||||
{
|
||||
if ( IsFortificationPossibleAtGridNo( usMapPos, NULL ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
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)) )
|
||||
if ( pShovelObj && (pShovelObj->exists()) && HasItemFlag(pSoldier->inv[ SECONDHANDPOS ].usItem, (SHOVEL)) )
|
||||
{
|
||||
return( TRUE );
|
||||
INT8 bOverTerrainType = GetTerrainType( usMapPos );
|
||||
if( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, (SHOVEL)) )
|
||||
else if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, (SHOVEL)) )
|
||||
{
|
||||
STRUCTURE* pStruct = FindStructure(usMapPos, STRUCTURE_GENERIC);
|
||||
|
||||
@@ -4475,6 +4473,10 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier )
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
else if ( IsFortificationPossibleAtGridNo( usMapPos ) )
|
||||
{
|
||||
return( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
|
||||
@@ -565,10 +565,8 @@ BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT8 *pubID )
|
||||
|
||||
|
||||
// Flugente: determine wether a fortification can be built on this position
|
||||
BOOLEAN IsFortificationPossibleAtGridNo( INT32 sGridNo, UINT8 *pubID )
|
||||
BOOLEAN IsFortificationPossibleAtGridNo( INT32 sGridNo )
|
||||
{
|
||||
GetMouseMapPos( &sGridNo );
|
||||
|
||||
INT8 bOverTerrainType = GetTerrainType( sGridNo );
|
||||
if( bOverTerrainType == MED_WATER || bOverTerrainType == DEEP_WATER || bOverTerrainType == LOW_WATER )
|
||||
return FALSE;
|
||||
|
||||
@@ -38,7 +38,7 @@ BOOLEAN IsCutWireFenceAtGridNo( INT32 sGridNo );
|
||||
|
||||
BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT8 *pubID );
|
||||
BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT8 *pubID );
|
||||
BOOLEAN IsFortificationPossibleAtGridNo( INT32 sGridNo, UINT8 *pubID ); // added by Flugente
|
||||
BOOLEAN IsFortificationPossibleAtGridNo( INT32 sGridNo ); // added by Flugente
|
||||
|
||||
|
||||
BOOLEAN IsRoofPresentAtGridNo( INT32 sGridNo );
|
||||
|
||||
@@ -4440,10 +4440,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
INT32 sGridNo = 0;
|
||||
GetMouseMapPos( &sGridNo );
|
||||
RemoveFortification( sGridNo );
|
||||
//SetScopeMode();
|
||||
SetScopeMode();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -2158,12 +2158,16 @@ UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 ui
|
||||
// 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)) )
|
||||
if ( pShovelObj && (pShovelObj->exists()) && HasItemFlag(pSoldier->inv[ SECONDHANDPOS ].usItem, (SHOVEL)) )
|
||||
{
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
INT8 bOverTerrainType = GetTerrainType( sGridNo );
|
||||
if( bOverTerrainType == FLAT_GROUND || bOverTerrainType == DIRT_ROAD || bOverTerrainType == LOW_GRASS )
|
||||
{
|
||||
return( FORTIFICATION_GREY_UICURSOR );
|
||||
}
|
||||
}
|
||||
else
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
|
||||
return( FORTIFICATION_RED_UICURSOR );
|
||||
}
|
||||
|
||||
if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, (SHOVEL)) )
|
||||
@@ -2179,7 +2183,7 @@ UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 ui
|
||||
}
|
||||
|
||||
// can we build something here?
|
||||
if ( IsFortificationPossibleAtGridNo( sGridNo, NULL ) && pSoldier->pathing.bLevel == 0 )
|
||||
if ( IsFortificationPossibleAtGridNo( sGridNo ) )
|
||||
{
|
||||
return( FORTIFICATION_GREY_UICURSOR );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user