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

Commit 5bf5de4

Browse files
committed
[2140] Improve coding style in ScriptMgr
1 parent ed43c6f commit 5bf5de4

File tree

2 files changed

+76
-76
lines changed

2 files changed

+76
-76
lines changed

ScriptMgr.cpp

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -241,287 +241,287 @@ char const* GetScriptLibraryVersion()
241241
MANGOS_DLL_EXPORT
242242
bool GossipHello(Player* pPlayer, Creature* pCreature)
243243
{
244-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
244+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
245245

246-
if (!tmpscript || !tmpscript->pGossipHello)
246+
if (!pTempScript || !pTempScript->pGossipHello)
247247
return false;
248248

249249
pPlayer->PlayerTalkClass->ClearMenus();
250250

251-
return tmpscript->pGossipHello(pPlayer, pCreature);
251+
return pTempScript->pGossipHello(pPlayer, pCreature);
252252
}
253253

254254
MANGOS_DLL_EXPORT
255-
bool GOGossipHello(Player *pPlayer, GameObject *pGo)
255+
bool GOGossipHello(Player* pPlayer, GameObject* pGo)
256256
{
257-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
257+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
258258

259-
if (!tmpscript || !tmpscript->pGossipHelloGO)
259+
if (!pTempScript || !pTempScript->pGossipHelloGO)
260260
return false;
261261

262262
pPlayer->PlayerTalkClass->ClearMenus();
263263

264-
return tmpscript->pGossipHelloGO(pPlayer, pGo);
264+
return pTempScript->pGossipHelloGO(pPlayer, pGo);
265265
}
266266

267267
MANGOS_DLL_EXPORT
268268
bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
269269
{
270270
debug_log("SD2: Gossip selection, sender: %u, action: %u", uiSender, uiAction);
271271

272-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
272+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
273273

274-
if (!tmpscript || !tmpscript->pGossipSelect)
274+
if (!pTempScript || !pTempScript->pGossipSelect)
275275
return false;
276276

277277
pPlayer->PlayerTalkClass->ClearMenus();
278278

279-
return tmpscript->pGossipSelect(pPlayer, pCreature, uiSender, uiAction);
279+
return pTempScript->pGossipSelect(pPlayer, pCreature, uiSender, uiAction);
280280
}
281281

282282
MANGOS_DLL_EXPORT
283-
bool GOGossipSelect(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 action)
283+
bool GOGossipSelect(Player* pPlayer, GameObject* pGo, uint32 uiSender, uint32 uiAction)
284284
{
285-
debug_log("SD2: GO Gossip selection, sender: %u, action: %u", sender, action);
285+
debug_log("SD2: GO Gossip selection, sender: %u, action: %u", uiSender, uiAction);
286286

287-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
287+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
288288

289-
if (!tmpscript || !tmpscript->pGossipSelectGO)
289+
if (!pTempScript || !pTempScript->pGossipSelectGO)
290290
return false;
291291

292292
pPlayer->PlayerTalkClass->ClearMenus();
293293

294-
return tmpscript->pGossipSelectGO(pPlayer, pGo, sender, action);
294+
return pTempScript->pGossipSelectGO(pPlayer, pGo, uiSender, uiAction);
295295
}
296296

297297
MANGOS_DLL_EXPORT
298298
bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode)
299299
{
300300
debug_log("SD2: Gossip selection with code, sender: %u, action: %u", uiSender, uiAction);
301301

302-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
302+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
303303

304-
if (!tmpscript || !tmpscript->pGossipSelectWithCode)
304+
if (!pTempScript || !pTempScript->pGossipSelectWithCode)
305305
return false;
306306

307307
pPlayer->PlayerTalkClass->ClearMenus();
308308

309-
return tmpscript->pGossipSelectWithCode(pPlayer, pCreature, uiSender, uiAction, sCode);
309+
return pTempScript->pGossipSelectWithCode(pPlayer, pCreature, uiSender, uiAction, sCode);
310310
}
311311

312312
MANGOS_DLL_EXPORT
313-
bool GOGossipSelectWithCode(Player *pPlayer, GameObject *pGo, uint32 sender, uint32 action, const char* sCode)
313+
bool GOGossipSelectWithCode(Player* pPlayer, GameObject* pGo, uint32 uiSender, uint32 uiAction, const char* sCode)
314314
{
315-
debug_log("SD2: GO Gossip selection with code, sender: %u, action: %u", sender, action);
315+
debug_log("SD2: GO Gossip selection with code, sender: %u, action: %u", uiSender, uiAction);
316316

317-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
317+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
318318

319-
if (!tmpscript || !tmpscript->pGossipSelectGOWithCode)
319+
if (!pTempScript || !pTempScript->pGossipSelectGOWithCode)
320320
return false;
321321

322322
pPlayer->PlayerTalkClass->ClearMenus();
323323

324-
return tmpscript->pGossipSelectGOWithCode(pPlayer, pGo, sender, action, sCode);
324+
return pTempScript->pGossipSelectGOWithCode(pPlayer, pGo, uiSender, uiAction, sCode);
325325
}
326326

327327
MANGOS_DLL_EXPORT
328328
bool QuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
329329
{
330-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
330+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
331331

332-
if (!tmpscript || !tmpscript->pQuestAcceptNPC)
332+
if (!pTempScript || !pTempScript->pQuestAcceptNPC)
333333
return false;
334334

335335
pPlayer->PlayerTalkClass->ClearMenus();
336336

337-
return tmpscript->pQuestAcceptNPC(pPlayer, pCreature, pQuest);
337+
return pTempScript->pQuestAcceptNPC(pPlayer, pCreature, pQuest);
338338
}
339339

340340
MANGOS_DLL_EXPORT
341341
bool QuestRewarded(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
342342
{
343-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
343+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
344344

345-
if (!tmpscript || !tmpscript->pQuestRewardedNPC)
345+
if (!pTempScript || !pTempScript->pQuestRewardedNPC)
346346
return false;
347347

348348
pPlayer->PlayerTalkClass->ClearMenus();
349349

350-
return tmpscript->pQuestRewardedNPC(pPlayer, pCreature, pQuest);
350+
return pTempScript->pQuestRewardedNPC(pPlayer, pCreature, pQuest);
351351
}
352352

353353
MANGOS_DLL_EXPORT
354354
uint32 GetNPCDialogStatus(Player* pPlayer, Creature* pCreature)
355355
{
356-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
356+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
357357

358-
if (!tmpscript || !tmpscript->pDialogStatusNPC)
358+
if (!pTempScript || !pTempScript->pDialogStatusNPC)
359359
return 100;
360360

361361
pPlayer->PlayerTalkClass->ClearMenus();
362362

363-
return tmpscript->pDialogStatusNPC(pPlayer, pCreature);
363+
return pTempScript->pDialogStatusNPC(pPlayer, pCreature);
364364
}
365365

366366
MANGOS_DLL_EXPORT
367367
uint32 GetGODialogStatus(Player* pPlayer, GameObject* pGo)
368368
{
369-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
369+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
370370

371-
if (!tmpscript || !tmpscript->pDialogStatusGO)
371+
if (!pTempScript || !pTempScript->pDialogStatusGO)
372372
return 100;
373373

374374
pPlayer->PlayerTalkClass->ClearMenus();
375375

376-
return tmpscript->pDialogStatusGO(pPlayer, pGo);
376+
return pTempScript->pDialogStatusGO(pPlayer, pGo);
377377
}
378378

379379
MANGOS_DLL_EXPORT
380380
bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest)
381381
{
382-
Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];
382+
Script* pTempScript = m_scripts[pItem->GetProto()->ScriptId];
383383

384-
if (!tmpscript || !tmpscript->pQuestAcceptItem)
384+
if (!pTempScript || !pTempScript->pQuestAcceptItem)
385385
return false;
386386

387387
pPlayer->PlayerTalkClass->ClearMenus();
388388

389-
return tmpscript->pQuestAcceptItem(pPlayer, pItem, pQuest);
389+
return pTempScript->pQuestAcceptItem(pPlayer, pItem, pQuest);
390390
}
391391

392392
MANGOS_DLL_EXPORT
393393
bool GOUse(Player* pPlayer, GameObject* pGo)
394394
{
395-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
395+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
396396

397-
if (!tmpscript || !tmpscript->pGOUse)
397+
if (!pTempScript || !pTempScript->pGOUse)
398398
return false;
399399

400-
return tmpscript->pGOUse(pPlayer, pGo);
400+
return pTempScript->pGOUse(pPlayer, pGo);
401401
}
402402

403403
MANGOS_DLL_EXPORT
404404
bool GOQuestAccept(Player* pPlayer, GameObject* pGo, const Quest* pQuest)
405405
{
406-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
406+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
407407

408-
if (!tmpscript || !tmpscript->pQuestAcceptGO)
408+
if (!pTempScript || !pTempScript->pQuestAcceptGO)
409409
return false;
410410

411411
pPlayer->PlayerTalkClass->ClearMenus();
412412

413-
return tmpscript->pQuestAcceptGO(pPlayer, pGo, pQuest);
413+
return pTempScript->pQuestAcceptGO(pPlayer, pGo, pQuest);
414414
}
415415

416416
MANGOS_DLL_EXPORT
417417
bool GOQuestRewarded(Player* pPlayer, GameObject* pGo, Quest const* pQuest)
418418
{
419-
Script *tmpscript = m_scripts[pGo->GetGOInfo()->ScriptId];
419+
Script* pTempScript = m_scripts[pGo->GetGOInfo()->ScriptId];
420420

421-
if (!tmpscript || !tmpscript->pQuestRewardedGO)
421+
if (!pTempScript || !pTempScript->pQuestRewardedGO)
422422
return false;
423423

424424
pPlayer->PlayerTalkClass->ClearMenus();
425425

426-
return tmpscript->pQuestRewardedGO(pPlayer, pGo, pQuest);
426+
return pTempScript->pQuestRewardedGO(pPlayer, pGo, pQuest);
427427
}
428428

429429
MANGOS_DLL_EXPORT
430430
bool AreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry)
431431
{
432-
Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)];
432+
Script* pTempScript = m_scripts[GetAreaTriggerScriptId(atEntry->id)];
433433

434-
if (!tmpscript || !tmpscript->pAreaTrigger)
434+
if (!pTempScript || !pTempScript->pAreaTrigger)
435435
return false;
436436

437-
return tmpscript->pAreaTrigger(pPlayer, atEntry);
437+
return pTempScript->pAreaTrigger(pPlayer, atEntry);
438438
}
439439

440440
MANGOS_DLL_EXPORT
441441
bool ProcessEvent(uint32 uiEventId, Object* pSource, Object* pTarget, bool bIsStart)
442442
{
443-
Script *tmpscript = m_scripts[GetEventIdScriptId(uiEventId)];
443+
Script* pTempScript = m_scripts[GetEventIdScriptId(uiEventId)];
444444

445-
if (!tmpscript || !tmpscript->pProcessEventId)
445+
if (!pTempScript || !pTempScript->pProcessEventId)
446446
return false;
447447

448448
// bIsStart may be false, when event is from taxi node events (arrival=false, departure=true)
449-
return tmpscript->pProcessEventId(uiEventId, pSource, pTarget, bIsStart);
449+
return pTempScript->pProcessEventId(uiEventId, pSource, pTarget, bIsStart);
450450
}
451451

452452
MANGOS_DLL_EXPORT
453453
CreatureAI* GetCreatureAI(Creature* pCreature)
454454
{
455-
Script *tmpscript = m_scripts[pCreature->GetScriptId()];
455+
Script* pTempScript = m_scripts[pCreature->GetScriptId()];
456456

457-
if (!tmpscript || !tmpscript->GetAI)
457+
if (!pTempScript || !pTempScript->GetAI)
458458
return NULL;
459459

460-
return tmpscript->GetAI(pCreature);
460+
return pTempScript->GetAI(pCreature);
461461
}
462462

463463
MANGOS_DLL_EXPORT
464464
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
465465
{
466-
Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId];
466+
Script* pTempScript = m_scripts[pItem->GetProto()->ScriptId];
467467

468-
if (!tmpscript || !tmpscript->pItemUse)
468+
if (!pTempScript || !pTempScript->pItemUse)
469469
return false;
470470

471-
return tmpscript->pItemUse(pPlayer, pItem, targets);
471+
return pTempScript->pItemUse(pPlayer, pItem, targets);
472472
}
473473

474474
MANGOS_DLL_EXPORT
475475
bool EffectDummyCreature(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget)
476476
{
477-
Script *tmpscript = m_scripts[pTarget->GetScriptId()];
477+
Script* pTempScript = m_scripts[pTarget->GetScriptId()];
478478

479-
if (!tmpscript || !tmpscript->pEffectDummyNPC)
479+
if (!pTempScript || !pTempScript->pEffectDummyNPC)
480480
return false;
481481

482-
return tmpscript->pEffectDummyNPC(pCaster, spellId, effIndex, pTarget);
482+
return pTempScript->pEffectDummyNPC(pCaster, spellId, effIndex, pTarget);
483483
}
484484

485485
MANGOS_DLL_EXPORT
486486
bool EffectDummyGameObject(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget)
487487
{
488-
Script *tmpscript = m_scripts[pTarget->GetGOInfo()->ScriptId];
488+
Script* pTempScript = m_scripts[pTarget->GetGOInfo()->ScriptId];
489489

490-
if (!tmpscript || !tmpscript->pEffectDummyGO)
490+
if (!pTempScript || !pTempScript->pEffectDummyGO)
491491
return false;
492492

493-
return tmpscript->pEffectDummyGO(pCaster, spellId, effIndex, pTarget);
493+
return pTempScript->pEffectDummyGO(pCaster, spellId, effIndex, pTarget);
494494
}
495495

496496
MANGOS_DLL_EXPORT
497497
bool EffectDummyItem(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget)
498498
{
499-
Script *tmpscript = m_scripts[pTarget->GetProto()->ScriptId];
499+
Script* pTempScript = m_scripts[pTarget->GetProto()->ScriptId];
500500

501-
if (!tmpscript || !tmpscript->pEffectDummyItem)
501+
if (!pTempScript || !pTempScript->pEffectDummyItem)
502502
return false;
503503

504-
return tmpscript->pEffectDummyItem(pCaster, spellId, effIndex, pTarget);
504+
return pTempScript->pEffectDummyItem(pCaster, spellId, effIndex, pTarget);
505505
}
506506

507507
MANGOS_DLL_EXPORT
508-
bool AuraDummy(Aura const* pAura, bool apply)
508+
bool AuraDummy(Aura const* pAura, bool bApply)
509509
{
510-
Script *tmpscript = m_scripts[((Creature*)pAura->GetTarget())->GetScriptId()];
510+
Script* pTempScript = m_scripts[((Creature*)pAura->GetTarget())->GetScriptId()];
511511

512-
if (!tmpscript || !tmpscript->pEffectAuraDummy)
512+
if (!pTempScript || !pTempScript->pEffectAuraDummy)
513513
return false;
514514

515-
return tmpscript->pEffectAuraDummy(pAura, apply);
515+
return pTempScript->pEffectAuraDummy(pAura, bApply);
516516
}
517517

518518
MANGOS_DLL_EXPORT
519519
InstanceData* CreateInstanceData(Map* pMap)
520520
{
521-
Script *tmpscript = m_scripts[pMap->GetScriptId()];
521+
Script* pTempScript = m_scripts[pMap->GetScriptId()];
522522

523-
if (!tmpscript || !tmpscript->GetInstanceData)
523+
if (!pTempScript || !pTempScript->GetInstanceData)
524524
return NULL;
525525

526-
return tmpscript->GetInstanceData(pMap);
526+
return pTempScript->GetInstanceData(pMap);
527527
}

sd2_revision_nr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef __SD2_REVISION_NR_H__
22
#define __SD2_REVISION_NR_H__
3-
#define SD2_REVISION_NR "2139"
3+
#define SD2_REVISION_NR "2140"
44
#endif // __SD2_REVISION_NR_H__

0 commit comments

Comments
 (0)