Core/Game: Include cleanup

* Mostly aimed at removing Log/DatabaseEnv includes from other headers
* Fix most packet headers including other packet headers - moved common structures such as ItemInstance to their own files
* Moved SAI function definitions to source files (massive or requiring many different dependencies)
This commit is contained in:
Shauren
2017-05-18 23:52:58 +02:00
parent 7445670314
commit c5d3dd90be
357 changed files with 4791 additions and 3886 deletions

View File

@@ -17,27 +17,34 @@
*/
#include "ScriptMgr.h"
#include "ScriptReloadMgr.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
#include "Chat.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h"
#include "Errors.h"
#include "GameObject.h"
#include "GossipDef.h"
#include "LFGScripts.h"
#include "Log.h"
#include "Map.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "Player.h"
#include "ScriptReloadMgr.h"
#include "ScriptSystem.h"
#include "Transport.h"
#include "Vehicle.h"
#include "SmartAI.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "SpellScript.h"
#include "GossipDef.h"
#include "CreatureAIImpl.h"
#include "Player.h"
#include "Timer.h"
#include "Transport.h"
#include "Vehicle.h"
#include "Weather.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Chat.h"
#include "MapManager.h"
#include "LFGScripts.h"
#include "InstanceScript.h"
#include "AreaTriggerAI.h"
#include <unordered_map>
// Trait which indicates whether this script type
// must be assigned in the database.
@@ -2518,12 +2525,22 @@ CreatureScript::CreatureScript(const char* name)
ScriptRegistry<CreatureScript>::Instance()->AddScript(this);
}
uint32 CreatureScript::GetDialogStatus(Player* /*player*/, Creature* /*creature*/)
{
return DIALOG_STATUS_SCRIPTED_NO_STATUS;
}
GameObjectScript::GameObjectScript(const char* name)
: ScriptObject(name)
{
ScriptRegistry<GameObjectScript>::Instance()->AddScript(this);
}
uint32 GameObjectScript::GetDialogStatus(Player* /*player*/, GameObject* /*go*/)
{
return DIALOG_STATUS_SCRIPTED_NO_STATUS;
}
AreaTriggerScript::AreaTriggerScript(const char* name)
: ScriptObject(name)
{

View File

@@ -20,12 +20,8 @@
#define SC_SCRIPTMGR_H
#include "Common.h"
#include <atomic>
#include "DB2Stores.h"
#include "QuestDef.h"
#include "SharedDefines.h"
#include "World.h"
#include "Weather.h"
#include "ObjectGuid.h"
#include <vector>
class AccountMgr;
class AreaTrigger;
@@ -60,6 +56,7 @@ class SpellCastTargets;
class Transport;
class Unit;
class Vehicle;
class Weather;
class WorldPacket;
class WorldSocket;
class WorldObject;
@@ -76,6 +73,17 @@ struct MapEntry;
struct OutdoorPvPData;
struct SceneTemplate;
enum BattlegroundTypeId : uint32;
enum Difficulty : uint8;
enum DuelCompleteType : uint8;
enum QuestStatus : uint8;
enum RemoveMethod : uint8;
enum ShutdownExitCode : uint32;
enum ShutdownMask : uint32;
enum SpellEffIndex : uint8;
enum WeatherState : uint32;
enum XPColorChar : uint8;
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
@@ -296,7 +304,8 @@ class TC_GAME_API FormulaScript : public ScriptObject
virtual void OnGroupRateCalculation(float& /*rate*/, uint32 /*count*/, bool /*isRaid*/) { }
};
template<class TMap> class MapScript : public UpdatableScript<TMap>
template<class TMap>
class MapScript : public UpdatableScript<TMap>
{
MapEntry const* _mapEntry;
@@ -432,7 +441,7 @@ class TC_GAME_API CreatureScript : public UnitScript, public UpdatableScript<Cre
virtual bool OnQuestReward(Player* /*player*/, Creature* /*creature*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the creature is requested.
virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/);
// Called when the creature tries to spawn. Return false to block spawn and re-evaluate on next tick.
virtual bool CanSpawn(ObjectGuid::LowType /*spawnId*/, uint32 /*entry*/, CreatureTemplate const* /*baseTemplate*/, CreatureTemplate const* /*actTemplate*/, CreatureData const* /*cData*/, Map const* /*map*/) const { return true; }
@@ -468,7 +477,7 @@ class TC_GAME_API GameObjectScript : public ScriptObject, public UpdatableScript
virtual bool OnQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
// Called when the dialog status between a player and the gameobject is requested.
virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
virtual uint32 GetDialogStatus(Player* /*player*/, GameObject* /*go*/);
// Called when the game object is destroyed (destructible buildings only).
virtual void OnDestroyed(GameObject* /*go*/, Player* /*player*/) { }

View File

@@ -37,30 +37,30 @@ ScriptReloadMgr* ScriptReloadMgr::instance()
#else
#include <algorithm>
#include <regex>
#include <vector>
#include <future>
#include <memory>
#include <fstream>
#include <type_traits>
#include <unordered_set>
#include <unordered_map>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/system_error.hpp>
#include "efsw/efsw.hpp"
#include "Log.h"
#include "Config.h"
#include "BuiltInConfig.h"
#include "Config.h"
#include "GitRevision.h"
#include "Log.h"
#include "MPSCQueue.h"
#include "Regex.h"
#include "ScriptMgr.h"
#include "SHA1.h"
#include "StartProcess.h"
#include "MPSCQueue.h"
#include "GitRevision.h"
#include "Timer.h"
#include "World.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/system_error.hpp>
#include <efsw/efsw.hpp>
#include <algorithm>
#include <fstream>
#include <future>
#include <memory>
#include <sstream>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace fs = boost::filesystem;

View File

@@ -17,10 +17,11 @@
*/
#include "ScriptSystem.h"
#include "ObjectMgr.h"
#include "DatabaseEnv.h"
#include "ScriptMgr.h"
#include "Creature.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
SystemMgr* SystemMgr::instance()
{
@@ -109,7 +110,7 @@ void SystemMgr::LoadScriptSplineChains()
uint16 chainId = fieldsMeta[1].GetUInt16();
uint8 splineId = fieldsMeta[2].GetUInt8();
SplineChain& chain = m_mSplineChainsMap[{entry,chainId}];
if (splineId != chain.size())
{
TC_LOG_WARN("server.loading", "Creature #%u: Chain %u has orphaned spline %u, skipped.", entry, chainId, splineId);

View File

@@ -19,8 +19,11 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
#include "ScriptMgr.h"
#include "Define.h"
#include "Hash.h"
#include "SplineChain.h"
#include <unordered_map>
#include <vector>
class Creature;