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
+12 -12
View File
@@ -917,8 +917,8 @@ BOOLEAN CanCharacterRepairButDoesntHaveARepairkit( SOLDIERTYPE *pSoldier )
// check that character is alive, oklife, has repair skill, and equipment, etc.
BOOLEAN CanCharacterRepair( SOLDIERTYPE *pSoldier )
{
INT8 bPocket = 0;
BOOLEAN fToolKitFound = FALSE;
//INT8 bPocket = 0;
//BOOLEAN fToolKitFound = FALSE;
if ( !BasicCanCharacterAssignment( pSoldier, TRUE ) )
{
@@ -1565,8 +1565,8 @@ BOOLEAN CanCharacterPractise( SOLDIERTYPE *pSoldier )
BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
{
INT32 cnt = 0;
SOLDIERTYPE *pTeamSoldier = NULL;
//INT32 cnt = 0;
//SOLDIERTYPE *pTeamSoldier = NULL;
// can character train at all
if( CanCharacterPractise( pSoldier ) == FALSE )
@@ -1588,7 +1588,7 @@ BOOLEAN CanCharacterTrainTeammates( SOLDIERTYPE *pSoldier )
BOOLEAN CanCharacterBeTrainedByOther( SOLDIERTYPE *pSoldier )
{
INT32 iCounter = 0;
//INT32 iCounter = 0;
// can character train at all
if( CanCharacterPractise( pSoldier ) == FALSE )
@@ -2047,8 +2047,8 @@ UINT8 FindNumberInSectorWithAssignment( INT16 sX, INT16 sY, INT8 bAssignment )
{
// run thought list of characters find number with this assignment
SOLDIERTYPE *pSoldier, *pTeamSoldier;
INT32 cnt=0;
INT32 iCounter=0;
INT32 cnt=0;
//INT32 iCounter=0;
INT8 bNumberOfPeople = 0;
// set psoldier as first in merc ptrs
@@ -2137,11 +2137,11 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
}
// calculate effective doctoring rate (adjusted for drugs, alcohol, etc.)
usHealPts = ( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor;
usHealPts = (UINT16) (( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
// calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
// and equipment was not a hindrance
*pusMaxPts = ( pDoctor -> bMedical * (( pDoctor -> bDexterity + pDoctor -> bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor;
*pusMaxPts = (UINT16) (( pDoctor -> bMedical * (( pDoctor -> bDexterity + pDoctor -> bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
// adjust for fatigue
ReducePointsForFatigue( pDoctor, &usHealPts );
@@ -2196,11 +2196,11 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
}
// calculate effective repair rate (adjusted for drugs, alcohol, etc.)
usRepairPts = (EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay );
usRepairPts = (UINT16) ((EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
// calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
// and equipment was not a hindrance
*pusMaxPts = ( pSoldier -> bMechanical * pSoldier -> bDexterity * (100 + ( 5 * pSoldier->bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay );
*pusMaxPts = (UINT16) (( pSoldier -> bMechanical * pSoldier -> bDexterity * (100 + ( 5 * pSoldier->bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
// adjust for fatigue
@@ -2275,7 +2275,7 @@ void HandleDoctorsInSector( INT16 sX, INT16 sY, INT8 bZ )
{
SOLDIERTYPE *pSoldier, *pTeamSoldier;
INT32 cnt=0;
INT32 iCounter=0;
//INT32 iCounter=0;
// set psoldier as first in merc ptrs
pSoldier = MercPtrs[0];