Linux fixes

This commit is contained in:
Image 2020-03-22 17:07:49 -04:00
parent a7dfb31f39
commit 5dfafe4464
2 changed files with 6 additions and 6 deletions

View file

@ -420,31 +420,31 @@ Quest* LuaInterface::LoadQuest(int32 id, const char* name, const char* type, con
return quest;
}
char* LuaInterface::GetScriptName(lua_State* state)
const char* LuaInterface::GetScriptName(lua_State* state)
{
map<lua_State*, string>::iterator itr;
MItemScripts.writelock(__FUNCTION__, __LINE__);
itr = item_inverse_scripts.find(state);
if (itr != item_inverse_scripts.end())
return (char*)itr->second.c_str();
return itr->second.c_str();
MItemScripts.releasewritelock(__FUNCTION__, __LINE__);
MSpawnScripts.writelock(__FUNCTION__, __LINE__);
itr = spawn_inverse_scripts.find(state);
if (itr != spawn_inverse_scripts.end())
return (char*)itr->second.c_str();
return itr->second.c_str();
MSpawnScripts.releasewritelock(__FUNCTION__, __LINE__);
MZoneScripts.writelock(__FUNCTION__, __LINE__);
itr = zone_inverse_scripts.find(state);
if (itr != zone_inverse_scripts.end())
return (char*)itr->second.c_str();
return itr->second.c_str();
MZoneScripts.releasewritelock(__FUNCTION__, __LINE__);
MSpells.lock();
LuaSpell* spell = GetCurrentSpell(state);
if (spell)
return (spell->file_name.length() > 0) ? (char*)spell->file_name.c_str() : "";
return (spell->file_name.length() > 0) ? spell->file_name.c_str() : "";
MSpells.unlock();
return "";

View file

@ -213,7 +213,7 @@ public:
lua_State* GetZoneScript(const char* name, bool create_new = true, bool use = false);
Quest* LoadQuest(int32 id, const char* name, const char* type, const char* zone, int8 level, const char* description, char* script_name);
char* GetScriptName(lua_State* state);
const char* GetScriptName(lua_State* state);
void RemoveSpawnScript(const char* name);
bool RunItemScript(string script_name, const char* function_name, Item* item, Spawn* spawn = 0);