From f65bc9d6498820b74448289810f61192b6b2393d Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 10 Sep 2013 13:35:22 +0000 Subject: [PATCH] - Bugfix: The mapped LUA function "SectorEnemyControlled" (mapped to l_fEnemyControlled) retrieved the wrong sector from the StrategicMap array o This fixes the bug, that the creature cutscene was never triggered (because of wrong sector infos) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6385 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/LuaInitNPCs.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index b56e7bed..8b791719 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -5808,22 +5808,21 @@ return 1; static int l_TacticalStatusTeamActive(lua_State *L) { -BOOLEAN Bool; + BOOLEAN Bool; if ( lua_gettop(L) >= 1 ) { UINT8 team = lua_tointeger(L,1); - if (gTacticalStatus.Team[team].bTeamActive ) - Bool = TRUE; - else - Bool = FALSE; + if (gTacticalStatus.Team[team].bTeamActive ) + Bool = TRUE; + else + Bool = FALSE; - lua_pushboolean(L, Bool); - + lua_pushboolean(L, Bool); } -return 1; + return 1; } static int l_usStrategicInsertionDataProfileID(lua_State *L) @@ -7498,8 +7497,10 @@ static int l_fEnemyControlled (lua_State *L) { UINT16 id = lua_tointeger(L,1); - BOOLEAN Bool = StrategicMap[ id ].fEnemyControlled; - + // WANNE: Bugfix: We have to get the sector from StrategicMap array by using the SECTOR_INFO_TO_STRATEGIC_INDEX(sectorID) function!!! + //BOOLEAN Bool = StrategicMap[ id ].fEnemyControlled; + BOOLEAN Bool = StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX(id)].fEnemyControlled; + lua_pushboolean(L, Bool); }