Fixed buffer overrun for LUA strings

Made direction variables more consistent as unsigned chars.  Several function prototypes updated for this.
Many memory leaks plugged:  External options, video overlays, laptop file lists, tactical message queue, strategic pathing, autobandage, merc hiring, detailed placements, crate in Drassen, tactical placement
New functions and attributes for soldiers in LUA (still for debugging at best): Soldier.APs (current APs), Soldier.changestance (changes stance, uses game heights)
File catalog ignores .SVN directories (game load speedup)
Fix CTD in mouse regions
JA2 window now refuses to move to negative coords
Checks to prevent DirectX-related infinite loops due to minimizing and task switching
Invading enemies should now appear on the borders even when reinforcements disabled in .ini
Suppression should no longer work on mercs in medium water
Infant/Young creatures use restored spit instead of Molotov
Creatures begin with their 'guns' (spit) 'locked and loaded' (cartridge in chamber)
Further fix to AXP and AlaarDB's weapon ready check:  Now 'firing' is always counted as 'ready'.
Prevent mercs from falling and flying back through obstacles
Check whether battle group is even set before testing its location for battle setup
Burst spread locations now limited to 6, the limit within the soldier struct
Extra burst spread locations zeroed out so that they aren't used unless necessary
Spread code now only shoots at locations in the spread, and will shoot at all 6
Only mercs in the sector where autobandage happens will be made to stand up after it's done
Throwing a grenade at the tail of the plane in Drassen should not result in a CTD
Reset attack busy count when loading a new sector


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1347 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-09-11 11:19:03 +00:00
parent 63a7b27b29
commit ffc70e9723
81 changed files with 972 additions and 679 deletions
+6 -6
View File
@@ -391,7 +391,7 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier )
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
// back towards that facing 50% of the time here (normally just enemies)
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
(pSoldier->bDirection != pSoldier->bDominantDir) && PreRandom(2))
(pSoldier->ubDirection != pSoldier->bDominantDir) && PreRandom(2))
{
pSoldier->usActionData = pSoldier->bDominantDir;
}
@@ -399,7 +399,7 @@ INT8 CreatureDecideActionGreen( SOLDIERTYPE * pSoldier )
{
pSoldier->usActionData = (UINT16)PreRandom(8);
}
} while (pSoldier->usActionData == pSoldier->bDirection);
} while (pSoldier->usActionData == pSoldier->ubDirection);
#ifdef DEBUGDECISIONS
STR16 tempstr;
@@ -479,7 +479,7 @@ INT8 CreatureDecideActionYellow( SOLDIERTYPE * pSoldier )
// if soldier is not already facing in that direction,
// and the noise source is close enough that it could possibly be seen
if ((GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) && (pSoldier->bDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= STRAIGHT)
if ((GetAPsToLook( pSoldier ) <= pSoldier->bActionPoints) && (pSoldier->ubDirection != ubNoiseDir) && PythSpacesAway(pSoldier->sGridNo,sNoiseGridNo) <= STRAIGHT)
{
// set base chance according to orders
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
@@ -850,7 +850,7 @@ INT8 CreatureDecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
// note, have to change this to use the level returned from ClosestKnownOpponent
sDistVisible = pSoldier->GetMaxDistanceVisible(sClosestOpponent, 0 );
if ((pSoldier->bDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
if ((pSoldier->ubDirection != ubOpponentDir) && (PythSpacesAway(pSoldier->sGridNo,sClosestOpponent) <= sDistVisible))
{
// set base chance according to orders
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
@@ -1405,7 +1405,7 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier )
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
// if we're not facing towards him
if (pSoldier->bDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) )
if (pSoldier->ubDirection != bDirection && ValidCreatureTurn( pSoldier, bDirection ) )
{
pSoldier->usActionData = bDirection;
@@ -1699,7 +1699,7 @@ INT8 CrowDecideActionGreen( SOLDIERTYPE * pSoldier )
// Change facing
sFacingDir = GetDirectionFromGridNo( sCorpseGridNo, pSoldier );
if ( sFacingDir != pSoldier->bDirection )
if ( sFacingDir != pSoldier->ubDirection )
{
pSoldier->usActionData = sFacingDir;
return(AI_ACTION_CHANGE_FACING);