fixed some crashes when loading 4xx built savegames. The game can continue, but You'll probably loose your vehicles. The Team in the Laptop/Personel also consist only of Your AVATAR, but in strategic map the team is complete.

This is not a very well finished fix. Only glued some NULL assigned pointers. I recomend to NOT load too old savegames.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@733 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sergeant_Kolja
2007-02-23 20:59:37 +00:00
parent a9059e3570
commit e40b062672
2 changed files with 18 additions and 1 deletions
+6
View File
@@ -3595,6 +3595,12 @@ BOOLEAN LoadStrategicAI( HWFILE hFile )
}
if( ubSAIVersion < 19 )
{
if( !gGarrisonGroup ) /* Sergeant Kolja, 2007-02-20: loading an older Qicksave, I crashed with NULL gGarrisonGroup[] */
{
gGarrisonGroup = (GARRISON_GROUP*)MemAlloc( sizeof( gOrigGarrisonGroup ) );
Assert( gGarrisonGroup );
memcpy( gGarrisonGroup, gOrigGarrisonGroup, sizeof( gOrigGarrisonGroup ) );
}
//Clear the garrison in C5
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_C5 ].ubGarrisonID ].ubComposition ].bPriority = 0;
gArmyComp[ gGarrisonGroup[ SectorInfo[ SEC_C5 ].ubGarrisonID ].ubComposition ].bDesiredPopulation = 0;
+12 -1
View File
@@ -1890,7 +1890,18 @@ PathStPtr GetSoldierMercPathPtr( SOLDIERTYPE *pSoldier )
// IS a vehicle?
else if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
{
pMercPath = pVehicleList[ pSoldier->bVehicleID ].pMercPath;
/* Sergeant_Kolja, 2007-02-20: got an pVehicleList==NULL Exception on loading an older save here... not REALY fixed! */
if( !pVehicleList ) /*bcause we have no vehicle list at all, we act as we are a person*/
{
pSoldier->uiStatusFlags &= ~SOLDIER_VEHICLE;
pMercPath = pSoldier->pMercPath;
/* after all, create an empty Vehicle list */
pVehicleList = (VEHICLETYPE *) MemAlloc( sizeof( VEHICLETYPE ) );
memset( pVehicleList, 0, sizeof( VEHICLETYPE ) );
pVehicleList->fValid = 0;
}
else
pMercPath = pVehicleList[ pSoldier->bVehicleID ].pMercPath;
}
else // a person
{