- new function: militia can be ordered to pick up gear from sector in tactical, just like ordering them to drop it. does not work in combat for obvious reason.

- if militia stand in water and are ordered to drop their equipment, they will drop it on land.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6263 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-07-31 18:59:32 +00:00
parent 64f7d6e616
commit 71274fdf55
14 changed files with 152 additions and 61 deletions
+45 -3
View File
@@ -109,6 +109,7 @@
#include "Militia Control.h"
#include "Lua Interpreter.h"
#include "bullets.h"
#include "Inventory Choosing.h" // added by Flugente for TakeMilitiaEquipmentfromSector()
#endif
#include "connect.h"
@@ -10131,13 +10132,12 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce)
// not if this team is hostile to us
if ( gTacticalStatus.Team[ gbPlayerNum ].bSide != gTacticalStatus.Team[ bTeam ].bSide )
return;
SOLDIERTYPE *pSoldier;
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Team %d drops all items for inspection!", bTeam );
#endif
SOLDIERTYPE *pSoldier;
UINT32 uiCnt = 0;
UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID;
UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID;
@@ -10151,6 +10151,48 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce)
}
}
void TeamRestock(UINT8 bTeam)
{
if ( bTeam > PLAYER_PLAN )
return;
// not if there is a battle going on
if ( (gTacticalStatus.uiFlags & INCOMBAT ) )
return;
// not if this team is hostile to us
if ( gTacticalStatus.Team[ gbPlayerNum ].bSide != gTacticalStatus.Team[ bTeam ].bSide )
return;
#ifdef JA2BETAVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Team %d restocks gear from sector inventory!", bTeam );
#endif
SOLDIERTYPE *pSoldier;
UINT32 uiCnt = 0;
UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID;
UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID;
for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier)
{
if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) )
{
// the function fills a createstruct, so create one
SOLDIERCREATE_STRUCT createstruct;
// we first have to copy over all our currently equipped items, otherwise we might overwrite them later
createstruct.Inv = pSoldier->inv;
TakeMilitiaEquipmentfromSector(pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, &createstruct, pSoldier->ubSoldierClass);
// replace our inventory with the new one
pSoldier->inv = createstruct.Inv;
// we took new gear, so we can drop it again
pSoldier->bSoldierFlagMask &= ~SOLDIER_EQUIPMENT_DROPPED;
}
}
}
// are we allowed to steal access this guy's inventory?
BOOLEAN AllowedToStealFromTeamMate( UINT8 ubID, UINT8 ubTargetID )
{