1
0
Fork 0
Commit Graph

48 Commits

Author SHA1 Message Date
Tiger Wang 5123850db0
Fix Windows XP to 7 compatibility (#5167)
* Partially reverts 01a4e696b
* Unify thread names
- Remove use of GetThreadId API
2021-03-28 13:34:57 +01:00
Tiger Wang 868cd94ee9
Prepare ChunkData for BlockState storage (#5105)
* Rename ChunkData Creatable test

* Add missing Y-check in RedstoneWireHandler

* Remove ChunkDef.h dependency in Scoreboard

* Prepare ChunkData for BlockState storage

+ Split chunk block, meta, block & sky light storage
+ Load the height map from disk
- Reduce duplicated code in ChunkData
- Remove saving MCSBiomes, there aren't any
- Remove the allocation pool, ref #4315, #3864

* fixed build

* fixed test

* fixed the debug compile

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-03-05 14:03:55 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Mattes D 01b8ed5295
Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)
The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change)
The BlockInfo.h file was removed from Globals.h (main change)
The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics)
The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor)
Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header.
That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified.
eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
2020-04-03 08:57:01 +02:00
Mattes D 66e73a2d68 NBTChunkSerializer: Cleaned up interface.
Removed dependency on cChunkDataCallback.
Moved all the serializing code into a worker class.
Changed the serialization into a single-call action.
2019-09-24 17:38:59 +02:00
Mattes D a2ffa432b3 Separated chunk generator from world / plugin interfaces.
The generator now only takes care of servicing synchronous "GetChunk(X, Y)" and "GetBiomes(X, Y)" requests.
2019-09-06 16:12:33 +02:00
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 7b431bed51
cIsThread: Reset m_ShouldTerminate after the thread has stopped (#4258)
This allows threads to be restarted after stopping.

Fixes #4257
2018-07-22 22:35:58 +01:00
peterbell10 999faa9d90
cLightingThread: Faster chunk reading (#4185)
Profiled at a 10x speedup for cLightingThread::ReadChunks.
2018-02-21 10:30:48 +00:00
peterbell10 c54bf40ef9 cWorld Threads: Seperate initialization and thread start.
Prevents nullptr dereferences before Start has been called.
2017-10-21 19:33:22 +02:00
Alexander Harkness b5a23e5cd9 Lighting now generally consistent with vanilla (#3988)
* Lighting now generally consistent with vanilla

Skylight is now dispersed by some blocks, instead of passing
through unimpeded.

Some blocks which were not marked as transparent are now marked as
such.

Water and other such blocks now attenuate light with the correct
intensity.

Generally changes were based on documentation in the Minecraft
Wiki: https://minecraft.gamepedia.com/Opacity#On_block_light ,
however during play-testing on vanilla lava was found not to
attenuate sky or block-light so the attenuation was removed.

This fixes #3849

* Add API documentation for IsSkylightDispersant

* Rename m_SkylightDispersant to m_IsSkylightDispersant

* Update comment for m_Transparent property of Blocks
2017-09-07 11:56:17 +01:00
Lukas Pioch 4691bc5a29 Removed double includes (#3885) 2017-08-02 19:57:20 +01:00
peterbell10 fbe17a4e8a Lighting Optimisations (#3785) 2017-06-20 09:28:33 +02:00
Mattes D c82facab1b Fixed skylight going down through transparent blocks. 2017-06-09 12:17:27 +02:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Mattes D 9da404ea2d Fixed a race condition between chunk loader and generator.
When using ChunkWorx to generate multiple chunks, the server would sometimes fail an assert because it would generate a chunk even when it was successfully loaded. This was caused by chunks queued in cWorld's m_SetChunkDataQueue and thus being marked as "InQueue" although they were already loaded.

Solved by adding a new parameter to chunk coord callbacks specifying whether the operation succeeded or failed, and using that instead of the chunk presence flag to decide whether to generate or not.
2015-10-04 14:06:37 +02:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Samuel Barney 804805d35a Silenced and fixed many warning messages across multiple files. 2015-07-29 09:49:30 -06:00
tycho 06a74e45e2 Made cLightingThread own its callbacks 2015-05-30 11:11:17 +01:00
tycho dae9e5792a Made -Weverything an error. 2015-05-24 12:56:56 +01:00
Kirill Kirilenko 3dc994f9dc Fixed CppCheck: (performance) Possible inefficient checking for emptiness. 2015-01-17 15:20:03 +03:00
Mattes D c8a49a6189 LightingThread: Fixed a memory leak. 2014-12-12 14:27:19 +01:00
Mattes D 563f41af65 Lighting thread: skip chunks that are already lit. 2014-12-10 22:27:48 +01:00
Tiger Wang a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Mattes D 64fec204c4 Added initializers for class members.
As reported by Coverity, these weren't initialized.
2014-08-21 22:39:53 +02:00
madmaxoft 2423fbf2ef Normalized comments.
This was mostly done automatically and then visually inspected for obvious errors.
All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
2014-07-17 22:15:34 +02:00
madmaxoft 993fd14ddf Fixed basic whitespace problems.
Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
2014-07-17 16:33:09 +02:00
madmaxoft d6979ad95d Fixed GCC compilation. 2014-06-16 22:53:08 +02:00
worktycho 4fddbf9dfc Merge pull request #883 from mc-server/CutOffLighting
Lighting reads blocktypes only for blocks under heightmap.
2014-06-16 17:37:07 +01:00
madmaxoft f7777e8c75 Added comments, reformatted code. 2014-05-29 18:25:08 +02:00
Tycho 024027db89 Renamed cChunkBuffer to cChunkData 2014-05-21 19:58:48 +01:00
Tycho d478e3cfb1 Merge branch 'master' into chunksparsing/structs
Conflicts:
	src/Chunk.h
2014-05-10 05:05:44 -07:00
Mattes D 56ad2c2124 Lighting thread disabled its chunkstays before deleting them. 2014-05-09 18:32:03 +02:00
Tycho 57b8ee9163 Merge branch 'master' into chunksparsing/structs
Conflicts:
	src/Chunk.cpp
	src/Chunk.h
2014-04-27 06:35:27 -07:00
Tycho e40f9d6e5b Implemented Chunk Sparsing with segments 2014-04-26 10:50:23 -07:00
madmaxoft 34cf058b02 ChunkStay must be disabled while being deleted.
Fixes #758.
2014-04-12 22:35:04 +02:00
madmaxoft 5bc5272a4e Fixed member construction order. 2014-04-12 00:24:35 +02:00
madmaxoft 8bcb176a19 Lighting reads blocktypes only for blocks under heightmap.
This should theoretically speed it up, since less data is copied back and forth.

Also implemented a possibly more cache-friendly blocklight starter algorithm (PrepareBlockLight2()), is disabled by default, needs perf testing.
2014-04-12 00:04:50 +02:00
Tycho 2eca30aebc Removed Some unnessicary macros 2014-03-10 11:34:20 -07:00
andrew d73cdba1f6 g_BlockXXX => cBlockInfo::XXX 2014-03-01 21:34:19 +02:00
madmaxoft 9cebc9157c Rewritten Lua ChunkStay API into a single function, cWorld:ChunkStay().
This fixes problems with indeterminate class object lifespan (Lua-GC) and forgetting to disable it or keep it until ready.
2014-02-10 22:47:10 +01:00
madmaxoft cf48968835 Moved a forgotten comment back to its place. 2014-02-08 22:35:45 +01:00
madmaxoft df0ecc6c07 Fixed lighting thread queueing. 2014-02-08 22:33:42 +01:00
madmaxoft ea71bfa9b6 Initial ChunkStay code. 2014-02-08 21:55:21 +01:00
madmaxoft 39a1bcdea0 More MSVC warning fixes. 2014-01-07 17:07:49 +01:00
Tycho Bickerstaff 8e7e990cfe fixed warnings in LightingThread.cpp 2013-12-31 09:16:43 +01:00
Tycho Bickerstaff 3da41de553 take Z axis into account when calculating neighboors in LightingThread::ChunkReady 2013-12-31 09:16:43 +01:00
Alexander Harkness 675b4aa878 Moved source to src 2013-11-24 14:19:41 +00:00