1
0
Fork 0

Removed ClientHandle.h dependencies from common headers.

This commit is contained in:
Mattes D 2016-11-18 20:00:04 +01:00
parent 3a89e9959b
commit 0bffa29358
19 changed files with 206 additions and 51 deletions

View File

@ -5,17 +5,18 @@
#include "../BlockArea.h"
#include "../Entities/Player.h"
#include "../UI/BeaconWindow.h"
#include "../ClientHandle.h"
cBeaconEntity::cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World)
: super(E_BLOCK_BEACON, a_BlockX, a_BlockY, a_BlockZ, 1, 1, a_World)
, m_IsActive(false)
, m_BeaconLevel(0)
, m_PrimaryEffect(cEntityEffect::effNoEffect)
, m_SecondaryEffect(cEntityEffect::effNoEffect)
cBeaconEntity::cBeaconEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World):
super(E_BLOCK_BEACON, a_BlockX, a_BlockY, a_BlockZ, 1, 1, a_World),
m_IsActive(false),
m_BeaconLevel(0),
m_PrimaryEffect(cEntityEffect::effNoEffect),
m_SecondaryEffect(cEntityEffect::effNoEffect)
{
UpdateBeacon();
}

View File

@ -2,6 +2,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "EnderChestEntity.h"
#include "json/json.h"
#include "../Item.h"
#include "../Entities/Player.h"
#include "../UI/EnderChestWindow.h"

View File

@ -6,6 +6,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "FlowerPotEntity.h"
#include "../Entities/Player.h"
#include "../ClientHandle.h"
#include "../Item.h"

View File

@ -5,7 +5,9 @@
#include "Globals.h"
#include "MobHeadEntity.h"
#include "json/json.h"
#include "../Entities/Player.h"
#include "../ClientHandle.h"

View File

@ -6,6 +6,7 @@
#include "../World.h"
#include "../FastRandom.h"
#include "../MobSpawner.h"
#include "../ClientHandle.h"
#include "../Items/ItemSpawnEgg.h"

View File

@ -1,8 +1,16 @@
// Broadcaster.cpp
// Implements the broadcasting interface for cWorld
#include "Globals.h"
#include "Broadcaster.h"
#include "World.h"
#include "Chunk.h"
#include "ClientHandle.h"
cBroadcaster::cBroadcaster(cWorld * a_World) :
m_World(a_World)
@ -10,6 +18,9 @@ cBroadcaster::cBroadcaster(cWorld * a_World) :
}
void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, cClientHandle * a_Exclude)
{
m_World->DoWithChunkAt(a_Src,
@ -28,6 +39,9 @@ void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const
}
void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, cClientHandle * a_Exclude)
{
m_World->DoWithChunkAt(a_Src,
@ -44,4 +58,3 @@ void cBroadcaster::BroadcastParticleEffect(const AString & a_ParticleName, const
return true;
});
}

View File

@ -1,10 +1,12 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include <cmath>
#include <unordered_map>
#include "Player.h"
#include "Mobs/Wolf.h"
#include "../BoundingBox.h"
#include <unordered_map>
#include "../ChatColor.h"
#include "../Server.h"
#include "../UI/InventoryWindow.h"
@ -18,7 +20,7 @@
#include "../Items/ItemHandler.h"
#include "../Vector3.h"
#include "../FastRandom.h"
#include <cmath>
#include "../ClientHandle.h"
#include "../WorldStorage/StatSerializer.h"
#include "../CompositeChat.h"
@ -1354,6 +1356,123 @@ void cPlayer::CloseWindowIfID(char a_WindowID, bool a_CanRefuse)
void cPlayer::SendMessage(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtCustom);
}
void cPlayer::SendMessageInfo(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtInformation);
}
void cPlayer::SendMessageFailure(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtFailure);
}
void cPlayer::SendMessageSuccess(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtSuccess);
}
void cPlayer::SendMessageWarning(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtWarning);
}
void cPlayer::SendMessageFatal(const AString & a_Message)
{
m_ClientHandle->SendChat(a_Message, mtFailure);
}
void cPlayer::SendMessagePrivateMsg(const AString & a_Message, const AString & a_Sender)
{
m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender);
}
void cPlayer::SendMessage(const cCompositeChat & a_Message)
{
m_ClientHandle->SendChat(a_Message);
}
void cPlayer::SendMessageRaw(const AString & a_MessageRaw, eChatType a_Type)
{
m_ClientHandle->SendChatRaw(a_MessageRaw, a_Type);
}
void cPlayer::SendSystemMessage(const AString & a_Message)
{
m_ClientHandle->SendChatSystem(a_Message, mtCustom);
}
void cPlayer::SendAboveActionBarMessage(const AString & a_Message)
{
m_ClientHandle->SendChatAboveActionBar(a_Message, mtCustom);
}
void cPlayer::SendSystemMessage(const cCompositeChat & a_Message)
{
m_ClientHandle->SendChatSystem(a_Message);
}
void cPlayer::SendAboveActionBarMessage(const cCompositeChat & a_Message)
{
m_ClientHandle->SendChatAboveActionBar(a_Message);
}
void cPlayer::SetGameMode(eGameMode a_GameMode)
{
if ((a_GameMode < gmMin) || (a_GameMode >= gmMax))

View File

@ -5,7 +5,6 @@
#include "../Inventory.h"
#include "../Defines.h"
#include "../World.h"
#include "../ClientHandle.h"
#include "../Statistics.h"
@ -248,20 +247,19 @@ public:
// tolua_begin
void SendMessage (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtCustom); }
void SendMessageInfo (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtInformation); }
void SendMessageFailure (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
void SendMessageSuccess (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtSuccess); }
void SendMessageWarning (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtWarning); }
void SendMessageFatal (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender) { m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender); }
void SendMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChat(a_Message); }
void SendMessageRaw (const AString & a_MessageRaw, eChatType a_Type = eChatType::ctChatBox) { m_ClientHandle->SendChatRaw(a_MessageRaw, a_Type); }
void SendSystemMessage (const AString & a_Message) { m_ClientHandle->SendChatSystem(a_Message, mtCustom); }
void SendAboveActionBarMessage(const AString & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message, mtCustom); }
void SendSystemMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChatSystem(a_Message); }
void SendAboveActionBarMessage(const cCompositeChat & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message); }
void SendMessage (const AString & a_Message);
void SendMessageInfo (const AString & a_Message);
void SendMessageFailure (const AString & a_Message);
void SendMessageSuccess (const AString & a_Message);
void SendMessageWarning (const AString & a_Message);
void SendMessageFatal (const AString & a_Message);
void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender);
void SendMessage (const cCompositeChat & a_Message);
void SendMessageRaw (const AString & a_MessageRaw, eChatType a_Type = eChatType::ctChatBox);
void SendSystemMessage (const AString & a_Message);
void SendAboveActionBarMessage(const AString & a_Message);
void SendSystemMessage (const cCompositeChat & a_Message);
void SendAboveActionBarMessage(const cCompositeChat & a_Message);
const AString & GetName(void) const { return m_PlayerName; }
void SetName(const AString & a_Name) { m_PlayerName = a_Name; }

View File

@ -5,6 +5,7 @@
#include "../World.h"
#include "../Blocks/BlockSignPost.h"
#include "../Blocks/BlockWallSign.h"
#include "../ClientHandle.h"

View File

@ -10,19 +10,20 @@
#include "Entities/Player.h"
#include "FastRandom.h"
#include "Blocks/BlockHandler.h"
#include "ClientHandle.h"
cMap::cMap(unsigned int a_ID, cWorld * a_World)
: m_ID(a_ID)
, m_Width(cChunkDef::Width * 8)
, m_Height(cChunkDef::Width * 8)
, m_Scale(3)
, m_CenterX(0)
, m_CenterZ(0)
, m_World(a_World)
cMap::cMap(unsigned int a_ID, cWorld * a_World):
m_ID(a_ID),
m_Width(cChunkDef::Width * 8),
m_Height(cChunkDef::Width * 8),
m_Scale(3),
m_CenterX(0),
m_CenterZ(0),
m_World(a_World)
{
m_Data.assign(m_Width * m_Height, E_BASE_COLOR_TRANSPARENT);

View File

@ -12,6 +12,8 @@ Implements the 1.10.x protocol classes:
#include "Protocol110x.h"
#include "Packetizer.h"
#include "json/json.h"
#include "../Root.h"
#include "../Server.h"

View File

@ -2,6 +2,22 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Root.h"
// STD lib hreaders:
#include <iostream>
// OS-specific headers:
#if defined(_WIN32)
#include <psapi.h>
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <signal.h>
#if defined(__linux__)
#include <fstream>
#elif defined(__APPLE__)
#include <mach/mach.h>
#endif
#endif
#include "Server.h"
#include "World.h"
#include "WebAdmin.h"
@ -23,19 +39,7 @@
#include "SettingsRepositoryInterface.h"
#include "OverridesSettingsRepository.h"
#include "Logger.h"
#include <iostream>
#if defined(_WIN32)
#include <psapi.h>
#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#include <signal.h>
#if defined(__linux__)
#include <fstream>
#elif defined(__APPLE__)
#include <mach/mach.h>
#endif
#endif
#include "ClientHandle.h"

View File

@ -8,6 +8,7 @@
#include "SlotArea.h"
#include "../BlockEntities/BeaconEntity.h"
#include "../Entities/Player.h"
#include "../ClientHandle.h"

View File

@ -7,6 +7,7 @@
#include "ChestWindow.h"
#include "../BlockEntities/ChestEntity.h"
#include "../Entities/Player.h"
#include "SlotArea.h"

View File

@ -5,6 +5,7 @@
#include "Globals.h"
#include "DropSpenserWindow.h"
#include "SlotArea.h"

View File

@ -7,6 +7,7 @@
#include "../BlockEntities/HopperEntity.h"
#include "HopperWindow.h"
#include "../BlockEntities/DropperEntity.h"
#include "SlotArea.h"

View File

@ -21,6 +21,7 @@
#include "../FastRandom.h"
#include "../BlockArea.h"
#include "../EffectID.h"
#include "../ClientHandle.h"

View File

@ -2103,6 +2103,15 @@ bool cWorld::SetAreaBiome(const cCuboid & a_Area, EMCSBiome a_Biome)
void cWorld::SetMaxViewDistance(int a_MaxViewDistance)
{
m_MaxViewDistance = Clamp(a_MaxViewDistance, cClientHandle::MIN_VIEW_DISTANCE, cClientHandle::MAX_VIEW_DISTANCE);
}
void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_SendToClients)
{
m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_SendToClients);

View File

@ -9,6 +9,8 @@
#define MAX_PLAYERS 65535
#include <functional>
#include "Simulator/SimulatorManager.h"
#include "ChunkMap.h"
#include "WorldStorage/WorldStorage.h"
@ -26,9 +28,7 @@
#include "Blocks/WorldInterface.h"
#include "Blocks/BroadcastInterface.h"
#include "FastRandom.h"
#include "ClientHandle.h"
#include "EffectID.h"
#include <functional>
@ -640,10 +640,7 @@ public:
void SetTNTShrapnelLevel(eShrapnelLevel a_Flag) { m_TNTShrapnelLevel = a_Flag; }
int GetMaxViewDistance(void) const { return m_MaxViewDistance; }
void SetMaxViewDistance(int a_MaxViewDistance)
{
m_MaxViewDistance = Clamp(a_MaxViewDistance, cClientHandle::MIN_VIEW_DISTANCE, cClientHandle::MAX_VIEW_DISTANCE);
}
void SetMaxViewDistance(int a_MaxViewDistance);
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }