mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Lua code improvements.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8727 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+76
-78
@@ -2336,87 +2336,85 @@ static int l_WhoIsThere2 (lua_State *L)
|
|||||||
//set merc
|
//set merc
|
||||||
static int l_SetMercProfiles(lua_State *L)
|
static int l_SetMercProfiles(lua_State *L)
|
||||||
{
|
{
|
||||||
MERCPROFILESTRUCT * pProfile;
|
MERCPROFILESTRUCT * pProfile;
|
||||||
UINT8 idNPC = -1;
|
UINT8 idNPC;
|
||||||
UINT16 x = -1;
|
UINT16 x = 0;
|
||||||
UINT16 y = -1;
|
UINT16 y = 0;
|
||||||
UINT8 z = -1;
|
UINT8 z = 255;
|
||||||
UINT32 Orders = -1;
|
UINT32 Orders = -1;
|
||||||
UINT16 usEyesX = -1;
|
UINT16 usEyesX = -1;
|
||||||
UINT16 usEyesY = -1;
|
UINT16 usEyesY = -1;
|
||||||
UINT16 usMouthX = -1;
|
UINT16 usMouthX = -1;
|
||||||
UINT16 usMouthY = -1;
|
UINT16 usMouthY = -1;
|
||||||
UINT32 uiEyeDelay = -1;
|
UINT32 uiEyeDelay = -1;
|
||||||
UINT32 uiMouthDelay = -1;
|
UINT32 uiMouthDelay = -1;
|
||||||
UINT32 uiWeeklySalary = -1;
|
UINT32 uiWeeklySalary = -1;
|
||||||
UINT32 uiBiWeeklySalary = -1;
|
UINT32 uiBiWeeklySalary = -1;
|
||||||
INT16 sSalary = -1;
|
INT16 sSalary = -1;
|
||||||
UINT8 ubBodyType = -1;
|
UINT8 ubBodyType = -1;
|
||||||
|
|
||||||
idNPC = lh_getIntegerFromTable(L, "IDProfile");
|
idNPC = lh_getIntegerFromTable(L, "IDProfile");
|
||||||
|
|
||||||
if ( idNPC > -1 )
|
if (idNPC < NUM_PROFILES)
|
||||||
{
|
{
|
||||||
pProfile = &(gMercProfiles[ idNPC ]);
|
pProfile = &(gMercProfiles[idNPC]);
|
||||||
|
|
||||||
x = lh_getIntegerFromTable(L, "SectorX");
|
|
||||||
y = lh_getIntegerFromTable(L, "SectorY");
|
|
||||||
z = lh_getIntegerFromTable(L, "SectorZ");
|
|
||||||
|
|
||||||
usEyesX = lh_getIntegerFromTable(L, "EyesX");
|
|
||||||
usEyesY = lh_getIntegerFromTable(L, "EyesY");
|
|
||||||
usMouthX = lh_getIntegerFromTable(L, "MouthX");
|
|
||||||
usMouthY = lh_getIntegerFromTable(L, "MouthY");
|
|
||||||
uiEyeDelay = lh_getIntegerFromTable(L, "EyeDelay");
|
|
||||||
uiMouthDelay = lh_getIntegerFromTable(L, "MouthDelay");
|
|
||||||
|
|
||||||
uiWeeklySalary = lh_getIntegerFromTable(L, "WeeklySalary");
|
|
||||||
uiBiWeeklySalary = lh_getIntegerFromTable(L, "BiWeeklySalary");
|
|
||||||
sSalary = lh_getIntegerFromTable(L, "Salary");
|
|
||||||
ubBodyType = lh_getIntegerFromTable(L, "BodyType");
|
|
||||||
|
|
||||||
|
x = lh_getIntegerFromTable(L, "SectorX");
|
||||||
if ((x != -1 )&& (x >= 1 || x <= 16) )
|
y = lh_getIntegerFromTable(L, "SectorY");
|
||||||
pProfile->sSectorX = x;
|
z = lh_getIntegerFromTable(L, "SectorZ");
|
||||||
|
|
||||||
if((y != -1) && (y >= 1 || y <= 16) )
|
usEyesX = lh_getIntegerFromTable(L, "EyesX");
|
||||||
pProfile->sSectorY = y;
|
usEyesY = lh_getIntegerFromTable(L, "EyesY");
|
||||||
|
usMouthX = lh_getIntegerFromTable(L, "MouthX");
|
||||||
if ((z != -1) && (z >= 0 || z <= 3) )
|
usMouthY = lh_getIntegerFromTable(L, "MouthY");
|
||||||
pProfile->bSectorZ = z;
|
uiEyeDelay = lh_getIntegerFromTable(L, "EyeDelay");
|
||||||
|
uiMouthDelay = lh_getIntegerFromTable(L, "MouthDelay");
|
||||||
if ( usEyesX != -1 )
|
|
||||||
pProfile->usEyesX = usEyesX;
|
uiWeeklySalary = lh_getIntegerFromTable(L, "WeeklySalary");
|
||||||
|
uiBiWeeklySalary = lh_getIntegerFromTable(L, "BiWeeklySalary");
|
||||||
if ( usEyesY != -1 )
|
sSalary = lh_getIntegerFromTable(L, "Salary");
|
||||||
pProfile->usEyesY = usEyesY;
|
ubBodyType = lh_getIntegerFromTable(L, "BodyType");
|
||||||
|
|
||||||
if ( usMouthX != -1 )
|
if (x >= 1 && x <= 16)
|
||||||
pProfile->usMouthX = usMouthX;
|
pProfile->sSectorX = x;
|
||||||
|
|
||||||
if ( usMouthY != -1 )
|
if (y >= 1 && y <= 16)
|
||||||
pProfile->usMouthY = usMouthY;
|
pProfile->sSectorY = y;
|
||||||
|
|
||||||
if ( uiEyeDelay != -1 )
|
if (z <= 3)
|
||||||
pProfile->uiEyeDelay = uiEyeDelay;
|
pProfile->bSectorZ = z;
|
||||||
|
|
||||||
if ( uiMouthDelay != -1 )
|
if (usEyesX != -1)
|
||||||
pProfile->uiMouthDelay = uiMouthDelay;
|
pProfile->usEyesX = usEyesX;
|
||||||
|
|
||||||
if ( uiWeeklySalary != -1 )
|
if (usEyesY != -1)
|
||||||
pProfile->uiWeeklySalary = uiWeeklySalary;
|
pProfile->usEyesY = usEyesY;
|
||||||
|
|
||||||
if ( uiBiWeeklySalary != -1 )
|
if (usMouthX != -1)
|
||||||
pProfile->uiBiWeeklySalary = uiBiWeeklySalary;
|
pProfile->usMouthX = usMouthX;
|
||||||
|
|
||||||
if ( sSalary != -1 )
|
if (usMouthY != -1)
|
||||||
pProfile->sSalary = sSalary;
|
pProfile->usMouthY = usMouthY;
|
||||||
|
|
||||||
|
if (uiEyeDelay != -1)
|
||||||
|
pProfile->uiEyeDelay = uiEyeDelay;
|
||||||
|
|
||||||
|
if (uiMouthDelay != -1)
|
||||||
|
pProfile->uiMouthDelay = uiMouthDelay;
|
||||||
|
|
||||||
|
if (uiWeeklySalary != -1)
|
||||||
|
pProfile->uiWeeklySalary = uiWeeklySalary;
|
||||||
|
|
||||||
|
if (uiBiWeeklySalary != -1)
|
||||||
|
pProfile->uiBiWeeklySalary = uiBiWeeklySalary;
|
||||||
|
|
||||||
|
if (sSalary != -1)
|
||||||
|
pProfile->sSalary = sSalary;
|
||||||
|
|
||||||
|
if (ubBodyType != -1)
|
||||||
|
pProfile->ubBodyType = ubBodyType;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ubBodyType != -1 )
|
|
||||||
pProfile->ubBodyType = ubBodyType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -6351,7 +6349,7 @@ static int l_ActivateSwitchInGridNo(lua_State *L)
|
|||||||
UINT8 ubID = lua_tointeger(L, 1);
|
UINT8 ubID = lua_tointeger(L, 1);
|
||||||
INT32 sGridNo = lua_tointeger(L, 2);
|
INT32 sGridNo = lua_tointeger(L, 2);
|
||||||
|
|
||||||
if (!TileIsOutOfBounds(sGridNo) > 0 && ubID < TOTAL_SOLDIERS)
|
if (!TileIsOutOfBounds(sGridNo) && ubID < TOTAL_SOLDIERS)
|
||||||
ActivateSwitchInGridNo(ubID, sGridNo);
|
ActivateSwitchInGridNo(ubID, sGridNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user