- New command: On [Alt] + [N], all team members in the sector try to put on gas masks

- Fix: gasmask status was not always evaluated correctly

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8315 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-10-14 21:07:49 +00:00
parent a0c2b0a39a
commit 68294910b8
7 changed files with 45 additions and 69 deletions
+6 -22
View File
@@ -9250,30 +9250,14 @@ static int l_GetMercPtrsGroup (lua_State *L)
}
static int l_WearGasMaskIfAvailable(lua_State *L)
{
UINT8 n = lua_gettop(L);
int i = 0;
UINT8 ubID = 0;
BOOLEAN Bool = FALSE;
SOLDIERTYPE * pSoldier;
{
if ( lua_gettop( L ) >= 1 )
{
UINT8 ubID = lua_tointeger( L, 1 );
for (i= 1; i<=n; i++ )
{
if (i == 1 ) ubID = lua_tointeger(L,i);
}
if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive)
Bool = TRUE;
else
Bool = FALSE;
if ( Bool == TRUE )
{
pSoldier = MercPtrs[ ubID ];
if (pSoldier)
if ( MercPtrs[ubID] && MercPtrs[ubID]->bInSector && MercPtrs[ubID]->bActive )
{
WearGasMaskIfAvailable(pSoldier);
WearGasMaskIfAvailable( MercPtrs[ubID] );
}
}