Merge from master

This commit is contained in:
KimLS
2013-05-06 00:05:50 -07:00
216 changed files with 4167 additions and 4142 deletions
+31 -24
View File
@@ -100,7 +100,7 @@ extern Zone* zone;
PerlembParser::PerlembParser(void) : Parser()
{
perl = NULL;
perl = nullptr;
eventQueueProcessing = false;
globalPlayerQuestLoaded = pQuestReadyToLoad;
globalNPCQuestLoaded = nQuestReadyToLoad;
@@ -229,7 +229,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
EventRecord e;
e.event = event;
e.objid = objid;
if(data != NULL)
if(data != nullptr)
e.data = data;
e.npcmob = npcmob;
e.iteminst = iteminst;
@@ -340,9 +340,9 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
if(npcmob && npcmob->GetQglobal())
{
map<string, string> globhash;
QGlobalCache *npc_c = NULL;
QGlobalCache *char_c = NULL;
QGlobalCache *zone_c = NULL;
QGlobalCache *npc_c = nullptr;
QGlobalCache *char_c = nullptr;
QGlobalCache *zone_c = nullptr;
//retrieve our globals
npc_c = npcmob->GetQGlobals();
@@ -401,8 +401,8 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
else
{
map<string, string> globhash;
QGlobalCache *char_c = NULL;
QGlobalCache *zone_c = NULL;
QGlobalCache *char_c = nullptr;
QGlobalCache *zone_c = nullptr;
//retrieve our globals
if(mob && mob->IsClient())
@@ -532,7 +532,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
for(int slot=HASITEM_FIRST; slot<=HASITEM_LAST;slot++)
{
char *hi_decl=NULL;
char *hi_decl=nullptr;
int itemid=mob->CastToClient()->GetItemIDAt(slot);
if(!HASITEM_ISNULLITEM(itemid))
{
@@ -550,7 +550,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
if(mob && mob->IsClient()) {
string hashname = packagename + std::string("::oncursor");
perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
char *hi_decl = NULL;
char *hi_decl = nullptr;
int itemid = mob->CastToClient()->GetItemIDAt(30);
if(!HASITEM_ISNULLITEM(itemid)) {
MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);",hashname.c_str(),itemid,30);
@@ -789,7 +789,7 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
if(isPlayerQuest || isGlobalPlayerQuest){
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, NULL);
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr);
}
else if(isItemQuest) {
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, iteminst);
@@ -797,13 +797,13 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
else if(isSpellQuest)
{
if(mob) {
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, NULL);
SendCommands(packagename.c_str(), sub_name, 0, mob, mob, nullptr);
} else {
SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, NULL);
SendCommands(packagename.c_str(), sub_name, 0, npcmob, mob, nullptr);
}
}
else {
SendCommands(packagename.c_str(), sub_name, objid, npcmob, mob, NULL);
SendCommands(packagename.c_str(), sub_name, objid, npcmob, mob, nullptr);
}
//now handle any events that cropped up...
@@ -811,27 +811,27 @@ void PerlembParser::EventCommon(QuestEventID event, uint32 objid, const char * d
}
void PerlembParser::EventGlobalNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, NULL, init, extra_data, true);
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data, true);
}
void PerlembParser::EventNPC(QuestEventID evt, NPC* npc, Mob *init, std::string data, uint32 extra_data) {
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, NULL, init, extra_data);
EventCommon(evt, npc->GetNPCTypeID(), data.c_str(), npc, nullptr, init, extra_data);
}
void PerlembParser::EventPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
EventCommon(evt, 0, data.c_str(), NULL, NULL, client, extra_data);
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data);
}
void PerlembParser::EventGlobalPlayer(QuestEventID evt, Client *client, std::string data, uint32 extra_data) {
EventCommon(evt, 0, data.c_str(), NULL, NULL, client, extra_data, true);
EventCommon(evt, 0, data.c_str(), nullptr, nullptr, client, extra_data, true);
}
void PerlembParser::EventItem(QuestEventID evt, Client *client, ItemInst *item, uint32 objid, uint32 extra_data) {
EventCommon(evt, objid, NULL, NULL, item, client, extra_data);
EventCommon(evt, objid, nullptr, nullptr, item, client, extra_data);
}
void PerlembParser::EventSpell(QuestEventID evt, NPC* npc, Client *client, uint32 spell_id, uint32 extra_data) {
EventCommon(evt, 0, itoa(spell_id), npc, NULL, client, extra_data);
EventCommon(evt, 0, itoa(spell_id), npc, nullptr, client, extra_data);
}
void PerlembParser::ReloadQuests(bool with_timers) {
@@ -845,21 +845,28 @@ void PerlembParser::ReloadQuests(bool with_timers) {
command_clear_perl();
try {
if(perl == NULL)
if(perl == nullptr)
perl = new Embperl;
else
perl->Reinit();
map_funs();
}
catch(std::exception &e) {
if(perl != NULL) {
if(perl != nullptr) {
delete perl;
perl = NULL;
perl = nullptr;
}
LogFile->write(EQEMuLog::Status, "Error re-initializing perlembed: %s", e.what());
throw e.what();
}
//try {
// LoadScript(0, nullptr);
//}
//catch(const char * err) {
// LogFile->write(EQEMuLog::Status, "Error loading default script: %s", err);
//}
hasQuests.clear();
playerQuestLoaded.clear();
globalPlayerQuestLoaded = pQuestReadyToLoad;
@@ -1501,7 +1508,7 @@ void PerlembParser::SendCommands(const char * pkgprefix, const char *event, uint
if(mob && mob->IsClient())
quest_manager.StartQuest(other, mob->CastToClient());
else
quest_manager.StartQuest(other, NULL);
quest_manager.StartQuest(other, nullptr);
try
{
@@ -1538,7 +1545,7 @@ void PerlembParser::SendCommands(const char * pkgprefix, const char *event, uint
void PerlembParser::ExecCommand(Client *c, Seperator *sep) {
#ifdef EMBPERL_XS_CLASSES
SV *client = get_sv("commands::client", true);
if(c != NULL) {
if(c != nullptr) {
sv_setref_pv(client, "Client", c);
} else {
//clear out the value, mainly to get rid of blessedness