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>
This commit is contained in:
12
src/Map.cpp
12
src/Map.cpp
@@ -3,14 +3,14 @@
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "Map.h"
|
||||
#include "BlockInfo.h"
|
||||
#include "World.h"
|
||||
#include "Blocks/BlockHandler.h"
|
||||
#include "Chunk.h"
|
||||
#include "ClientHandle.h"
|
||||
#include "Entities/Player.h"
|
||||
#include "FastRandom.h"
|
||||
#include "Blocks/BlockHandler.h"
|
||||
#include "ClientHandle.h"
|
||||
#include "Map.h"
|
||||
#include "World.h"
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
|
||||
auto Height = a_Chunk.GetHeight(RelX, RelZ);
|
||||
auto ChunkHeight = cChunkDef::Height;
|
||||
a_Chunk.GetBlockTypeMeta(RelX, Height, RelZ, TargetBlock, TargetMeta);
|
||||
auto ColourID = BlockHandler(TargetBlock)->GetMapBaseColourID(TargetMeta);
|
||||
auto ColourID = cBlockHandler::For(TargetBlock).GetMapBaseColourID(TargetMeta);
|
||||
|
||||
if (IsBlockWater(TargetBlock))
|
||||
{
|
||||
@@ -151,7 +151,7 @@ bool cMap::UpdatePixel(unsigned int a_X, unsigned int a_Z)
|
||||
}
|
||||
else if (ColourID == 0)
|
||||
{
|
||||
while (((--Height) != -1) && ((ColourID = BlockHandler(a_Chunk.GetBlock(RelX, Height, RelZ))->GetMapBaseColourID(a_Chunk.GetMeta(RelX, Height, RelZ))) == 0))
|
||||
while (((--Height) != -1) && ((ColourID = cBlockHandler::For(a_Chunk.GetBlock(RelX, Height, RelZ)).GetMapBaseColourID(a_Chunk.GetMeta(RelX, Height, RelZ))) == 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user