diff options
| author | Xanadu <none@none> | 2010-06-22 02:53:04 +0200 |
|---|---|---|
| committer | Xanadu <none@none> | 2010-06-22 02:53:04 +0200 |
| commit | c9b20170a34feeaae4d57c6feba374b653223824 (patch) | |
| tree | 452f4dddd8c702e4e737891b5b93a630776b4903 /src/server/game/Scripting | |
| parent | 06ef6e2553a76bd9be2562d89a1128e840a290c8 (diff) | |
Cleanup of logging - removed a few duplicit functions from olden times, fixed a typo.
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Scripting')
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 54 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptSystem.cpp | 66 |
2 files changed, 60 insertions, 60 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index b41f6a215f8..88e5b7284c0 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -45,22 +45,22 @@ ScriptMgr::~ScriptMgr() void ScriptMgr::ScriptsInit() { //Trinity Script startup - /*outstring_log(" _____ _ _ _ ____ _ _"); - outstring_log("|_ _| __(_)_ __ (_) |_ _ _/ ___| ___ _ __(_)_ __ | |_ "); - outstring_log(" | || '__| | '_ \\| | __| | | \\___ \\ / __| \'__| | \'_ \\| __|"); - outstring_log(" | || | | | | | | | |_| |_| |___) | (__| | | | |_) | |_ "); - outstring_log(" |_||_| |_|_| |_|_|\\__|\\__, |____/ \\___|_| |_| .__/ \\__|"); - outstring_log(" |___/ |_| "); - outstring_log(""); - outstring_log("");*/ + /*sLog.outString(" _____ _ _ _ ____ _ _"); + sLog.outString("|_ _| __(_)_ __ (_) |_ _ _/ ___| ___ _ __(_)_ __ | |_ "); + sLog.outString(" | || '__| | '_ \\| | __| | | \\___ \\ / __| \'__| | \'_ \\| __|"); + sLog.outString(" | || | | | | | | | |_| |_| |___) | (__| | | | |_) | |_ "); + sLog.outString(" |_||_| |_|_| |_|_|\\__|\\__, |____/ \\___|_| |_| .__/ \\__|"); + sLog.outString(" |___/ |_| "); + sLog.outString(""); + sLog.outString("");*/ //Load database (must be called after SD2Config.SetSource). LoadDatabase(); - outstring_log("Loading C++ scripts"); + sLog.outString("Loading C++ scripts"); barGoLink bar(1); bar.step(); - outstring_log(""); + sLog.outString(""); for (uint16 i =0; i<MAX_SCRIPTS; ++i) m_scripts[i]=NULL; @@ -69,9 +69,9 @@ void ScriptMgr::ScriptsInit() AddScripts(); - outstring_log(">> Loaded %i C++ Scripts.", num_sc_scripts); + sLog.outString(">> Loaded %i C++ Scripts.", num_sc_scripts); - outstring_log(">> Load Overriden SQL Data."); + sLog.outString(">> Load Overriden SQL Data."); LoadOverridenSQLData(); } @@ -82,13 +82,13 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) { if (!pSource) { - error_log("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry); + sLog.outError("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry); return; } if (iTextEntry >= 0) { - error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); + sLog.outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } @@ -96,11 +96,11 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) if (!pData) { - error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); + sLog.outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); + sLog.outDebug("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); if (pData->uiSoundId) { @@ -109,7 +109,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) pSource->SendPlaySound(pData->uiSoundId, false); } else - error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); + sLog.outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); } if (pData->uiEmote) @@ -117,7 +117,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote); else - error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); + sLog.outError("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); } switch(pData->uiType) @@ -139,7 +139,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID()); else - error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); + sLog.outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); } break; case CHAT_TYPE_BOSS_WHISPER: @@ -147,7 +147,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID(), true); else - error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); + sLog.outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); } break; case CHAT_TYPE_ZONE_YELL: @@ -165,7 +165,7 @@ void Script::RegisterSelf() // somebody forgot to allocate memory for a script by a method like this: newscript = new Script if (m_scripts[i] == this) { - error_log("ScriptName: '%s' - Forgot to allocate memory, so this script and/or the script before that can't work.", Name.c_str()); + sLog.outError("ScriptName: '%s' - Forgot to allocate memory, so this script and/or the script before that can't work.", Name.c_str()); // don't register it // and don't delete it because its memory is used for another script return; @@ -200,14 +200,14 @@ void Script::RegisterSelf() else { // TODO: write a better error message than this one :) - error_log("ScriptName: '%s' already assigned with the same ScriptName, so the script can't work.", Name.c_str()); + sLog.outError("ScriptName: '%s' already assigned with the same ScriptName, so the script can't work.", Name.c_str()); delete this; } } else { if (Name.find("example") == std::string::npos) - error_db_log("TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); + sLog.outErrorDb("TrinityScript: RegisterSelf, but script named %s does not have ScriptName assigned in database.",(this)->Name.c_str()); delete this; } } @@ -326,7 +326,7 @@ bool ScriptMgr::GossipHello (Player * pPlayer, Creature* pCreature) bool ScriptMgr::GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); + sLog.outDebug("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelect) return false; @@ -337,7 +337,7 @@ bool ScriptMgr::GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSend bool ScriptMgr::GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) { - debug_log("TSCR: Gossip selection with code, sender: %d, action: %d", uiSender, uiAction); + sLog.outDebug("TSCR: Gossip selection with code, sender: %d, action: %d", uiSender, uiAction); Script *tmpscript = m_scripts[pCreature->GetScriptId()]; if (!tmpscript || !tmpscript->pGossipSelectWithCode) return false; @@ -350,7 +350,7 @@ bool ScriptMgr::GOSelect(Player* pPlayer, GameObject* pGO, uint32 uiSender, uint { if (!pGO) return false; - debug_log("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); + sLog.outDebug("TSCR: Gossip selection, sender: %d, action: %d", uiSender, uiAction); Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOSelect) return false; @@ -363,7 +363,7 @@ bool ScriptMgr::GOSelectWithCode(Player* pPlayer, GameObject* pGO, uint32 uiSend { if (!pGO) return false; - debug_log("TSCR: Gossip selection, sender: %d, action: %d",uiSender, uiAction); + sLog.outDebug("TSCR: Gossip selection, sender: %d, action: %d",uiSender, uiAction); Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId]; if (!tmpscript || !tmpscript->pGOSelectWithCode) return false; diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index fcd5c81add4..54a14228bc1 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -43,24 +43,24 @@ void SystemMgr::LoadVersion() { Field* pFields = Result->Fetch(); - outstring_log("TSCR: Database version is: %s", pFields[0].GetString()); - outstring_log(""); + sLog.outString("TSCR: Database version is: %s", pFields[0].GetString()); + sLog.outString(""); } else { - error_log("TSCR: Missing `version`.`script_version` information."); - outstring_log(""); + sLog.outError("TSCR: Missing `version`.`script_version` information."); + sLog.outString(""); } } void SystemMgr::LoadScriptTexts() { - outstring_log("TSCR: Loading Script Texts..."); + sLog.outString("TSCR: Loading Script Texts..."); LoadTrinityStrings(WorldDatabase,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); QueryResult_AutoPtr Result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); - outstring_log("TSCR: Loading Script Texts additional data..."); + sLog.outString("TSCR: Loading Script Texts additional data..."); if (Result) { @@ -81,52 +81,52 @@ void SystemMgr::LoadScriptTexts() if (iId >= 0) { - error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.", iId); + sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId); continue; } if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) { - error_db_log("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); + sLog.outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); continue; } if (pTemp.uiSoundId) { if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) - error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); + sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); } if (!GetLanguageDescByID(pTemp.uiLanguage)) - error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); + sLog.outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); + sLog.outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); m_mTextDataMap[iId] = pTemp; ++uiCount; } while (Result->NextRow()); - outstring_log(""); - outstring_log(">> Loaded %u additional Script Texts data.", uiCount); + sLog.outString(""); + sLog.outString(">> Loaded %u additional Script Texts data.", uiCount); } else { barGoLink bar(1); bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); + sLog.outString(""); + sLog.outString(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); } } void SystemMgr::LoadScriptTextsCustom() { - outstring_log("TSCR: Loading Custom Texts..."); + sLog.outString("TSCR: Loading Custom Texts..."); LoadTrinityStrings(WorldDatabase,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); QueryResult_AutoPtr Result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts"); - outstring_log("TSCR: Loading Custom Texts additional data..."); + sLog.outString("TSCR: Loading Custom Texts additional data..."); if (Result) { @@ -147,41 +147,41 @@ void SystemMgr::LoadScriptTextsCustom() if (iId >= 0) { - error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); + sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); continue; } if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) { - error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); + sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); continue; } if (pTemp.uiSoundId) { if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) - error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); + sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); } if (!GetLanguageDescByID(pTemp.uiLanguage)) - error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); + sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); + sLog.outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); m_mTextDataMap[iId] = pTemp; ++uiCount; } while (Result->NextRow()); - outstring_log(""); - outstring_log(">> Loaded %u additional Custom Texts data.", uiCount); + sLog.outString(""); + sLog.outString(">> Loaded %u additional Custom Texts data.", uiCount); } else { barGoLink bar(1); bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); + sLog.outString(""); + sLog.outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); } } @@ -197,7 +197,7 @@ void SystemMgr::LoadScriptWaypoints() if (Result) uiCreatureCount = Result->GetRowCount(); - outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); + sLog.outString("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); Result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); @@ -224,25 +224,25 @@ void SystemMgr::LoadScriptWaypoints() if (!pCInfo) { - error_db_log("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry); + sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry); continue; } if (!pCInfo->ScriptID) - error_db_log("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry); + sLog.outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry); m_mPointMoveMap[uiEntry].push_back(pTemp); ++uiNodeCount; } while (Result->NextRow()); - outstring_log(""); - outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount); + sLog.outString(""); + sLog.outString(">> Loaded %u Script Waypoint nodes.", uiNodeCount); } else { barGoLink bar(1); bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + sLog.outString(""); + sLog.outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); } } |
