mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Unified strategic map display code for airspace, militia restrictions and disease
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8101 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+29
-33
@@ -503,47 +503,43 @@ UINT16 GetSectorPopulation( INT16 sX, INT16 sY, BOOLEAN fWithMilitary )
|
||||
}
|
||||
|
||||
// colour for a sector on the map
|
||||
INT32 GetMapColour( INT16 sX, INT16 sY, UINT8 mode )
|
||||
INT32 GetMapColour( INT16 sX, INT16 sY, BOOLEAN aDiseaseOn )
|
||||
{
|
||||
UINT8 sector = SECTOR( sX, sY );
|
||||
|
||||
switch ( mode )
|
||||
if ( aDiseaseOn )
|
||||
{
|
||||
case MAPMODE_DISEASE:
|
||||
UINT16 population = GetSectorPopulation( sX, sY );
|
||||
|
||||
if ( population )
|
||||
{
|
||||
UINT16 population = GetSectorPopulation( sX, sY );
|
||||
UINT8 sector = SECTOR( sX, sY );
|
||||
|
||||
if ( population )
|
||||
SECTORINFO *pSectorInfo = &(SectorInfo[sector]);
|
||||
|
||||
// display sector information only if we know about infection there
|
||||
if ( pSectorInfo && ((pSectorInfo->usInfectionFlag & SECTORDISEASE_DIAGNOSED_PLAYER) || (gubFact[FACT_DISEASE_WHODATA_ACCESS] && pSectorInfo->usInfectionFlag & SECTORDISEASE_DIAGNOSED_WHO)) )
|
||||
{
|
||||
SECTORINFO *pSectorInfo = &(SectorInfo[sector]);
|
||||
FLOAT infectedpercentage = (FLOAT)pSectorInfo->usInfected / (FLOAT)(population);
|
||||
|
||||
// display sector information only if we know about infection there
|
||||
if ( pSectorInfo && ((pSectorInfo->usInfectionFlag & SECTORDISEASE_DIAGNOSED_PLAYER) || (gubFact[FACT_DISEASE_WHODATA_ACCESS] && pSectorInfo->usInfectionFlag & SECTORDISEASE_DIAGNOSED_WHO)) )
|
||||
{
|
||||
FLOAT infectedpercentage = (FLOAT)pSectorInfo->usInfected / (FLOAT)(population);
|
||||
|
||||
if ( infectedpercentage < 0.2f )
|
||||
return MAP_SHADE_DK_GREEN;
|
||||
else if ( infectedpercentage < 0.3f )
|
||||
return MAP_SHADE_MD_GREEN;
|
||||
else if ( infectedpercentage < 0.4f )
|
||||
return MAP_SHADE_LT_GREEN;
|
||||
else if ( infectedpercentage < 0.5f )
|
||||
return MAP_SHADE_DK_YELLOW;
|
||||
else if ( infectedpercentage < 0.6f )
|
||||
return MAP_SHADE_MD_YELLOW;
|
||||
else if ( infectedpercentage < 0.7f )
|
||||
return MAP_SHADE_LT_YELLOW;
|
||||
else if ( infectedpercentage < 0.8f )
|
||||
return MAP_SHADE_DK_RED;
|
||||
else if ( infectedpercentage < 0.9f )
|
||||
return MAP_SHADE_MD_RED;
|
||||
else
|
||||
return MAP_SHADE_LT_RED;
|
||||
}
|
||||
if ( infectedpercentage < 0.2f )
|
||||
return MAP_SHADE_DK_GREEN;
|
||||
else if ( infectedpercentage < 0.3f )
|
||||
return MAP_SHADE_MD_GREEN;
|
||||
else if ( infectedpercentage < 0.4f )
|
||||
return MAP_SHADE_LT_GREEN;
|
||||
else if ( infectedpercentage < 0.5f )
|
||||
return MAP_SHADE_DK_YELLOW;
|
||||
else if ( infectedpercentage < 0.6f )
|
||||
return MAP_SHADE_MD_YELLOW;
|
||||
else if ( infectedpercentage < 0.7f )
|
||||
return MAP_SHADE_LT_YELLOW;
|
||||
else if ( infectedpercentage < 0.8f )
|
||||
return MAP_SHADE_DK_RED;
|
||||
else if ( infectedpercentage < 0.9f )
|
||||
return MAP_SHADE_MD_RED;
|
||||
else
|
||||
return MAP_SHADE_LT_RED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return MAP_SHADE_DK_GREY;
|
||||
|
||||
Reference in New Issue
Block a user