If there is an error raised during pcal() then the old code is used, Moreover it will work fine wiht ALL the maps..
Well just my 2 cents , here is a piece of code with in bold lines i added, i have slightly edited cpuManager:HasThreatOnPath() to perform a 1st call to TerrainAnalyzer:HasThreatOnPath() if no error is raised then we return the result else we keep running the old code
function CpuManager:HasThreatOnPath(vPos1, vPos2, iRange)
dbAssert(vPos1 ~= nil)
dbAssert(vPos2 ~= nil)
dbAssert(iRange ~= nil)
-- Check if high speed AI setting is activated
if (CpuManager.AISettings.bHighSpeedAI == true) then
return false
end
function CheckThreat(pos1, pos2, range)
return cpu_manager.terrain_analyzer:HasThreatOnPath(pos1, pos2, range)
end
local noError, hasThreat = pcall(CheckThreat, vPos1, vPos2, iRange)
if noError then
return hasThreat
end
-- Calculate airline vector
local vAirline = Vector3f()
vAirline.x = vPos2.x - vPos1.x
vAirline.y = 0
vAirline.z = vPos2.z - vPos1.z
.......
Edited by troubadour, 08 April 2009 - 07:00 AM.