From 68c015af4429f72b54d2378c74c11a94a320aa1d Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sat, 15 Aug 2009 00:32:04 +0200 Subject: Merge [SD2] r1284 Apply SD2 code style to all uint32 arguments in gossip related functions. r1285 Replace all remains of _GO with proper pointer style. Aslo some other code style. Fix typo in world_scripts_full.sql. thx Sundark --HG-- branch : trunk --- src/bindings/scripts/ScriptMgr.cpp | 194 ++++++++++++++++++------------------- 1 file changed, 97 insertions(+), 97 deletions(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 67c31cd496d..09c1605f866 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -687,14 +687,14 @@ void LoadDatabase() //Get db string from file std::string dbstring = TScriptConfig.GetStringDefault("WorldDatabaseInfo", ""); - if (dbstring.empty() ) + if (dbstring.empty()) { error_log("TSCR: Missing world database info from configuration file. Load database aborted."); return; } //Initialize connection to DB - if (!dbstring.empty() && TScriptDB.Initialize(dbstring.c_str()) ) + if (!dbstring.empty() && TScriptDB.Initialize(dbstring.c_str())) outstring_log("TSCR: TrinityScript database: %s",dbstring.c_str()); else { @@ -764,14 +764,14 @@ void LoadDatabase() if (temp.SoundId) { if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) - error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.",i,temp.SoundId); + error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.",i, temp.SoundId); } if (!GetLanguageDescByID(temp.Language)) - error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.",i,temp.Language); + error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.",i, temp.Language); if (temp.Type > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.",i,temp.Type); + error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.",i, temp.Type); TextMap[i] = temp; ++count; @@ -829,14 +829,14 @@ void LoadDatabase() if (temp.SoundId) { if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) - error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.",i,temp.SoundId); + error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.",i, temp.SoundId); } if (!GetLanguageDescByID(temp.Language)) - error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.",i,temp.Language); + error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.",i, temp.Language); if (temp.Type > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.",i,temp.Type); + error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.",i, temp.Type); TextMap[i] = temp; ++count; @@ -1655,7 +1655,7 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) if((*i).second.SoundId) { - if( GetSoundEntriesStore()->LookupEntry((*i).second.SoundId) ) + if(GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) { pSource->SendPlaySound((*i).second.SoundId, false); } @@ -1670,7 +1670,7 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); } else - error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); + error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry, pSource->GetTypeId()); } switch((*i).second.Type) @@ -1732,242 +1732,242 @@ char const* ScriptsVersion() return "Default Trinity scripting library"; } TRINITY_DLL_EXPORT -bool GossipHello ( Player * player, Creature *_Creature ) +bool GossipHello (Player * pPlayer, Creature* pCreature) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipHello) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGossipHello(player,_Creature); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGossipHello(pPlayer, pCreature); } TRINITY_DLL_EXPORT -bool GossipSelect( Player *player, Creature *_Creature, uint32 sender, uint32 action ) +bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); + debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelect) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGossipSelect(player,_Creature,sender,action); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGossipSelect(pPlayer, pCreature, uiSender, uiAction); } TRINITY_DLL_EXPORT -bool GossipSelectWithCode( Player *player, Creature *_Creature, uint32 sender, uint32 action, const char* sCode ) +bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) { - debug_log("TSCR: Gossip selection with code, sender: %d, action: %d",sender, action); + debug_log("TSCR: Gossip selection with code, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGossipSelectWithCode(player,_Creature,sender,action,sCode); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGossipSelectWithCode(pPlayer, pCreature, uiSender, uiAction, sCode); } TRINITY_DLL_EXPORT -bool GOSelect( Player *player, GameObject *_GO, uint32 sender, uint32 action ) +bool GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction) { - if(!_GO) + if(!pGO) return false; - debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); + debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if(!tmpscript || !tmpscript->pGOSelect) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGOSelect(player,_GO,sender,action); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOSelect(pPlayer, pGO, uiSender, uiAction); } TRINITY_DLL_EXPORT -bool GOSelectWithCode( Player *player, GameObject *_GO, uint32 sender, uint32 action, const char* sCode ) +bool GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint32 uiAction, const char* sCode) { - if(!_GO) + if(!pGO) return false; - debug_log("TSCR: Gossip selection, sender: %d, action: %d",sender, action); + debug_log("TSCR: Gossip selection, sender: %d, action: %d",uiSender, uiAction); - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if(!tmpscript || !tmpscript->pGOSelectWithCode) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGOSelectWithCode(player,_GO,sender,action,sCode); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOSelectWithCode(pPlayer, pGO, uiSender ,uiAction, sCode); } TRINITY_DLL_EXPORT -bool QuestAccept( Player *player, Creature *_Creature, Quest const *_Quest ) +bool QuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestAccept) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pQuestAccept(player,_Creature,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pQuestAccept(pPlayer, pCreature, pQuest); } TRINITY_DLL_EXPORT -bool QuestSelect( Player *player, Creature *_Creature, Quest const *_Quest ) +bool QuestSelect(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestSelect) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pQuestSelect(player,_Creature,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pQuestSelect(pPlayer, pCreature, pQuest); } TRINITY_DLL_EXPORT -bool QuestComplete( Player *player, Creature *_Creature, Quest const *_Quest ) +bool QuestComplete(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pQuestComplete) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pQuestComplete(player,_Creature,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pQuestComplete(pPlayer, pCreature, pQuest); } TRINITY_DLL_EXPORT -bool ChooseReward( Player *player, Creature *_Creature, Quest const *_Quest, uint32 opt ) +bool ChooseReward(Player* pPlayer, Creature* pCreature, Quest const* pQuest, uint32 opt) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pChooseReward) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pChooseReward(player,_Creature,_Quest,opt); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pChooseReward(pPlayer, pCreature, pQuest, opt); } TRINITY_DLL_EXPORT -uint32 NPCDialogStatus( Player *player, Creature *_Creature ) +uint32 NPCDialogStatus(Player* pPlayer, Creature* pCreature) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pNPCDialogStatus) return 100; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pNPCDialogStatus(player,_Creature); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pNPCDialogStatus(pPlayer, pCreature); } TRINITY_DLL_EXPORT -uint32 GODialogStatus( Player *player, GameObject *_GO ) +uint32 GODialogStatus(Player* pPlayer, GameObject* pGO) { - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGODialogStatus) return 100; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGODialogStatus(player,_GO); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGODialogStatus(pPlayer, pGO); } TRINITY_DLL_EXPORT -bool ItemHello( Player *player, Item *_Item, Quest const *_Quest ) +bool ItemHello(Player* pPlayer, Item* pItem, Quest const* pQuest) { - Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; + Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemHello) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pItemHello(player,_Item,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pItemHello(pPlayer, pItem, pQuest); } TRINITY_DLL_EXPORT -bool ItemQuestAccept( Player *player, Item *_Item, Quest const *_Quest ) +bool ItemQuestAccept(Player* pPlayer, Item* pItem, Quest const* pQuest) { - Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; + Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemQuestAccept) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pItemQuestAccept(player,_Item,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pItemQuestAccept(pPlayer, pItem, pQuest); } TRINITY_DLL_EXPORT -bool GOHello( Player *player, GameObject *_GO ) +bool GOHello(Player* pPlayer, GameObject* pGO) { - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOHello) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGOHello(player,_GO); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOHello(pPlayer, pGO); } TRINITY_DLL_EXPORT -bool GOQuestAccept( Player *player, GameObject *_GO, Quest const *_Quest ) +bool GOQuestAccept(Player* pPlayer, GameObject* pGO, Quest const* pQuest) { - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOQuestAccept) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGOQuestAccept(player,_GO,_Quest); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOQuestAccept(pPlayer, pGO, pQuest); } TRINITY_DLL_EXPORT -bool GOChooseReward( Player *player, GameObject *_GO, Quest const *_Quest, uint32 opt ) +bool GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQuest, uint32 opt) { - Script *tmpscript = m_scripts[_GO->GetGOInfo()->ScriptId]; + Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOChooseReward) return false; - player->PlayerTalkClass->ClearMenus(); - return tmpscript->pGOChooseReward(player,_GO,_Quest,opt); + pPlayer->PlayerTalkClass->ClearMenus(); + return tmpscript->pGOChooseReward(pPlayer, pGO, pQuest, opt); } TRINITY_DLL_EXPORT -bool AreaTrigger( Player *player, AreaTriggerEntry * atEntry) +bool AreaTrigger(Player* pPlayer, AreaTriggerEntry * atEntry) { Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)]; if (!tmpscript || !tmpscript->pAreaTrigger) return false; - return tmpscript->pAreaTrigger(player, atEntry); + return tmpscript->pAreaTrigger(pPlayer, atEntry); } TRINITY_DLL_EXPORT -CreatureAI* GetAI(Creature *_Creature) +CreatureAI* GetAI(Creature* pCreature) { - Script *tmpscript = m_scripts[_Creature->GetScriptId()]; + Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->GetAI) return NULL; - return tmpscript->GetAI(_Creature); + return tmpscript->GetAI(pCreature); } TRINITY_DLL_EXPORT -bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) +bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { - Script *tmpscript = m_scripts[_Item->GetProto()->ScriptId]; + Script *tmpscript = m_scripts[pItem->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pItemUse) return false; - return tmpscript->pItemUse(player,_Item,targets); + return tmpscript->pItemUse(pPlayer, pItem, targets); } TRINITY_DLL_EXPORT -bool ItemExpire( Player *player, ItemPrototype const * _ItemProto) +bool ItemExpire(Player* pPlayer, ItemPrototype const * pItemProto) { - Script *tmpscript = m_scripts[_ItemProto->ScriptId]; + Script *tmpscript = m_scripts[pItemProto->ScriptId]; if (!tmpscript || !tmpscript->pItemExpire) return true; - return tmpscript->pItemExpire(player,_ItemProto); + return tmpscript->pItemExpire(pPlayer, pItemProto); } TRINITY_DLL_EXPORT -bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget ) +bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget) { Script *tmpscript = m_scripts[crTarget->GetScriptId()]; if (!tmpscript || !tmpscript->pEffectDummyCreature) return false; - return tmpscript->pEffectDummyCreature(caster, spellId,effIndex,crTarget); + return tmpscript->pEffectDummyCreature(caster, spellId, effIndex, crTarget); } TRINITY_DLL_EXPORT -bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget ) +bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget) { Script *tmpscript = m_scripts[gameObjTarget->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pEffectDummyGameObj) return false; - return tmpscript->pEffectDummyGameObj(caster, spellId,effIndex,gameObjTarget); + return tmpscript->pEffectDummyGameObj(caster, spellId, effIndex, gameObjTarget); } TRINITY_DLL_EXPORT -bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget ) +bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget) { Script *tmpscript = m_scripts[itemTarget->GetProto()->ScriptId]; if (!tmpscript || !tmpscript->pEffectDummyItem) return false; - return tmpscript->pEffectDummyItem(caster, spellId,effIndex,itemTarget); + return tmpscript->pEffectDummyItem(caster, spellId, effIndex, itemTarget); } TRINITY_DLL_EXPORT -- cgit v1.2.3