Fixed appearance of save game corruption when a game with different inventory set is loaded. Note that such games can still cause odd behavior and CTD's

Fixed old-style behavior when creating a soldier struct (caused memory corruption and leaks)
Fixed soldiers unable to fire if an error happened while firing the off-hand weapon
Fix animation system problems with soldiers interrupted while changing stance, such as twitching and not being able to navigate around obstacles
Prevent splitting money while an item is in the hand, which would result in losing the original item
Fix reverse of X,Y when checking visibility through a roof, which could make soldiers falsely visible/invisible
Prevent militia from simply waiting on the border when enemies are known to be in the sector
Fix stack overflow for soldier inventory debug display
Optimized A* pathing and cleaned up VS2K5 specific code
AI can now use all climb points for climbable buildings, not just a random few
Fix to not allow flat roof butted against slanted roof to be identified as a climb point
Prevent soldiers who cause an interrupt from a special action from continuing on their path after being interrupted
Prevent soldiers who enter or leave deep water from moving a space too far and turning back
Prevent soldiers from trying to crouch while in shallow water
Make soldier turn in the closest direction when he must get up from prone and turn then fall back to prone
Allow a soldier to swat for a tile before returning to prone if unable to return to prone immediately after a turn
Fix civilians that should show up in a sector, missing because of others that aren't
Fix a memset on a C++ class
Place Skyrider in a sector near his helecopter once available and the helicopter is present
Fix soldier corruption if too many shots burst-spread into too few tiles
Include both first and last tile in spread when some locations must be skipped
Fix to shoot at last location in burst
Fix to remove other previous spread locations when calculating a new spread
Fix to reload or rechamber off-hand when necessary, such as having a pistol shotgun in that hand


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1532 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-10-20 08:09:03 +00:00
parent eeb82168b5
commit dd0d6ea66d
35 changed files with 1322 additions and 863 deletions
+29 -8
View File
@@ -2378,6 +2378,26 @@ void SwapObjs( OBJECTTYPE * pObj1, OBJECTTYPE * pObj2 )
*/
}
//ADB these 2 functions were created because the code calls SwapObjs all over the place
//but never handles the effects of that swap!
void SwapObjs(SOLDIERTYPE* pSoldier, int leftSlot, int rightSlot)
{
PERFORMANCE_MARKER
SwapObjs(&pSoldier->inv[ leftSlot ], &pSoldier->inv[ rightSlot ]);
//old usItem for the left slot is now stored in the right slot, and vice versa
HandleTacticalEffectsOfEquipmentChange(pSoldier, leftSlot, pSoldier->inv[ rightSlot ].usItem, pSoldier->inv[ leftSlot ].usItem);
HandleTacticalEffectsOfEquipmentChange(pSoldier, rightSlot, pSoldier->inv[ leftSlot ].usItem, pSoldier->inv[ rightSlot ].usItem);
}
void SwapObjs(SOLDIERTYPE* pSoldier, int slot, OBJECTTYPE* pObject)
{
PERFORMANCE_MARKER
SwapObjs(&pSoldier->inv[ slot ], pObject);
HandleTacticalEffectsOfEquipmentChange(pSoldier, slot, pObject->usItem, pSoldier->inv[ slot ].usItem);
}
void RemoveObjFrom( OBJECTTYPE * pObj, UINT8 ubRemoveIndex )
{
// remove 1 object from an OBJECTTYPE, starting at index bRemoveIndex
@@ -3922,7 +3942,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj )
if (pSoldier->inv[SECONDHANDPOS].usItem != 0)
{
// swap what WAS in the second hand into the cursor
SwapObjs( pObj, &(pSoldier->inv[SECONDHANDPOS]));
SwapObjs( pSoldier, SECONDHANDPOS, pObj);
}
}
}
@@ -3932,7 +3952,8 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj )
{
// replacement/reloading/merging/stacking
// keys have an additional check for key ID being the same
if ( (pObj->usItem == pInSlot->usItem) && ( Item[ pObj->usItem ].usItemClass != IC_KEY || pObj->ItemData.Key.ubKeyID == pInSlot->ItemData.Key.ubKeyID ) )
if ( (pObj->usItem == pInSlot->usItem) &&
( Item[ pObj->usItem ].usItemClass != IC_KEY || pObj->ItemData.Key.ubKeyID == pInSlot->ItemData.Key.ubKeyID ) )
{
if (Item[ pObj->usItem ].usItemClass == IC_MONEY)
{
@@ -3967,7 +3988,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj )
if (pObj->ubNumberOfObjects <= 1)
{
// swapping
SwapObjs( pObj, pInSlot );
SwapObjs( pSoldier, bPos, pObj );
}
else
{
@@ -4031,13 +4052,13 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj )
}
else
{
SwapObjs( pObj, pInSlot );
SwapObjs( pSoldier, bPos, pObj );
}
}
else if (pObj->ubNumberOfObjects <= __max( ubSlotLimit, 1 ) )
{
// swapping
SwapObjs( pObj, pInSlot );
SwapObjs( pSoldier, bPos, pObj );
}
else
{
@@ -5647,7 +5668,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier )
if (pSoldier->inv[HANDPOS].usItem == NOTHING || pSoldier->inv[SECONDHANDPOS].usItem == NOTHING)
{
// whatever is in the second hand can be swapped to the main hand!
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[SECONDHANDPOS]) );
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
}
else
@@ -5662,7 +5683,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier )
}
// the main hand is now empty so a swap is going to work...
}
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[SECONDHANDPOS]) );
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
}
}
@@ -5679,7 +5700,7 @@ void SwapOutHandItem( SOLDIERTYPE * pSoldier )
if (pSoldier->inv[SECONDHANDPOS].usItem == NOTHING)
{
// just swap the hand item to the second hand
SwapObjs( &(pSoldier->inv[HANDPOS]), &(pSoldier->inv[SECONDHANDPOS]) );
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS );
DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 );
return;
}