- 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(); AddSectorToBox();
// town size // town size
if( gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{
swprintf( wString, L"%s:", pwTownInfoStrings[ 0 ] ); swprintf( wString, L"%s:", pwTownInfoStrings[ 0 ] );
AddMonoString( &hStringHandle, wString ); AddMonoString( &hStringHandle, wString );
swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) ); swprintf( wString, L"%d", GetTownSectorSize( ubTownId ) );
AddSecondColumnMonoString( &hStringHandle, wString ); AddSecondColumnMonoString( &hStringHandle, wString );
}
// main facilities // main facilities
// HEADROCK HAM 3.6: This function now does all the work of assembling a facility entry. // HEADROCK HAM 3.6: This function now does all the work of assembling a facility entry.
AddFacilitiesToBox( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &hStringHandle, TRUE ); AddFacilitiesToBox( bCurrentTownMineSectorX, bCurrentTownMineSectorY, &hStringHandle, TRUE );
// the concept of control is only meaningful in sectors where militia can be trained // 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 // town control
swprintf( wString, L"%s:", pwTownInfoStrings[ 2 ] ); 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 // 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 // town loyalty
swprintf( wString, L"%s:", pwTownInfoStrings[ 5 ] ); swprintf( wString, L"%s:", pwTownInfoStrings[ 5 ] );
@@ -424,7 +429,7 @@ void AddTextToTownBox( void )
// if the town has a mine // if the town has a mine
sMineSector = GetMineSectorForTown( ubTownId ); sMineSector = GetMineSectorForTown( ubTownId );
if( sMineSector != -1 ) if( sMineSector != -1 && gfHiddenTown[ GetTownIdForSector( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) ] )
{ {
// Associated Mine: Sector // Associated Mine: Sector
swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] ); swprintf( wString, L"%s:", pwTownInfoStrings[ 4 ] );
@@ -696,34 +701,62 @@ void AddCommonInfoToBox(void)
{ {
CHAR16 wString[ 64 ]; CHAR16 wString[ 64 ];
UINT32 hStringHandle = 0; UINT32 hStringHandle = 0;
BOOLEAN fUnknownSAMSite = FALSE; BOOLEAN fHiddenSite = FALSE;
UINT8 ubMilitiaTotal = 0; UINT8 ubMilitiaTotal = 0;
UINT8 ubNumEnemies; 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 ) ) switch( SECTOR( bCurrentTownMineSectorX, bCurrentTownMineSectorY ) )
{ {
case SEC_D2: //Chitzena SAM case SEC_D2: //Chitzena SAM
if( !fSamSiteFound[ SAM_SITE_ONE ] ) if( !fSamSiteFound[ SAM_SITE_ONE ] )
fUnknownSAMSite = TRUE; fHiddenSite = TRUE;
break; break;
case SEC_D15: //Drassen SAM case SEC_D15: //Drassen SAM
if( !fSamSiteFound[ SAM_SITE_TWO ] ) if( !fSamSiteFound[ SAM_SITE_TWO ] )
fUnknownSAMSite = TRUE; fHiddenSite = TRUE;
break; break;
case SEC_I8: //Cambria SAM case SEC_I8: //Cambria SAM
if( !fSamSiteFound[ SAM_SITE_THREE ] ) if( !fSamSiteFound[ SAM_SITE_THREE ] )
fUnknownSAMSite = TRUE; fHiddenSite = TRUE;
break; break;
// SAM Site 4 in Meduna is within town limits, so it's always controllable // SAM Site 4 in Meduna is within town limits, so it's always controllable
default: default:
break; break;
} }
*/
// in sector where militia can be trained, // in sector where militia can be trained,
// control of the sector matters, display who controls this sector. Map brightness no longer gives this! // 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: // controlled:
swprintf( wString, L"%s:", pwMiscSectorStrings[ 4 ] ); 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 ) if (fCityInfoBox && uiNumFacilities == 0 && !fHeaderAdded )
{ {
// For a city info box, always show this line on the left side. // For a city info box, always show this line on the left side if not hidden
swprintf( szFacilityString, L"%s:", pwTownInfoStrings[ 8 ] ); if( gfHiddenTown[ GetTownIdForSector( sMapX, sMapY ) ] )
AddMonoString( uiHandle, szFacilityString ); {
fHeaderAdded = TRUE; swprintf( szFacilityString, L"%s:", pwTownInfoStrings[ 8 ] );
AddMonoString( uiHandle, szFacilityString );
fHeaderAdded = TRUE;
}
} }
// Facility type exists at this location? // Facility type exists at this location?
if (gFacilityLocations[SECTOR(sMapX,sMapY)][cnt].fFacilityHere) 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] ); AddSecondColumnMonoString( uiHandle, sFacilitiesStrings[0] );
return; return;
} }