From 51e2c6b293ddae1a7838ae08aa8746b11c14f201 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 30 May 2020 13:24:33 +0000 Subject: [PATCH] Minor code cleanup (by Asdow and sun_alf) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8812 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface Map.cpp | 29 +++++++------------------- Strategic/Town Militia.cpp | 2 +- TileEngine/renderworld.cpp | 9 ++------ 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 952bc773..af0f6939 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -866,25 +866,19 @@ UINT32 DrawMap( void ) case MAP_DISPLAY_AIRSPACE_COLOURED_SAMS: { - CHAR16 sString[20]; - swprintf( sString, L"%d", ubSAMControlledSectors[cnt2][cnt] ); - BOOLEAN a = FALSE; BOOLEAN b = FALSE; BOOLEAN c = FALSE; BOOLEAN d = FALSE; - + BOOLEAN samworking = FALSE; + for ( int i = 0; i < NUMBER_OF_SAMS; ++i ) { - for ( int i = 0; i < NUMBER_OF_SAMS; ++i ) + if ( DoesSamCoverSector( i, SECTOR( cnt, cnt2 ), &samworking ) && samworking ) { - BOOLEAN samworking = FALSE; - if ( DoesSamCoverSector( i, SECTOR( cnt, cnt2 ), &samworking ) && samworking ) - { - if ( i == 0 ) a = TRUE; - if ( i == 1 ) b = TRUE; - if ( i == 2 ) c = TRUE; - if ( i == 3 ) d = TRUE; - } + if ( i == 0 ) a = TRUE; + if ( i == 1 ) b = TRUE; + if ( i == 2 ) c = TRUE; + if ( i == 3 ) d = TRUE; } } @@ -918,15 +912,6 @@ UINT32 DrawMap( void ) ShadeMapElem( cnt, cnt2, MAP_SHADE_MIX_GREEN_BLUE_YELLOW ); else if ( a && b && c && d ) ShadeMapElem( cnt, cnt2, MAP_SHADE_MIX_RED_GREEN_BLUE_YELLOW ); - - INT16 sXCorner = (INT16)(MAP_VIEW_START_X + (cnt * MAP_GRID_X)); - INT16 sYCorner = (INT16)(MAP_VIEW_START_Y + (cnt2 * MAP_GRID_Y)); - - INT16 usXPos, usYPos; - FindFontCenterCoordinates( sXCorner, sYCorner, MAP_GRID_X, MAP_GRID_Y, sString, FONT14ARIAL, &usXPos, &usYPos ); - - gprintfdirty( usXPos, usYPos, sString ); - mprintf( usXPos, usYPos, sString ); } break; diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index 9c2ba1f3..bd09a5fb 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -2110,7 +2110,7 @@ FLOAT CalcHourlyVolunteerGain() for ( UINT8 sX = 1; sX < MAP_WORLD_X - 1; ++sX ) { - for ( UINT8 sY = 1; sY < MAP_WORLD_X - 1; ++sY ) + for ( UINT8 sY = 1; sY < MAP_WORLD_Y - 1; ++sY ) { // not if the enemy controls this sector if ( StrategicMap[CALCULATE_STRATEGIC_INDEX( sX, sY )].fEnemyControlled ) diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index cb1f0cce..eee07f93 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -2178,14 +2178,9 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } } // ATE: Check here for a lot of conditions! - else if (((uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT)) && !(uiFlags&TILES_DIRTY)) + else if ( (uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT) && !(uiFlags&TILES_DIRTY) ) { - bItemOutline = TRUE; - - if (uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT) - { - bItemOutline = FALSE; - } + bItemOutline = FALSE; bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect);