l_SetMercProfiles: allow serting zero values for sSectorX and sSectorY.

Added more restriction for using grenades in CalcBestThrow:
- blinded soldier can only attack recently seen/heard opponents
- limit explosives type when attacking zombies
- limit smoke grenade use
- limit explosives type when attacking robots, vehicles and tanks
- don't use grenades against dying enemies
- limit explosives type when attacking collapsed enemies
- don't use flare if soldier is in light
- don't use flares against opponents on roof

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8736 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-01-20 18:01:18 +00:00
parent 26a1b0aa5a
commit 77f5a7770d
2 changed files with 92 additions and 8 deletions
+6 -6
View File
@@ -2338,9 +2338,9 @@ static int l_SetMercProfiles(lua_State *L)
{
MERCPROFILESTRUCT * pProfile;
UINT8 idNPC;
UINT16 x = 0;
UINT16 y = 0;
UINT8 z = 255;
UINT16 x = -1;
UINT16 y = -1;
UINT8 z = -1;
UINT32 Orders = -1;
UINT16 usEyesX = -1;
UINT16 usEyesY = -1;
@@ -2375,13 +2375,13 @@ static int l_SetMercProfiles(lua_State *L)
sSalary = lh_getIntegerFromTable(L, "Salary");
ubBodyType = lh_getIntegerFromTable(L, "BodyType");
if (x >= 1 && x <= 16)
if (x != -1 && x >= 0 && x <= 16)
pProfile->sSectorX = x;
if (y >= 1 && y <= 16)
if (y != -1 && y >= 0 && y <= 16)
pProfile->sSectorY = y;
if (z <= 3)
if (z != -1 && z <= 3)
pProfile->bSectorZ = z;
if (usEyesX != -1)