From 9045246e74e70ae711c85a88df63f007029e2849 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 13:02:28 -0700 Subject: Export BroadcastEntityAnimation with ToLua Fixes #752 --- src/World.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index c78bc8c8c..2346ac523 100644 --- a/src/World.h +++ b/src/World.h @@ -217,7 +217,7 @@ public: void BroadcastEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude = NULL); void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL); void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL); - virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; + virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override; // tolua_export void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL); void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL); -- cgit v1.2.3 From c0b62ef139a65ca648135fb6999e6623438fdd71 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 24 Jul 2014 18:32:05 +0200 Subject: Added a queue for setting chunk data. Fixes #1196. --- src/World.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 2346ac523..6613b495a 100644 --- a/src/World.h +++ b/src/World.h @@ -49,9 +49,14 @@ class cNoteEntity; class cMobHeadEntity; class cCompositeChat; class cCuboid; +class cSetChunkData; + typedef std::list< cPlayer * > cPlayerList; +typedef SharedPtr cSetChunkDataPtr; // TODO: Change to unique_ptr once we go C++11 +typedef std::vector cSetChunkDataPtrs; + typedef cItemCallback cPlayerListCallback; typedef cItemCallback cEntityCallback; typedef cItemCallback cChestCallback; @@ -246,24 +251,9 @@ public: void MarkChunkSaving(int a_ChunkX, int a_ChunkZ); void MarkChunkSaved (int a_ChunkX, int a_ChunkZ); - /** Sets the chunk data as either loaded from the storage or generated. - a_BlockLight and a_BlockSkyLight are optional, if not present, chunk will be marked as unlighted. - a_BiomeMap is optional, if not present, biomes will be calculated by the generator - a_HeightMap is optional, if not present, will be calculated. - If a_MarkDirty is set, the chunk is set as dirty (used after generating) - */ - void SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap * a_BiomeMap, - cEntityList & a_Entities, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty - ); + /** Puts the chunk data into a queue to be set into the chunkmap in the tick thread. + If the chunk data doesn't contain valid biomes, the biomes are calculated before adding the data into the queue. */ + void QueueSetChunkData(const cSetChunkDataPtr & a_SetChunkData); void ChunkLighted( int a_ChunkX, int a_ChunkZ, @@ -969,6 +959,12 @@ private: /** List of players that are scheduled for adding, waiting for the Tick thread to add them. */ cPlayerList m_PlayersToAdd; + + /** CS protecting m_SetChunkDataQueue. */ + cCriticalSection m_CSSetChunkDataQueue; + + /** Queue for the chunk data to be set into m_ChunkMap by the tick thread. Protected by m_CSSetChunkDataQueue */ + cSetChunkDataPtrs m_SetChunkDataQueue; cWorld(const AString & a_WorldName); @@ -1011,6 +1007,10 @@ private: /** Adds the players queued in the m_PlayersToAdd queue into the m_Players list. Assumes it is called from the Tick thread. */ void AddQueuedPlayers(void); + + /** Sets the specified chunk data into the chunkmap. Called in the tick thread. + Modifies the a_SetChunkData - moves the entities contained in it into the chunk. */ + void SetChunkData(cSetChunkData & a_SetChunkData); }; // tolua_export -- cgit v1.2.3 From 4191be7ddba820af4ed0c505a8d62416c2b7a8b4 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Jul 2014 15:36:13 -0700 Subject: Removed redundant semicolons and re-added warning --- src/World.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index 6613b495a..9658178ae 100644 --- a/src/World.h +++ b/src/World.h @@ -96,7 +96,7 @@ public: class cTask { public: - virtual ~cTask(){}; + virtual ~cTask() {} virtual void Run(cWorld & a_World) = 0; } ; @@ -645,7 +645,7 @@ public: void GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue); // Various queues length queries (cannot be const, they lock their CS): - inline int GetGeneratorQueueLength (void) { return m_Generator.GetQueueLength(); } // tolua_export + inline int GetGeneratorQueueLength (void) { return m_Generator.GetQueueLength(); } // tolua_export inline size_t GetLightingQueueLength (void) { return m_Lighting.GetQueueLength(); } // tolua_export inline size_t GetStorageLoadQueueLength(void) { return m_Storage.GetLoadQueueLength(); } // tolua_export inline size_t GetStorageSaveQueueLength(void) { return m_Storage.GetSaveQueueLength(); } // tolua_export @@ -677,13 +677,13 @@ public: void CastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ); /** Sets the specified weather; resets weather interval; asks and notifies plugins of the change */ - void SetWeather (eWeather a_NewWeather); + void SetWeather(eWeather a_NewWeather); /** Forces a weather change in the next game tick */ - void ChangeWeather (void); + void ChangeWeather(void); /** Returns the current weather. Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible */ - eWeather GetWeather (void) const { return m_Weather; }; + eWeather GetWeather(void) const { return m_Weather; } /** Returns true if the current weather is sun */ bool IsWeatherSunny(void) const { return (m_Weather == wSunny); } @@ -698,7 +698,7 @@ public: bool IsWeatherRain(void) const { return (m_Weather == wRain); } /** Returns true if it is raining at the specified location. This takes into account biomes. */ - bool IsWeatherRainAt (int a_BlockX, int a_BlockZ) + bool IsWeatherRainAt(int a_BlockX, int a_BlockZ) { return (IsWeatherRain() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); } -- cgit v1.2.3