1
0
Commit Graph

92 Commits

Author SHA1 Message Date
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
Tiger Wang
68cced73af
BlockHandler initialisation is a constant expression (#4891)
* BlockHandler initialisation is a constant expression

If we can't make it all namespaces, this is the next best I guess.

+ Tag handlers constexpr, const as needed
+ Inherit constructors
* Privatise handler functions

* More constexpr

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-20 13:50:52 +00:00
Peter Bell
1123c95cf2 Enable C++17 in build 2020-05-09 20:37:16 +01:00
peterbell10
aac592f985
Manage block entity lifetime with unique_ptr (#4080) 2020-04-03 23:23:38 +02: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
221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes D
365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Mattes D
180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01: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
changyong guo
be1f06520c fix block area rotation bug (#4243)
fix mirror method bug in class cBlockArea.
2018-06-25 18:31:05 +02:00
peterbell10
d3c1c626f5
Deal with covered switches consistently (#4161)
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.

* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.

* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()
2018-02-04 23:07:12 +00:00
peterbell10
2df14a0496
cChunk and cChunkData: Use vectors for block get and set functions (#4172)
* cChunkData: Change interface to use Vector3i
* cChunk: Add Vector3i overloads for bounded block get and set functions.
2018-02-04 22:15:31 +00:00
peterbell10
463fa48aec cBlockArea: Fix performance regression (#4045) 2017-09-23 17:47:46 +01:00
peterbell10
e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
peterbell10
115bc5609a cBlockArea: change MakeIndex to return size_t 2017-09-11 23:20:12 +02:00
peterbell10
4a0355f065 cBlockArea: use unique_ptr 2017-09-11 23:20:12 +02:00
LogicParrot
49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10
496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
Lane Kolbly
7bdbfad1bb Changed int parameters to vector parameters in cCuboid and simulators (#3874) 2017-08-17 15:48:38 +02:00
Lukas Pioch
4691bc5a29 Removed double includes (#3885) 2017-08-02 19:57:20 +01:00
Mattes D
64561175ab BlockArea: Added the GetBounds function. 2017-07-22 19:57:25 +02:00
Lane Kolbly
6a261e451d Fixed check to see if block entity is in merge source. 2017-07-21 21:10:39 -05:00
Lane Kolbly
67e4bbde0c Made cBlockArea:cChunkReader AreaBounds inclusive on both sides. (#3842) 2017-07-10 11:10:06 +02:00
peterbell10
bd025e2bdb Fix cBlockArea assertion and mis-indexing (#3810) 2017-06-25 11:07:16 +02:00
peterbell10
f0f001c10d Fix cBlockArea null deref 2017-06-24 23:27:26 +02:00
Mattes D
fe42538349 cBlockArea supports block entities. (#3795) 2017-06-24 11:58:06 +02:00
Mattes D
cbff1378fd Fixed bindings for cBlockArea:Read and Write. (#3568)
The original bindings accepted nil as the World param, causing a crash.
2017-02-05 16:00:38 +01:00
Mattes D
e8fb85be88 Fix meta mirror (#3470) 2016-12-09 12:29:04 +01:00
Mattes D
d2e8643607 Fixed type-casting-related warnings. 2016-08-24 22:26:53 +02:00
LogicParrot
70e4214a2a Added compile.sh folder check warnings 2016-08-04 18:51:12 +03:00
LogicParrot
ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Mattes D
e4adf2f9ae Added detailed logging to cBlockArea::Read() bad Y coords.
Ref.: http://forum.mc-server.org/showthread.php?tid=2307
2016-01-12 10:19:44 +01:00
Mattes D
6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Mattes D
f6ab461383 BlockArea: Fixed a crash with areas higher than chunk height. 2015-06-30 14:08:21 +02:00
Mattes D
db863422b8 cBlockArea: Added CountSpecificBlocks() API function. 2015-06-08 21:52:13 +02:00
tycho
dae9e5792a Made -Weverything an error. 2015-05-24 12:56:56 +01:00
Mattes D
a3c4b7580b Added cBlockArea:CountNonAirBlocks API function. 2015-04-30 23:16:33 +02:00
Mattes D
ca90f6d280 Added cBlockArea::msSimpleCompare merge strategy. 2015-04-29 15:45:48 +02:00
Mattes D
fc95501f68 Added cBlockArea:GetNonAirCropRelCoords() API function.
Fixes #1915.
2015-04-29 15:14:22 +02:00
Tiger Wang
a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Mattes D
271c8c0d32 More template keyword fixes. 2014-08-28 16:58:48 +03: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
Howaner
905fed09a6 Fixed wrong types. (BLOCKTYPE -> NIBBLETYPE) 2014-07-13 00:51:42 +02:00
archshift
e8143de01b Nullify deleted pointers. 2014-06-19 01:49:56 -07:00
madmaxoft
ec0976f9b0 Fixed a crash when creating negative-size blockareas.
Now the server emits a warning instead and continues execution.
2014-06-09 00:49:02 +02:00
madmaxoft
b7dc4177d0 cBlockArea reading hotfix.
This should fix the crashes introduced with chunksparsing. Not the most performant solution, but at least it should work.
Ref.: #1056
2014-06-02 14:07:36 +02:00
madmaxoft
f7777e8c75 Added comments, reformatted code. 2014-05-29 18:25:08 +02:00
Tycho
8f964886e0 Implemented style changes 2014-05-24 13:33:40 +01:00