blob: a56e797da9d3c22005ba7a2545ab836520dd52a9 (
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
61
62
63
|
// ChunkSender.h
// Interfaces to the cChunkSender class representing the thread that waits for chunks becoming ready (loaded / generated) and sends them to clients
#pragma once
#include "cIsThread.h"
#include "cChunk.h"
#include "packets/cPacket.h"
class cWorld;
class cChunkSender:
public cIsThread,
public cChunkDataCallback
{
typedef cIsThread super;
public:
cChunkSender(void);
~cChunkSender();
bool Start(cWorld * a_World);
void ChunkReady(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
protected:
cWorld * m_World;
cCriticalSection m_CS;
cChunkCoordsList m_ChunksReady;
cEvent m_Event; // Set when anything is added to m_ChunksReady
// Data about the chunk that is being sent:
char m_BlockData[cChunk::c_BlockDataSize];
PacketList m_Packets; // Accumulator for the entity-packets to send
// cIsThread override:
virtual void Execute(void) override;
// cChunkDataCallback overrides:
virtual void BlockData(const char * a_Data) override;
virtual void Entity(cEntity * a_Entity) override;
virtual void BlockEntity(cBlockEntity * a_Entity) override;
} ;
|