mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Headrock found a bug in the CTH calculation with regards to autofire penalties.
Think I've fixed a glich where mercs who were already in a sector (but not active) could not be placed on the tactical placement screen (either because of an assertion error or simply being told the placement wasn't valid). git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2385 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1040,7 +1040,7 @@ BOOLEAN LoadMapEdgepoints( INT8 **hBuffer )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode )
|
||||
UINT16 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode )
|
||||
{
|
||||
INT16 *psArray=NULL;
|
||||
UINT16 usArraySize=0;
|
||||
@@ -1048,7 +1048,9 @@ UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode )
|
||||
|
||||
//First validate and get access to the correct array based on strategic direction.
|
||||
//We will use the selected array to choose insertion gridno's.
|
||||
switch( ubStrategicInsertionCode )
|
||||
if( *ubStrategicInsertionCode == INSERTION_CODE_GRIDNO)
|
||||
*ubStrategicInsertionCode = lastValidICode;
|
||||
switch( *ubStrategicInsertionCode )
|
||||
{
|
||||
case INSERTION_CODE_NORTH:
|
||||
psArray = gps1stNorthEdgepointArray;
|
||||
@@ -1251,7 +1253,7 @@ void EndMapEdgepointSearch()
|
||||
|
||||
|
||||
//THIS CODE ISN'T RECOMMENDED FOR TIME CRITICAL AREAS.
|
||||
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode )
|
||||
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode, UINT8 *storedICode )
|
||||
{
|
||||
INT32 i, iDirectionLoop;
|
||||
INT16 *psArray=NULL;
|
||||
@@ -1263,6 +1265,8 @@ INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode
|
||||
{ //Everything is reserved.
|
||||
AssertMsg( 0, "All closest map edgepoints have been reserved. We should only have 20 soldiers maximum...");
|
||||
}
|
||||
if( ubInsertionCode == INSERTION_CODE_GRIDNO )
|
||||
*storedICode = ubInsertionCode = defaultICode;
|
||||
switch( ubInsertionCode )
|
||||
{
|
||||
case INSERTION_CODE_NORTH:
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "Fileman.h"
|
||||
#include "strategic.h"
|
||||
|
||||
typedef struct MAPEDGEPOINTINFO
|
||||
{
|
||||
@@ -11,7 +12,7 @@ typedef struct MAPEDGEPOINTINFO
|
||||
INT16 sGridNo[ 32 ];
|
||||
}MAPEDGEPOINTINFO;
|
||||
|
||||
UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode );
|
||||
UINT16 ChooseMapEdgepoint( UINT8 *ubStrategicInsertionCode, UINT8 lastValidICode );
|
||||
void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategicInsertionCode, UINT8 ubNumDesiredPoints );
|
||||
void GenerateMapEdgepoints();
|
||||
void SaveMapEdgepoints( HWFILE fp );
|
||||
@@ -62,7 +63,7 @@ extern UINT16 gus2ndWestEdgepointMiddleIndex;
|
||||
//code shouldn't be used for enemies or anybody else.
|
||||
void BeginMapEdgepointSearch();
|
||||
void EndMapEdgepointSearch();
|
||||
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
|
||||
INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode, UINT8 defaultICode = INSERTION_CODE_GRIDNO, UINT8 *storedICode = NULL );
|
||||
INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
|
||||
|
||||
//There are two classes of edgepoints.
|
||||
|
||||
@@ -907,14 +907,16 @@ void KillTacticalPlacementGUI()
|
||||
void ChooseRandomEdgepoints()
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 lastValidICode = INSERTION_CODE_GRIDNO;
|
||||
for( i = 0; i < giPlacements; i++ )
|
||||
{
|
||||
if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
|
||||
{
|
||||
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( gMercPlacement[ i ].ubStrategicInsertionCode );
|
||||
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( &gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode );
|
||||
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData != NOWHERE )
|
||||
{
|
||||
gMercPlacement[ i ].pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
||||
lastValidICode = gMercPlacement[ i ].ubStrategicInsertionCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1109,6 +1111,7 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
|
||||
INT32 i;
|
||||
INT16 sGridNo;
|
||||
BOOLEAN fInvalidArea = FALSE;
|
||||
UINT8 lastValidICode = INSERTION_CODE_GRIDNO;
|
||||
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{ //if we have a selected merc, move him to the new closest map edgepoint of his side.
|
||||
if( gfValidCursor )
|
||||
@@ -1127,12 +1130,14 @@ void HandleTacticalPlacementClicksInOverheadMap( MOUSE_REGION *reg, INT32 reason
|
||||
//the problem. If everything's okay, we will place them all.
|
||||
if( gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID )
|
||||
{
|
||||
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode );
|
||||
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = SearchForClosestPrimaryMapEdgepoint( sGridNo, gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode, &gMercPlacement[ i ].ubStrategicInsertionCode );
|
||||
if( gMercPlacement[ i ].pSoldier->usStrategicInsertionData == NOWHERE )
|
||||
{
|
||||
fInvalidArea = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
lastValidICode = gMercPlacement[ i ].ubStrategicInsertionCode;
|
||||
}
|
||||
}
|
||||
if( !fInvalidArea )
|
||||
|
||||
Reference in New Issue
Block a user