src/game/Strategic/Strategic_Town_Loyalty.cc
void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSectorY )
{
	// the whole town is under our control, check if we never libed this town before
	if ( !gTownLoyalty[ bTownId ].fLiberatedAlready && IsTownUnderCompleteControlByPlayer ( bTownId ) )
	{
		if ( MilitiaTrainingAllowedInSector( sSectorX, sSectorY, 0 ) )
		{
			// give a loyalty bonus
			HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_LIBERATE_WHOLE_TOWN, sSectorX, sSectorY, 0 );

			// set fact is has been lib'ed and set history event
			AddHistoryToPlayersLog( HISTORY_LIBERATED_TOWN, bTownId, GetWorldTotalMin(), sSectorX, sSectorY );

			HandleMeanWhileEventPostingForTownLiberation( bTownId );
		}

		// even taking over non-trainable "towns" like Orta/Tixa for the first time should count as "player activity"
		if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
		{
			UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 4 ) );
		}
		else
		{
			UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 2 ) );
		}

		// set flag even for towns where you can't train militia, useful for knowing Orta/Tixa were previously controlled
		gTownLoyalty[ bTownId ].fLiberatedAlready = TRUE;
	}
}
// to be called whenever player gains control of a sector in any way
to be called whenever player gains control of a sector in any way
to be called whenever player gains control of a sector in any way
void CheckIfEntireTownHasBeenLiberated( INT8 bTownId, INT16 sSectorX, INT16 sSectorY )
{
	if ( !gTownLoyalty[ bTownId ].fLiberatedAlready && IsTownUnderCompleteControlByPlayer ( bTownId ) )
	{
		if ( MilitiaTrainingAllowedInSector( sSectorX, sSectorY, 0 ) )
		{
			HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_LIBERATE_WHOLE_TOWN, sSectorX, sSectorY, 0 );
			AddHistoryToPlayersLog( HISTORY_LIBERATED_TOWN, bTownId, GetWorldTotalMin(), sSectorX, sSectorY );
			HandleMeanWhileEventPostingForTownLiberation( bTownId );
		}
		if ( gGameOptions.ubDifficultyLevel >= DIF_LEVEL_HARD )
		{
			UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 4 ) );
		}
		else
		{
			UpdateLastDayOfPlayerActivity( ( UINT16 ) ( GetWorldDay() + 2 ) );
		}
		gTownLoyalty[ bTownId ].fLiberatedAlready = TRUE;
	}
}
void CheckIfEntireTownHasBeenLiberated ( INT8 bTownId , INT16 sSectorX , INT16 sSectorY ) { if ( ! gTownLoyalty [ bTownId ] . fLiberatedAlready && IsTownUnderCompleteControlByPlayer ( bTownId ) ) { if ( MilitiaTrainingAllowedInSector ( sSectorX , sSectorY , 0 ) ) { HandleGlobalLoyaltyEvent ( GLOBAL_LOYALTY_LIBERATE_WHOLE_TOWN , sSectorX , sSectorY , 0 ) ; AddHistoryToPlayersLog ( HISTORY_LIBERATED_TOWN , bTownId , GetWorldTotalMin ( ) , sSectorX , sSectorY ) ; HandleMeanWhileEventPostingForTownLiberation ( bTownId ) ; } if ( gGameOptions . ubDifficultyLevel >= DIF_LEVEL_HARD ) { UpdateLastDayOfPlayerActivity ( ( UINT16 ) ( GetWorldDay ( ) + 4 ) ) ; } else { UpdateLastDayOfPlayerActivity ( ( UINT16 ) ( GetWorldDay ( ) + 2 ) ) ; } gTownLoyalty [ bTownId ] . fLiberatedAlready = TRUE ; } }
to be called whenever player gains control of a sector in any way
to be called whenever player gains control of a sector in any way
// the whole town is under our control, check if we never libed this town before // give a loyalty bonus // set fact is has been lib'ed and set history event // even taking over non-trainable "towns" like Orta/Tixa for the first time should count as "player activity" // set flag even for towns where you can't train militia, useful for knowing Orta/Tixa were previously controlled