summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BeaconEntity.cpp13
-rw-r--r--src/BlockEntities/EnderChestEntity.cpp1
-rw-r--r--src/BlockEntities/FlowerPotEntity.cpp1
-rw-r--r--src/BlockEntities/MobHeadEntity.cpp2
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp1
-rw-r--r--src/Broadcaster.cpp15
-rw-r--r--src/Entities/Player.cpp123
-rw-r--r--src/Entities/Player.h28
-rw-r--r--src/Items/ItemSign.h1
-rw-r--r--src/Map.cpp17
-rw-r--r--src/Protocol/Protocol110x.cpp2
-rw-r--r--src/Root.cpp30
-rw-r--r--src/UI/BeaconWindow.cpp1
-rw-r--r--src/UI/ChestWindow.cpp1
-rw-r--r--src/UI/DropSpenserWindow.cpp1
-rw-r--r--src/UI/HopperWindow.cpp1
-rw-r--r--src/UI/SlotArea.cpp1
-rw-r--r--src/World.cpp9
-rw-r--r--src/World.h9
19 files changed, 206 insertions, 51 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index 6eb42384d..f2b38ac50 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -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();
}
diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp
index 74ca8d8ad..46d5912c3 100644
--- a/src/BlockEntities/EnderChestEntity.cpp
+++ b/src/BlockEntities/EnderChestEntity.cpp
@@ -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"
diff --git a/src/BlockEntities/FlowerPotEntity.cpp b/src/BlockEntities/FlowerPotEntity.cpp
index 30c7c0745..125b0d173 100644
--- a/src/BlockEntities/FlowerPotEntity.cpp
+++ b/src/BlockEntities/FlowerPotEntity.cpp
@@ -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"
diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp
index 542e920ba..068cc3ddf 100644
--- a/src/BlockEntities/MobHeadEntity.cpp
+++ b/src/BlockEntities/MobHeadEntity.cpp
@@ -5,7 +5,9 @@
#include "Globals.h"
#include "MobHeadEntity.h"
+#include "json/json.h"
#include "../Entities/Player.h"
+#include "../ClientHandle.h"
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 7f1b88c9b..47bf85e9b 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -6,6 +6,7 @@
#include "../World.h"
#include "../FastRandom.h"
#include "../MobSpawner.h"
+#include "../ClientHandle.h"
#include "../Items/ItemSpawnEgg.h"
diff --git a/src/Broadcaster.cpp b/src/Broadcaster.cpp
index 594d12208..d3d3de9f0 100644
--- a/src/Broadcaster.cpp
+++ b/src/Broadcaster.cpp
@@ -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;
});
}
-
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 009f1e829..ce3b8b195 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -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))
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 3de1a4cb5..dab814692 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -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; }
diff --git a/src/Items/ItemSign.h b/src/Items/ItemSign.h
index d8d0197d3..edc358c6e 100644
--- a/src/Items/ItemSign.h
+++ b/src/Items/ItemSign.h
@@ -5,6 +5,7 @@
#include "../World.h"
#include "../Blocks/BlockSignPost.h"
#include "../Blocks/BlockWallSign.h"
+#include "../ClientHandle.h"
diff --git a/src/Map.cpp b/src/Map.cpp
index 1ba27038e..5db09adba 100644
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -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);
diff --git a/src/Protocol/Protocol110x.cpp b/src/Protocol/Protocol110x.cpp
index bf44eb82f..48ea0c6ba 100644
--- a/src/Protocol/Protocol110x.cpp
+++ b/src/Protocol/Protocol110x.cpp
@@ -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"
diff --git a/src/Root.cpp b/src/Root.cpp
index 27277512c..55e149511 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -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"
diff --git a/src/UI/BeaconWindow.cpp b/src/UI/BeaconWindow.cpp
index c1efa78ad..c32ace063 100644
--- a/src/UI/BeaconWindow.cpp
+++ b/src/UI/BeaconWindow.cpp
@@ -8,6 +8,7 @@
#include "SlotArea.h"
#include "../BlockEntities/BeaconEntity.h"
#include "../Entities/Player.h"
+#include "../ClientHandle.h"
diff --git a/src/UI/ChestWindow.cpp b/src/UI/ChestWindow.cpp
index 8c9f33045..bc94ec8fd 100644
--- a/src/UI/ChestWindow.cpp
+++ b/src/UI/ChestWindow.cpp
@@ -7,6 +7,7 @@
#include "ChestWindow.h"
#include "../BlockEntities/ChestEntity.h"
#include "../Entities/Player.h"
+#include "SlotArea.h"
diff --git a/src/UI/DropSpenserWindow.cpp b/src/UI/DropSpenserWindow.cpp
index 121836e40..1ddeae842 100644
--- a/src/UI/DropSpenserWindow.cpp
+++ b/src/UI/DropSpenserWindow.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "DropSpenserWindow.h"
+#include "SlotArea.h"
diff --git a/src/UI/HopperWindow.cpp b/src/UI/HopperWindow.cpp
index 79f0767e8..d2b098e6b 100644
--- a/src/UI/HopperWindow.cpp
+++ b/src/UI/HopperWindow.cpp
@@ -7,6 +7,7 @@
#include "../BlockEntities/HopperEntity.h"
#include "HopperWindow.h"
#include "../BlockEntities/DropperEntity.h"
+#include "SlotArea.h"
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 8878bb900..52b849784 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -21,6 +21,7 @@
#include "../FastRandom.h"
#include "../BlockArea.h"
#include "../EffectID.h"
+#include "../ClientHandle.h"
diff --git a/src/World.cpp b/src/World.cpp
index cee1f8643..eafd44ce0 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -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);
diff --git a/src/World.h b/src/World.h
index 0bcd1f823..84f1d4957 100644
--- a/src/World.h
+++ b/src/World.h
@@ -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; }