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
+11 -11
View File
@@ -448,7 +448,7 @@ BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
{
INT8 bMinPointsNeeded = 0;
INT8 bAPForStandUp = 0;
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier->sGridNo ) == pSoldier->bDirection ) ? 0 : 1;
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier->sGridNo ) == pSoldier->ubDirection ) ? 0 : 1;
//NumMessage("AffordableAction - Guy#",pSoldier->ubID);
@@ -583,7 +583,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
UINT32 uiLoop;
UINT16 usMaxDist;
UINT8 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID;
UINT16 usDirection;
UINT8 ubDirection;
UINT8 ubDirsLeft;
BOOLEAN fDirChecked[8];
BOOLEAN fRangeRestricted = FALSE, fFound = FALSE;
@@ -663,9 +663,9 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
// should be close enough, try to find a legal ->sDestination within 1 tile
// clear dirChecked flag for all 8 directions
for (usDirection = 0; usDirection < 8; usDirection++)
for (ubDirection = 0; ubDirection < 8; ubDirection++)
{
fDirChecked[usDirection] = FALSE;
fDirChecked[ubDirection] = FALSE;
}
ubDirsLeft = 8;
@@ -677,14 +677,14 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier)
// randomly select a direction which hasn't been 'checked' yet
do
{
usDirection = (UINT16) Random(8);
ubDirection = (UINT8) Random(8);
}
while (fDirChecked[usDirection]);
while (fDirChecked[ubDirection]);
fDirChecked[usDirection] = TRUE;
fDirChecked[ubDirection] = TRUE;
// determine the gridno 1 tile away from current friend in this direction
usDest = NewGridNo(Menptr[ubFriendID].sGridNo,DirectionInc((INT16)(usDirection + 1)));
usDest = NewGridNo(Menptr[ubFriendID].sGridNo,DirectionInc(ubDirection));
// if that's out of bounds, ignore it & check next direction
if (usDest == Menptr[ubFriendID].sGridNo)
@@ -2189,7 +2189,7 @@ INT32 CalcManThreatValue( SOLDIERTYPE *pEnemy, INT16 sMyGrid, UINT8 ubReduceForC
else
{
// ADD 5% if man's already facing me
if (pEnemy->bDirection == atan8(CenterX(pEnemy->sGridNo),CenterY(pEnemy->sGridNo),CenterX(sMyGrid),CenterY(sMyGrid)))
if (pEnemy->ubDirection == atan8(CenterX(pEnemy->sGridNo),CenterY(pEnemy->sGridNo),CenterX(sMyGrid),CenterY(sMyGrid)))
{
iThreatValue += (iThreatValue / 20);
}
@@ -2441,13 +2441,13 @@ BOOLEAN ValidCreatureTurn( SOLDIERTYPE * pCreature, INT8 bNewDirection )
INT8 bLoop;
BOOLEAN fFound;
bDirChange = (INT8) QuickestDirection( pCreature->bDirection, bNewDirection );
bDirChange = (INT8) QuickestDirection( pCreature->ubDirection, bNewDirection );
for( bLoop = 0; bLoop < 2; bLoop++ )
{
fFound = TRUE;
bTempDir = pCreature->bDirection;
bTempDir = pCreature->ubDirection;
do
{