From 6f2af55cbabfb9cc6600a89440b84a79de4ed0cd Mon Sep 17 00:00:00 2001 From: ChrisL Date: Tue, 23 Sep 2008 23:14:49 +0000 Subject: [PATCH] Fixed assertion error caused when switching from strategic to tactical with a dead merc in the current team. Fixed a bug where hired RPCs would not get items stored in their gunsling or knife pockets. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2359 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/strategicmap.cpp | 10 ++++++++-- Tactical/Soldier Profile.cpp | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 137bd456..992440f3 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -1775,7 +1775,10 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) for (int i=0; ibActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); + //CHRISL: We should only bother with this assertion if the soldier is alive. Dead soliders are moved to + // GridNo = NOWHERE, which causes this assertion to fail + if(!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD)) + Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE ); } if( gubNumCreaturesAttackingTown && !gbWorldSectorZ && @@ -1814,7 +1817,10 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) for (int i=0; ibActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); + //CHRISL: We should only bother with this assertion if the soldier is alive. Dead soliders are moved to + // GridNo = NOWHERE, which causes this assertion to fail + if(!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD)) + Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE); } return( TRUE ); diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index f8bea8b7..f7a06ae9 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1016,7 +1016,10 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) { pNewSoldier->inv[cnt] = pSoldier->inv[cnt]; } - // Next, try to autoplace everything else + // Next, direct copy of the gunsling and knife pockets + pNewSoldier->inv[GUNSLINGPOCKPOS] = pSoldier->inv[GUNSLINGPOCKPOS]; + pNewSoldier->inv[KNIFEPOCKPOS] = pSoldier->inv[KNIFEPOCKPOS]; + // Then, try to autoplace everything else for(cnt = BIGPOCKSTART; cnt < pNewSoldier->inv.size(); cnt++ ) { if(pSoldier->inv[cnt].exists() == true)