summaryrefslogtreecommitdiffstats
path: root/src/Broadcaster.cpp
blob: d3d3de9f03ca55bc936f029cc45fae822effae88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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)
{
}





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,
		[=](cChunk & a_Chunk) -> bool
		{
			for (auto && client : a_Chunk.GetAllClients())
			{
				if (client == a_Exclude)
				{
					continue;
				}
				client->SendParticleEffect(a_ParticleName, a_Src.x, a_Src.y, a_Src.z, a_Offset.x, a_Offset.y, a_Offset.z, a_ParticleData, a_ParticleAmount);
			};
			return true;
		});
}





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,
		[=](cChunk & a_Chunk) -> bool
		{
			for (auto && client : a_Chunk.GetAllClients())
			{
				if (client == a_Exclude)
				{
					continue;
				}
				client->SendParticleEffect(a_ParticleName, a_Src, a_Offset, a_ParticleData, a_ParticleAmount, a_Data);
			};
			return true;
		});
}