Fixed: Change way to load lua zone files when are in a bnp

--HG--
branch : ark
hg/ark
Ulu Kyn 5 years ago
parent a4d2f80579
commit e3dc99e078

@ -113,7 +113,7 @@ extern CContinentManager ContinentMngr;
extern CEntityManager EntitiesMngr; extern CEntityManager EntitiesMngr;
//----------------------------------------------- //-----------------------------------------------
// CUserLandMark // CUserLandMark
//----------------------------------------------- //-----------------------------------------------
NLMISC::CRGBA CUserLandMark::getColor () const NLMISC::CRGBA CUserLandMark::getColor () const
@ -742,20 +742,28 @@ void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress
for (uint i = 0; i < zonesAdded.size(); i++) for (uint i = 0; i < zonesAdded.size(); i++)
{ {
CSString luaScript;
string luaScriptName = CPath::lookup(zonesAdded[i]+".lua", false); string luaScriptName = CPath::lookup(zonesAdded[i]+".lua", false);
if (!luaScriptName.empty()) if (!luaScriptName.empty())
{ {
luaScript.readFromFile(luaScriptName); CIFile in;
CLuaManager::getInstance().executeLuaScript(luaScript, true); if (in.open(luaScriptName))
nlinfo("loading %s", luaScriptName.c_str()); {
string luaScript;
if (in.readAll(luaScript))
{
CLuaManager::getInstance().executeLuaScript(luaScript, true);
nlinfo("loading %s", luaScriptName.c_str());
}
}
} }
else else
{ {
nlinfo("file not found %s", luaScriptName.c_str()); nlinfo("file not found %s", luaScriptName.c_str());
} }
} }
LandscapeIGManager.unloadArrayZoneIG(zonesRemoved); LandscapeIGManager.unloadArrayZoneIG(zonesRemoved);
LandscapeIGManager.loadArrayZoneIG(zonesAdded, &igAdded); LandscapeIGManager.loadArrayZoneIG(zonesAdded, &igAdded);
} }

Loading…
Cancel
Save