Fixes (by Buggler)

- Fixed CTD when displaying militia assignment box that has regions beyond sector P16
- Corrected variable for heli tile gridno calculation 

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6623 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-11-18 08:26:42 +00:00
parent bee0294665
commit 79a62c1750
2 changed files with 40 additions and 4 deletions
+4 -4
View File
@@ -2322,10 +2322,10 @@ void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite )
{
AddHeliPiece( iGridNo, ( UINT16 ) iTileIndexNo ); // AddHeliPiece( iGridNo, sOStruct );
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 1 ) );
AddHeliPiece( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
AddHeliPiece( ( iGridNo - WORLD_COLS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 3 ) );
AddHeliPiece( iGridNo, ( UINT16 )( iTileIndexNo + 4 ) );
AddHeliPiece( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
AddHeliPiece( ( iGridNo - WORLD_COLS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
InvalidateWorldRedundency();
SetRenderFlags( RENDER_FLAG_FULL );
@@ -2348,10 +2348,10 @@ void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite )
// remove from the world
RemoveStruct( iGridNo, ( UINT16 )iTileIndexNo );
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 1 ) );
RemoveStruct( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
RemoveStruct( ( iGridNo - WORLD_COLS * 5 ), ( UINT16 )( iTileIndexNo + 2 ) ); // ( iGridNo - 800 )
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 3 ) );
RemoveStruct( iGridNo, ( UINT16 )( iTileIndexNo + 4 ) );
RemoveStruct( ( iGridNo - WORLD_ROWS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
RemoveStruct( ( iGridNo - WORLD_COLS * 5 ), ( UINT16 )( iTileIndexNo + 5 ) ); // ( iGridNo - 800 )
InvalidateWorldRedundency();
SetRenderFlags( RENDER_FLAG_FULL );
+36
View File
@@ -5731,6 +5731,12 @@ void RenderIconsPerSectorForSelectedTown( void )
{
// grab current sector value
sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) );
// skip sectors that's beyond sector P16
if( sCurrentSectorValue > SEC_P16 )
{
continue;
}
sSectorX = SECTORX( sCurrentSectorValue );
sSectorY = SECTORY( sCurrentSectorValue );
@@ -6128,6 +6134,12 @@ BOOLEAN IsThisMilitiaTownSectorAllowable( INT16 sSectorIndexValue )
// is this sector allowed to be clicked on?
sBaseSectorValue = GetBaseSectorForCurrentTown( );
sGlobalMapSector = sBaseSectorValue + ( ( sSectorIndexValue % MILITIA_BOX_ROWS ) + ( sSectorIndexValue / MILITIA_BOX_ROWS ) * 16 );
// skip sectors that's beyond sector P16
if( sGlobalMapSector > SEC_P16 )
{
return( FALSE );
}
sSectorX = SECTORX( sGlobalMapSector );
sSectorY = SECTORY( sGlobalMapSector );
@@ -6358,6 +6370,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4");
{
// grab current sector value
sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) );
// skip sectors that's beyond sector P16
if( sCurrentSectorValue > SEC_P16 )
{
continue;
}
sSectorX = SECTORX( sCurrentSectorValue );
sSectorY = SECTORY( sCurrentSectorValue );
@@ -6642,6 +6660,12 @@ void RenderShadingForUnControlledSectors( void )
{
// grab current sector value
sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) );
// skip sectors that's beyond sector P16
if( sCurrentSectorValue > SEC_P16 )
{
continue;
}
sSectorX = SECTORX( sCurrentSectorValue );
sSectorY = SECTORY( sCurrentSectorValue );
@@ -7506,6 +7530,12 @@ BOOLEAN CanMilitiaAutoDistribute( void )
{
// grab current sector value
sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) );
// skip sectors that's beyond sector P16
if( sCurrentSectorValue > SEC_P16 )
{
continue;
}
sSectorX = SECTORX( sCurrentSectorValue );
sSectorY = SECTORY( sCurrentSectorValue );
@@ -7829,6 +7859,12 @@ BOOLEAN CanRedistributeMilitiaInSector( INT16 sClickedSectorX, INT16 sClickedSec
{
// grab current sector value
sCurrentSectorValue = sBaseSectorValue + ( ( iCounter % MILITIA_BOX_ROWS ) + ( iCounter / MILITIA_BOX_ROWS ) * ( 16 ) );
// skip sectors that's beyond sector P16
if( sCurrentSectorValue > SEC_P16 )
{
continue;
}
sSectorX = SECTORX( sCurrentSectorValue );
sSectorY = SECTORY( sCurrentSectorValue );