- Fixed hidden towns and sam sites a dead giveaway when calling info box in strategic screen (by Buggler)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6604 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-11-15 19:28:27 +00:00
parent ba31e849e4
commit 4ad50accc6
2 changed files with 51 additions and 15 deletions
@@ -393,17 +393,21 @@ void AddTextToTownBox( void )
AddSectorToBox();
// town size
if( gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{
swprintf( wString, L"%s:", pwTownInfoStrings[ 0 ] );
AddMonoString( &hStringHandle, wString );
swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) );
AddSecondColumnMonoString( &hStringHandle, wString );
}
// main facilities
// HEADROCK HAM 3.6: This function now does all the work of assembling a facility entry.
AddFacilitiesToBox( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &hStringHandle, TRUE );
// the concept of control is only meaningful in sectors where militia can be trained
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) )
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) &&
gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{
// town control
swprintf( wString, L"%s:", pwTownInfoStrings[ 2 ] );
@@ -413,7 +417,8 @@ void AddTextToTownBox( void )
}
// the concept of town loyalty is only meaningful in towns where loyalty is tracked
if( gTownLoyalty[ ubTownId ].fStarted && gfTownUsesLoyalty[ ubTownId ])
if( gTownLoyalty[ ubTownId ].fStarted && gfTownUsesLoyalty[ ubTownId ] &&
gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{
// town loyalty
swprintf( wString, L"%s:", pwTownInfoStrings[ 5 ] );
@@ -424,7 +429,7 @@ void AddTextToTownBox( void )
// if the town has a mine
sMineSector = GetMineSectorForTown( ubTownId );
if( sMineSector != -1 )
if( sMineSector != -1 && gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{
// Associated Mine: Sector
swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] );
@@ -696,34 +701,62 @@ void AddCommonInfoToBox(void)
{
CHAR16 wString[ 64 ];
UINT32 hStringHandle = 0;
BOOLEAN fUnknownSAMSite = FALSE;
BOOLEAN fHiddenSite = FALSE;
UINT8 ubMilitiaTotal = 0;
UINT8 ubNumEnemies;
UINT16 usSectorValue = 0;
// get the sector value
usSectorValue = SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY );
// check for hidden town
if( !gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
fHiddenSite = TRUE;
// check for unknown SAM Site
else
{
for (UINT16 x=0; x < MAX_NUMBER_OF_SAMS; x++)
{
// SAM Site 4 in Meduna is within town limits, so it's always known
if ( usSectorValue == SEC_N4 && x == 3)
fHiddenSite = FALSE;
else if ( pSamList[x] == usSectorValue )
{
if ( !fSamSiteFound[ x ] )
{
fHiddenSite = TRUE;
}
}
}
}
/*// ABOVE GROUND HARDCODED
if( ubSectorID == SEC_N4 && fSamSiteFound[ SAM_SITE_FOUR ] )
switch( SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
{
case SEC_D2: //Chitzena SAM
if( !fSamSiteFound[ SAM_SITE_ONE ] )
fUnknownSAMSite = TRUE;
fHiddenSite = TRUE;
break;
case SEC_D15: //Drassen SAM
if( !fSamSiteFound[ SAM_SITE_TWO ] )
fUnknownSAMSite = TRUE;
fHiddenSite = TRUE;
break;
case SEC_I8: //Cambria SAM
if( !fSamSiteFound[ SAM_SITE_THREE ] )
fUnknownSAMSite = TRUE;
fHiddenSite = TRUE;
break;
// SAM Site 4 in Meduna is within town limits, so it's always controllable
default:
break;
}
*/
// in sector where militia can be trained,
// control of the sector matters, display who controls this sector. Map brightness no longer gives this!
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && !fUnknownSAMSite )
if ( MilitiaTrainingAllowedInSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY, 0 ) && !fHiddenSite )
{
// controlled:
swprintf( wString, L"%s:", pwMiscSectorStrings[ 4 ] );
+9 -6
View File
@@ -53,10 +53,13 @@ void AddFacilitiesToBox( INT16 sMapX, INT16 sMapY, UINT32 *uiHandle, BOOLEAN fCi
{
if (fCityInfoBox && uiNumFacilities == 0 && !fHeaderAdded )
{
// For a city info box, always show this line on the left side.
swprintf( szFacilityString, L"%s:", pwTownInfoStrings[ 8 ] );
AddMonoString( uiHandle, szFacilityString );
fHeaderAdded = TRUE;
// For a city info box, always show this line on the left side if not hidden
if( gfHiddenTown[ GetTownIdForSector( sMapX, sMapY ) ] )
{
swprintf( szFacilityString, L"%s:", pwTownInfoStrings[ 8 ] );
AddMonoString( uiHandle, szFacilityString );
fHeaderAdded = TRUE;
}
}
// Facility type exists at this location?
if (gFacilityLocations[SECTOR(sMapX,sMapY)][cnt].fFacilityHere)
@@ -82,9 +85,9 @@ void AddFacilitiesToBox( INT16 sMapX, INT16 sMapY, UINT32 *uiHandle, BOOLEAN fCi
}
}
if( uiNumFacilities == 0 && fCityInfoBox )
if( uiNumFacilities == 0 && fCityInfoBox && gfHiddenTown[ GetTownIdForSector( sMapX, sMapY ) ])
{
// Add "NONE" on the right side. Only happens when the sector is a city.
// Add "NONE" on the right side. Only happens when the sector is a non-hidden city.
AddSecondColumnMonoString( uiHandle, sFacilitiesStrings[0] );
return;
}