Introduce separate types for block/section/chunk indices

Newtypes are cumbersome in C++, so this is mostly documentation for now.

Also replace lots of questionable uses of size_t with int or types with
explicit width and add a few comments for constants.
This commit is contained in:
Matthias Schiffer 2021-11-17 12:25:26 +01:00
parent d4be401bcd
commit 457e993c92
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
13 changed files with 123 additions and 92 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-2-Clause
/*
Copyright (c) 2015, 2018, Matthias Schiffer <mschiffer@universe-factory.net>
Copyright (c) 2015-2021, Matthias Schiffer <mschiffer@universe-factory.net>
Copyright (c) 2019, Roman Shishkin <spark@uwtech.org>
All rights reserved.
*/
@ -9,7 +9,6 @@
#include "Biome.hpp"
#include "BlockType.hpp"
#include "../Util.hpp"
namespace MinedMap {
@ -42,7 +41,7 @@ FloatColor Biome::getFoliageColor(float temp, float rain) const {
}
FloatColor Biome::getBlockColor(const BlockType *type, unsigned height) const {
FloatColor Biome::getBlockColor(const BlockType *type, y_idx_t height) const {
FloatColor c = {
float(type->color.r),
float(type->color.g),

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-2-Clause
/*
Copyright (c) 2015, Matthias Schiffer <mschiffer@universe-factory.net>
Copyright (c) 2015-2021, Matthias Schiffer <mschiffer@universe-factory.net>
All rights reserved.
*/
@ -8,6 +8,7 @@
#pragma once
#include "Color.hpp"
#include "../Util.hpp"
namespace MinedMap {
@ -30,7 +31,7 @@ public:
Biome(float temp0, float rain0, FloatColor water0 = {0.247f, 0.463f, 0.894f})
: temp(temp0), rain(rain0), water(water0) {}
FloatColor getBlockColor(const BlockType *type, unsigned height) const;
FloatColor getBlockColor(const BlockType *type, y_idx_t height) const;
};
extern const Biome *const BIOME_DEFAULT;