From c94d7184ebaf7e8540f717c70c1e03ae62e5a7bd Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Tue, 24 Jul 2018 22:30:49 +0100 Subject: Broadcast refactor (#4264) * Move Broadcast functions from cChunkMap to cBroadcaster - Remove cBroadcastInterface in favour of cBroadcaster. - cChunk: Remove broadcast functions. * resurect broadcast interface * Absorb cBroadcaster into cWorld. Removes the need for forwarding the function calls. * Improve const-correctness * Use Int8 instead of char + Comment `ForClients` functions * Improve comments * Broadcaster: Rename ForClients functions --- src/ChunkDef.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/ChunkDef.h') diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 3807ae1aa..d73bd4198 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -71,6 +71,33 @@ public: +/** Non-owning view of a chunk's client handles. */ +class cChunkClientHandles +{ +public: + using const_iterator = std::vector::const_iterator; + using iterator = const_iterator; + + explicit cChunkClientHandles(const std::vector & a_Container): + m_Begin(a_Container.cbegin()), + m_End(a_Container.cend()) + { + } + + const_iterator begin() const { return m_Begin; } + const_iterator cbegin() const { return m_Begin; } + + const_iterator end() const { return m_End; } + const_iterator cend() const { return m_End; } + +private: + const_iterator m_Begin, m_End; +}; + + + + + /** Constants used throughout the code, useful typedefs and utility functions */ class cChunkDef { -- cgit v1.2.3