Fix for msvc compile, lua_bit.cpp wont try to compile if lua isn't set to build

This commit is contained in:
KimLS 2013-06-26 08:05:36 -07:00
parent 1480b8911f
commit 602b17f0e8
4 changed files with 20 additions and 18 deletions

View File

@ -196,11 +196,11 @@ bool QuestParserCollection::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
std::string item_script;
if(itm->GetItem()->ScriptFileID != 0) {
item_script = "script_";
item_script += std::to_string(itm->GetItem()->ScriptFileID);
item_script += std::to_string(static_cast<long long>(itm->GetItem()->ScriptFileID));
} else if(strlen(itm->GetItem()->CharmFile) > 0) {
item_script = itm->GetItem()->CharmFile;
} else {
item_script = std::to_string(itm->GetID());
item_script = std::to_string(static_cast<long long>(itm->GetID()));
}
uint32 item_id = itm->GetID();
@ -342,11 +342,11 @@ int QuestParserCollection::EventItem(QuestEventID evt, Client *client, ItemInst
std::string item_script;
if(item->GetItem()->ScriptFileID != 0) {
item_script = "script_";
item_script += std::to_string(item->GetItem()->ScriptFileID);
item_script += std::to_string(static_cast<long long>(item->GetItem()->ScriptFileID));
} else if(strlen(item->GetItem()->CharmFile) > 0) {
item_script = item->GetItem()->CharmFile;
} else {
item_script = std::to_string(item->GetID());
item_script = std::to_string(static_cast<long long>(item->GetID()));
}
uint32 item_id = item->GetID();

View File

@ -26,6 +26,7 @@
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
*/
#ifdef LUA_EQEMU
#define LUA_BITOP_VERSION "1.0.2"
#include "lua.hpp"
@ -177,3 +178,4 @@ LUALIB_API int luaopen_bit(lua_State *L)
return 1;
}
#endif

View File

@ -109,7 +109,7 @@ void unregister_player_event(std::string name, int evt) {
void register_item_event(std::string name, int evt, int item_id, luabind::object func) {
std::string package_name = "item_";
package_name += std::to_string(item_id);
package_name += std::to_string(static_cast<long long>(item_id));
if(luabind::type(func) == LUA_TFUNCTION) {
register_event(package_name, name, evt, func);
@ -118,7 +118,7 @@ void register_item_event(std::string name, int evt, int item_id, luabind::object
void unregister_item_event(std::string name, int evt, int item_id) {
std::string package_name = "item_";
package_name += std::to_string(item_id);
package_name += std::to_string(static_cast<long long>(item_id));
unregister_event(package_name, name, evt);
}

View File

@ -226,7 +226,7 @@ int LuaParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data,
return 0;
}
std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID());
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc->GetNPCTypeID()));
return _EventNPC(package_name, evt, npc, init, data, extra_data, extra_pointers);
}
@ -416,7 +416,7 @@ int LuaParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, Mob *
}
std::string package_name = "item_";
package_name += std::to_string(item->GetID());
package_name += std::to_string(static_cast<long long>(item->GetID()));
return _EventItem(package_name, evt, client, item, mob, data, extra_data, extra_pointers);
}
@ -490,7 +490,7 @@ int LuaParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spe
return 0;
}
std::string package_name = "spell_" + std::to_string(spell_id);
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
if(!SpellHasQuestSub(spell_id, evt)) {
return 0;
@ -631,7 +631,7 @@ bool LuaParser::HasQuestSub(uint32 npc_id, QuestEventID evt) {
return false;
}
std::string package_name = "npc_" + std::to_string(npc_id);
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc_id));
const char *subname = LuaEvents[evt];
return HasFunction(subname, package_name);
@ -673,7 +673,7 @@ bool LuaParser::SpellHasQuestSub(uint32 spell_id, QuestEventID evt) {
return false;
}
std::string package_name = "spell_" + std::to_string(spell_id);
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
const char *subname = LuaEvents[evt];
return HasFunction(subname, package_name);
@ -686,7 +686,7 @@ bool LuaParser::ItemHasQuestSub(ItemInst *itm, QuestEventID evt) {
}
std::string package_name = "item_";
package_name += std::to_string(itm->GetID());
package_name += std::to_string(static_cast<long long>(itm->GetID()));
const char *subname = LuaEvents[evt];
return HasFunction(subname, package_name);
@ -705,7 +705,7 @@ bool LuaParser::EncounterHasQuestSub(std::string encounter_name, QuestEventID ev
}
void LuaParser::LoadNPCScript(std::string filename, int npc_id) {
std::string package_name = "npc_" + std::to_string(npc_id);
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc_id));
LoadScript(filename, package_name);
}
@ -724,13 +724,13 @@ void LuaParser::LoadGlobalPlayerScript(std::string filename) {
void LuaParser::LoadItemScript(std::string filename, ItemInst *item) {
std::string package_name = "item_";
package_name += std::to_string(item->GetID());
package_name += std::to_string(static_cast<long long>(item->GetID()));
LoadScript(filename, package_name);
}
void LuaParser::LoadSpellScript(std::string filename, uint32 spell_id) {
std::string package_name = "spell_" + std::to_string(spell_id);
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
LoadScript(filename, package_name);
}
@ -942,7 +942,7 @@ void LuaParser::DispatchEventNPC(QuestEventID evt, NPC* npc, Mob *init, std::str
if(!npc)
return;
std::string package_name = "npc_" + std::to_string(npc->GetNPCTypeID());
std::string package_name = "npc_" + std::to_string(static_cast<long long>(npc->GetNPCTypeID()));
auto iter = lua_encounter_events_registered.find(package_name);
if(iter != lua_encounter_events_registered.end()) {
@ -1006,7 +1006,7 @@ void LuaParser::DispatchEventItem(QuestEventID evt, Client *client, ItemInst *it
return;
std::string package_name = "item_";
package_name += std::to_string(item->GetID());
package_name += std::to_string(static_cast<long long>(item->GetID()));
auto iter = lua_encounter_events_registered.find(package_name);
if(iter != lua_encounter_events_registered.end()) {
@ -1042,7 +1042,7 @@ void LuaParser::DispatchEventSpell(QuestEventID evt, NPC* npc, Client *client, u
return;
}
std::string package_name = "spell_" + std::to_string(spell_id);
std::string package_name = "spell_" + std::to_string(static_cast<long long>(spell_id));
auto iter = lua_encounter_events_registered.find(package_name);
if(iter != lua_encounter_events_registered.end()) {