Skip to content
This repository was archived by the owner on Mar 30, 2019. It is now read-only.

Commit 50f9acb

Browse files
author
philipp.dallig
committed
großer svn merge
1 parent 4376d0e commit 50f9acb

File tree

201 files changed

+5377
-8597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+5377
-8597
lines changed

ScriptMgr.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,31 @@
1212
#include "../system/ScriptLoader.h"
1313
#include "../system/system.h"
1414
#include "../../../game/ScriptMgr.h"
15+
#include "World.h"
1516

1617
typedef std::vector<Script*> SDScriptVec;
1718
int num_sc_scripts;
1819
SDScriptVec m_scripts;
1920

2021
Config SD2Config;
2122

23+
/**********************************************************************
24+
+additions for windows compiler
25+
**********************************************************************/
26+
template<> bool MaNGOS::Singleton<World>::si_destroyed;
27+
template<> bool MaNGOS::Singleton<ObjectMgr>::si_destroyed;
28+
template<> World *MaNGOS::Singleton<World>::si_instance;
29+
World::World()
30+
{
31+
}
32+
World::~World()
33+
{
34+
}
35+
ObjectMgr::~ObjectMgr()
36+
{
37+
}
38+
/***********************************************************************/
39+
2240
QueryResult* strSD2Pquery(char* str)
2341
{
2442
return SD2Database.Query(str);
@@ -253,6 +271,9 @@ char const* GetScriptLibraryVersion()
253271
MANGOS_DLL_EXPORT
254272
bool GossipHello(Player* pPlayer, Creature* pCreature)
255273
{
274+
if (!pCreature)
275+
return false;
276+
256277
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
257278

258279
if (!tmpscript || !tmpscript->pGossipHello)
@@ -266,6 +287,9 @@ bool GossipHello(Player* pPlayer, Creature* pCreature)
266287
MANGOS_DLL_EXPORT
267288
bool GOGossipHello(Player *pPlayer, GameObject *pGo)
268289
{
290+
if (!pGo)
291+
return false;
292+
269293
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
270294

271295
if (!tmpscript || !tmpscript->pGossipHelloGO)
@@ -281,6 +305,9 @@ bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32
281305
{
282306
debug_log("SD2: Gossip selection, sender: %u, action: %u", uiSender, uiAction);
283307

308+
if (!pCreature)
309+
return false;
310+
284311
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
285312

286313
if (!tmpscript || !tmpscript->pGossipSelect)
@@ -298,6 +325,9 @@ bool GOGossipSelect(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 acti
298325
{
299326
debug_log("SD2: GO Gossip selection, sender: %u, action: %u", sender, action);
300327

328+
if (!pGo)
329+
return false;
330+
301331
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
302332

303333
if (!tmpscript || !tmpscript->pGossipSelectGO)
@@ -313,6 +343,9 @@ bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender,
313343
{
314344
debug_log("SD2: Gossip selection with code, sender: %u, action: %u", uiSender, uiAction);
315345

346+
if (!pCreature)
347+
return false;
348+
316349
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
317350

318351
if (!tmpscript || !tmpscript->pGossipSelectWithCode)
@@ -328,6 +361,9 @@ bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uin
328361
{
329362
debug_log("SD2: GO Gossip selection with code, sender: %u, action: %u", sender, action);
330363

364+
if (!pGo)
365+
return false;
366+
331367
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
332368

333369
if (!tmpscript || !tmpscript->pGossipSelectGOWithCode)
@@ -341,6 +377,9 @@ bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uin
341377
MANGOS_DLL_EXPORT
342378
bool QuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
343379
{
380+
if (!pCreature)
381+
return false;
382+
344383
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
345384

346385
if (!tmpscript || !tmpscript->pQuestAcceptNPC)
@@ -354,6 +393,9 @@ bool QuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
354393
MANGOS_DLL_EXPORT
355394
bool QuestRewarded(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
356395
{
396+
if (!pCreature)
397+
return false;
398+
357399
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
358400

359401
if (!tmpscript || !tmpscript->pQuestRewardedNPC)
@@ -380,6 +422,9 @@ uint32 GetNPCDialogStatus(Player* pPlayer, Creature* pCreature)
380422
MANGOS_DLL_EXPORT
381423
uint32 GetGODialogStatus(Player* pPlayer, GameObject* pGo)
382424
{
425+
if (!pGo)
426+
return false;
427+
383428
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
384429

385430
if (!tmpscript || !tmpscript->pDialogStatusGO)
@@ -393,6 +438,9 @@ uint32 GetGODialogStatus(Player* pPlayer, GameObject* pGo)
393438
MANGOS_DLL_EXPORT
394439
bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
395440
{
441+
if (!pItem)
442+
return false;
443+
396444
Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];
397445

398446
if (!tmpscript || !tmpscript->pQuestAcceptItem)
@@ -406,6 +454,9 @@ bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
406454
MANGOS_DLL_EXPORT
407455
bool GOUse(Player* pPlayer, GameObject* pGo)
408456
{
457+
if (!pGo)
458+
return false;
459+
409460
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
410461

411462
if (!tmpscript || !tmpscript->pGOUse)
@@ -417,6 +468,9 @@ bool GOUse(Player* pPlayer, GameObject* pGo)
417468
MANGOS_DLL_EXPORT
418469
bool GOQuestAccept(Player* pPlayer, GameObject* pGo, const Quest* pQuest)
419470
{
471+
if (!pGo)
472+
return false;
473+
420474
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
421475

422476
if (!tmpscript || !tmpscript->pQuestAcceptGO)
@@ -430,6 +484,9 @@ bool GOQuestAccept(Player* pPlayer, GameObject* pGo, const Quest* pQuest)
430484
MANGOS_DLL_EXPORT
431485
bool GOQuestRewarded(Player* pPlayer, GameObject* pGo, Quest const* pQuest)
432486
{
487+
if (!pGo)
488+
return false;
489+
433490
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
434491

435492
if (!tmpscript || !tmpscript->pQuestRewardedGO)
@@ -466,6 +523,9 @@ bool ProcessEvent(uint32 uiEventId, Object* pSource, Object* pTarget, bool bIsSt
466523
MANGOS_DLL_EXPORT
467524
CreatureAI* GetCreatureAI(Creature* pCreature)
468525
{
526+
if (!pCreature)
527+
return false;
528+
469529
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
470530

471531
if (!tmpscript || !tmpscript->GetAI)
@@ -477,6 +537,9 @@ CreatureAI* GetCreatureAI(Creature* pCreature)
477537
MANGOS_DLL_EXPORT
478538
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
479539
{
540+
if (!pItem)
541+
return false;
542+
480543
Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];
481544

482545
if (!tmpscript || !tmpscript->pItemUse)
@@ -488,6 +551,9 @@ bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
488551
MANGOS_DLL_EXPORT
489552
bool EffectDummyCreature(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget)
490553
{
554+
if (!pTarget)
555+
return false;
556+
491557
Script *tmpscript = m_scripts[pTarget->GetScriptId()];
492558

493559
if (!tmpscript || !tmpscript->pEffectDummyNPC)
@@ -499,6 +565,9 @@ bool EffectDummyCreature(Unit* pCaster, uint32 spellId, SpellEffectIndex effInde
499565
MANGOS_DLL_EXPORT
500566
bool EffectDummyGameObject(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget)
501567
{
568+
if (!pTarget)
569+
return false;
570+
502571
Script *tmpscript = m_scripts[pTarget->GetGOInfo()->ScriptId];
503572

504573
if (!tmpscript || !tmpscript->pEffectDummyGO)
@@ -510,6 +579,9 @@ bool EffectDummyGameObject(Unit* pCaster, uint32 spellId, SpellEffectIndex effIn
510579
MANGOS_DLL_EXPORT
511580
bool EffectDummyItem(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget)
512581
{
582+
if (!pTarget)
583+
return false;
584+
513585
Script *tmpscript = m_scripts[pTarget->GetProto()->ScriptId];
514586

515587
if (!tmpscript || !tmpscript->pEffectDummyItem)

ScriptMgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ QueryResult* strSD2Pquery(char*);
118118

119119
// Not registered scripts storage
120120
Script* GetScriptByName(std::string scriptName);
121+
121122
// *********************************************************
122123
// **************** Internal hook mechanics ****************
123124

0 commit comments

Comments
 (0)