Work has begun to enable strategic movement for other teams than just player and enemy.

- I've changed the GROUP struct - instead of BOOLEAN fPlayer we now have UINT8 usGroupTeam.
- To further simplify the code, I've replaced 
UINT8 NumEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); 
with 
UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam );

In the next days, more strategic functions will be simplified, merged and replaced.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7707 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-01-06 00:50:25 +00:00
parent 57f6e41d47
commit c8eda14e2b
23 changed files with 353 additions and 299 deletions
+4 -4
View File
@@ -235,7 +235,7 @@ GROUP* GetEnemyGroupInSector( INT16 sMapX, INT16 sMapY )
curr = gpGroupList;
while( curr )
{
if( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && !curr->fPlayer && curr->ubGroupID )
if ( curr->ubSectorX == sMapX && curr->ubSectorY == sMapY && curr->usGroupTeam != OUR_TEAM && curr->ubGroupID )
return curr;
curr = curr->next;
}
@@ -284,7 +284,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY )
{
ubIndex = Random(ubDirNumber);
if( NumEnemiesInSector( SECTORX( pusMoveDir[ ubIndex ][ 0 ] ), SECTORY( pusMoveDir[ ubIndex ][ 0 ] ) ) > gubReinforcementMinEnemyStaticGroupSize )
if ( NumNonPlayerTeamMembersInSector( SECTORX( pusMoveDir[ubIndex][0] ), SECTORY( pusMoveDir[ubIndex][0] ), ENEMY_TEAM ) > gubReinforcementMinEnemyStaticGroupSize )
{
pSector = &SectorInfo[ pusMoveDir[ ubIndex ][ 0 ] ];
@@ -412,10 +412,10 @@ void AddPossiblePendingMilitiaToBattle()
}
// if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY )
// || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return;
// || !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) ) return;
if( (PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) == 0)
|| !(gTacticalStatus.uiFlags & WANT_MILITIA_REINFORCEMENTS)
|| (NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) == 0)
|| (NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) == 0)
)
return;
//gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY );