Added memory leak detection to "new" operator

Prevent merc in slot 0 from disappearing due to errant schedule.  Still need to find and fix schedule though
Prevent attempts to turn or climb roof when soldier collapsed
Fix problems when mortar or RPG randomly assigned to a soldier but cannot be added for whatever reason
Pathing favors beginning path on orthogonal and using as few turns as possible (mostly old behavior).
Prevent interruptions when soldier climbs up, which can cause fall into building just below the target roof position
Fix pauses due to soldiers hurt in previous turn
Fix soldier path not reaching destination when thrown by explosion damage or heavy gunfire
Restore pathing to cave and underground exits
Fix too many AI ending up on the roofs


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1588 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-11-09 09:10:40 +00:00
parent 51539605f5
commit 11c4d9648e
19 changed files with 197 additions and 102 deletions
+37 -20
View File
@@ -978,33 +978,50 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena
return;
// special mortar shell handling
if (bGrenadeClass == MORTAR_GRENADE_CLASS && itemMortar > 0 )
if (bGrenadeClass == MORTAR_GRENADE_CLASS)
{
usItem = PickARandomLaunchable ( itemMortar );
if ( usItem > 0 )
// 0verhaul: itemMortar can be 0 if the previous function
// 1) failed to find a Mortar that the soldier would want to use (due to XML prefs)
// 2) randomly chose not to supply a Mortar (always possible, even if choices exist).
// Since we should not go beyond this point in the case where Mortar Rounds are desired,
// return here in any case
if (itemMortar > 0 )
{
CreateItems( usItem, (INT8) (80 + Random(21)), bGrenades, &Object );
Object.fFlags |= OBJECT_UNDROPPABLE;
PlaceObjectInSoldierCreateStruct( pp, &Object );
return;
}
}
// special rpg rocket handling
if (bGrenadeClass == RPG_GRENADE_CLASS && itemRPG > 0 )
{
usItem = PickARandomLaunchable ( itemRPG );
if ( usItem > 0 )
{
for ( int i = 0; i < bGrenades; i++ )
usItem = PickARandomLaunchable ( itemMortar );
if ( usItem > 0 )
{
CreateItem( usItem, (INT8) (70 + Random(31)), &Object );
CreateItems( usItem, (INT8) (80 + Random(21)), bGrenades, &Object );
Object.fFlags |= OBJECT_UNDROPPABLE;
PlaceObjectInSoldierCreateStruct( pp, &Object );
}
return;
}
return;
}
// special rpg rocket handling
if (bGrenadeClass == RPG_GRENADE_CLASS)
{
// 0verhaul: itemRPG can be 0 if the previous function
// 1) failed to find an RPG that the soldier would want to use (due to XML prefs)
// 2) randomly chose not to supply an RPG (always possible, even if choices exist).
// Since we should not go beyond this point in the case where RPG grenades are desired,
// return here in any case
if (itemRPG > 0 )
{
usItem = PickARandomLaunchable ( itemRPG );
if ( usItem > 0 )
{
for ( int i = 0; i < bGrenades; i++ )
{
CreateItem( usItem, (INT8) (70 + Random(31)), &Object );
Object.fFlags |= OBJECT_UNDROPPABLE;
PlaceObjectInSoldierCreateStruct( pp, &Object );
}
}
}
return;
}
Assert( bGrenadeClass <= 11 );