From 58379b84cd53b6559460874846baba571f085a83 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 24 Jul 2021 19:16:12 +0000 Subject: [PATCH] Minor code improvements git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9147 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/LuaInitNPCs.cpp | 19 ++++++++----------- Tactical/LOS.cpp | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 1c9a1974..4be9820b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -3568,28 +3568,25 @@ int i; static int l_BoxerExists(lua_State *L) { -BOOLEAN Bool; - - Bool = BoxerExists( ); + BOOLEAN Bool = BoxerExists( ); lua_pushboolean(L, Bool); -return 1; + return 1; } static int l_gubBoxerID(lua_State *L) { UINT8 n = lua_gettop(L); - UINT8 val, val2; - for (int i = 1; i <= n; i++) + if ( n >= 2 ) { - if (i == 1) val = lua_tointeger(L, i); - if (i == 2) val2 = lua_tointeger(L, i); - } + UINT8 val = lua_tointeger( L, 1 ); + UINT8 val2 = lua_tointeger( L, 2 ); - if (val <= 2) - gubBoxerID[val] = val2; + if ( val <= 2 ) + gubBoxerID[val] = val2; + } return 0; } diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 5d4ba884..bdd02a97 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -6407,7 +6407,7 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT } else { - ubVolume = __max( 1, ( ubVolume * GetPercentNoiseVolume( pObj ) ) / 100 ); + ubVolume = __max( 1, ( ubVolume * noisefactor ) / 100 ); } MakeNoise( NOBODY, gridno, 0, pThrower ? pThrower->bOverTerrainType : FLAT_GROUND, ubVolume, NOISE_GUNFIRE );