Lua parser: script_init.lua for zones will now follow script_init_v[0-9]+\.lua similar to player quests.

This commit is contained in:
KimLS 2014-11-22 03:20:39 -08:00
parent d49426f763
commit 1ca397f426

View File

@ -857,7 +857,9 @@ void LuaParser::ReloadQuests() {
if(zone) {
std::string zone_script = "quests/";
zone_script += zone->GetShortName();
zone_script += "/script_init.lua";
zone_script += "/script_init_v";
zone_script += std::to_string(zone->GetInstanceVersion());
zone_script += ".lua";
f = fopen(zone_script.c_str(), "r");
if(f) {
fclose(f);
@ -866,6 +868,21 @@ void LuaParser::ReloadQuests() {
std::string error = lua_tostring(L, -1);
AddError(error);
}
return;
}
zone_script = "quests/";
zone_script += zone->GetShortName();
zone_script += "/script_init.lua";
f = fopen(zone_script.c_str(), "r");
if(f) {
fclose(f);
if(luaL_dofile(L, zone_script.c_str())) {
std::string error = lua_tostring(L, -1);
AddError(error);
}
}
}
}