mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Improvement of M.E.R.C availability (by silversurfer)
o Now you can change the MercAvailability.xml file during a game git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6286 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+28
-6
@@ -333,6 +333,7 @@ BOOLEAN AreAnyOfTheNewMercsAvailable();
|
|||||||
void ShouldAnyNewMercMercBecomeAvailable();
|
void ShouldAnyNewMercMercBecomeAvailable();
|
||||||
BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck );
|
BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck );
|
||||||
UINT32 CalcMercDaysServed();
|
UINT32 CalcMercDaysServed();
|
||||||
|
void RevaluateMercArray(); // silversurfer: for better savegame compatibility
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum );
|
void MarkSpeckImportantQuoteUsed( UINT32 uiQuoteNum );
|
||||||
BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum );
|
BOOLEAN HasImportantSpeckQuoteBeingSaid( UINT32 uiQuoteNum );
|
||||||
@@ -356,22 +357,43 @@ BOOLEAN SaveNewMercsToSaveGameFile( HWFILE hFile )
|
|||||||
BOOLEAN LoadNewMercsFromLoadGameFile( HWFILE hFile )
|
BOOLEAN LoadNewMercsFromLoadGameFile( HWFILE hFile )
|
||||||
{
|
{
|
||||||
UINT32 uiNumBytesRead;
|
UINT32 uiNumBytesRead;
|
||||||
|
CONTITION_FOR_MERC_AVAILABLE ConditionsForMercAvailabilityLoad[ NUM_PROFILES ];
|
||||||
|
|
||||||
FileRead( hFile, &gConditionsForMercAvailability, sizeof( gConditionsForMercAvailability ), &uiNumBytesRead );
|
FileRead( hFile, &ConditionsForMercAvailabilityLoad, sizeof( ConditionsForMercAvailabilityLoad ), &uiNumBytesRead );
|
||||||
if( uiNumBytesRead != sizeof( gConditionsForMercAvailability ) )
|
if( uiNumBytesRead != sizeof( ConditionsForMercAvailabilityLoad ) )
|
||||||
{
|
{
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure that gubMercArray (the list of mercs for M.E.R.C website) is populated with
|
// silversurfer: Now update the true gConditionsForMercAvailability array with the data from the savegame.
|
||||||
// the same mercs as gConditionsForMercAvailability that we just read from the savegame
|
// Take every index of gConditionsForMercAvailability array that we initialized in GameInitMercs() and see
|
||||||
|
// if we can find a matching profile ID in ConditionsForMercAvailabilityLoad array that we loaded from the savegame.
|
||||||
|
// This prevents some issues when old savegames are loaded with updated MercAvailability.xml.
|
||||||
|
for ( UINT8 i=0; i<NUM_PROFILES; i++)
|
||||||
|
{
|
||||||
|
if ( gConditionsForMercAvailability[i].ProfilId != 0 )
|
||||||
|
{
|
||||||
|
for ( UINT8 ilook=0; ilook<NUM_PROFILES; ilook++)
|
||||||
|
{
|
||||||
|
if ( ConditionsForMercAvailabilityLoad[ilook].ProfilId == gConditionsForMercAvailability[i].ProfilId )
|
||||||
|
{
|
||||||
|
// found a match! Now copy the data from the savegame to the gConditionsForMercAvailability array but ONLY relevant data!
|
||||||
|
gConditionsForMercAvailability[i].NewMercsAvailable = ConditionsForMercAvailabilityLoad[ilook].NewMercsAvailable;
|
||||||
|
gConditionsForMercAvailability[i].StartMercsAvailable = ConditionsForMercAvailabilityLoad[ilook].StartMercsAvailable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update list of mercs for M.E.R.C website
|
||||||
RevaluateMercArray();
|
RevaluateMercArray();
|
||||||
|
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// silversurfer: this function checks if gubMercArray contains the same list of mercs as gConditionsForMercAvailability
|
// silversurfer: this function updates the list of available mercs (gubMercArray) and makes sure that
|
||||||
// if not there will be problems with display of mercs on M.E.R.C website so we will force an update
|
// it matches the contents of gConditionsForMercAvailability array
|
||||||
void RevaluateMercArray()
|
void RevaluateMercArray()
|
||||||
{
|
{
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ enum
|
|||||||
|
|
||||||
|
|
||||||
BOOLEAN CanMercBeAvailableDuringInit( UINT8 ubMercToCheck );// anv: for all mercs available
|
BOOLEAN CanMercBeAvailableDuringInit( UINT8 ubMercToCheck );// anv: for all mercs available
|
||||||
void RevaluateMercArray(); // silversurfer: for somewhat better savegame compatibility
|
|
||||||
void GameInitMercs();
|
void GameInitMercs();
|
||||||
BOOLEAN EnterMercs();
|
BOOLEAN EnterMercs();
|
||||||
void ExitMercs();
|
void ExitMercs();
|
||||||
|
|||||||
Reference in New Issue
Block a user