mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
fix generator loading
This commit is contained in:
parent
259f40d5cf
commit
3eec97f631
2 changed files with 5 additions and 5 deletions
|
|
@ -29,7 +29,7 @@ void LuaHeightmap::setSeed(int64_t seed) {
|
||||||
|
|
||||||
static int l_dump(lua::State* L) {
|
static int l_dump(lua::State* L) {
|
||||||
if (auto heightmap = touserdata<LuaHeightmap>(L, 1)) {
|
if (auto heightmap = touserdata<LuaHeightmap>(L, 1)) {
|
||||||
auto filename = tostring(L, 2);
|
auto filename = require_string(L, 2);
|
||||||
if (!files::is_valid_name(filename)) {
|
if (!files::is_valid_name(filename)) {
|
||||||
throw std::runtime_error("invalid file name");
|
throw std::runtime_error("invalid file name");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static BlocksLayer load_layer(
|
static BlocksLayer load_layer(
|
||||||
const dynamic::Map_sptr& map, int idx, uint& lastLayersHeight, bool& hasResizeableLayer
|
const dynamic::Map_sptr& map, uint& lastLayersHeight, bool& hasResizeableLayer
|
||||||
) {
|
) {
|
||||||
auto name = map->get<std::string>("block");
|
auto name = map->get<std::string>("block");
|
||||||
int height = map->get<integer_t>("height");
|
int height = map->get<integer_t>("height");
|
||||||
|
|
@ -134,7 +134,7 @@ static inline BlocksLayers load_layers(
|
||||||
const auto& layerMap = layersArr->map(i);
|
const auto& layerMap = layersArr->map(i);
|
||||||
try {
|
try {
|
||||||
layers.push_back(
|
layers.push_back(
|
||||||
load_layer(layerMap, -1, lastLayersHeight, hasResizeableLayer));
|
load_layer(layerMap, lastLayersHeight, hasResizeableLayer));
|
||||||
} catch (const std::runtime_error& err) {
|
} catch (const std::runtime_error& err) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
fieldname+" #"+std::to_string(i)+": "+err.what());
|
fieldname+" #"+std::to_string(i)+": "+err.what());
|
||||||
|
|
@ -214,8 +214,8 @@ std::unique_ptr<GeneratorScript> scripting::load_generator(
|
||||||
|
|
||||||
auto root = std::get<dynamic::Map_sptr>(val);
|
auto root = std::get<dynamic::Map_sptr>(val);
|
||||||
|
|
||||||
uint biomeParameters = lua::get_integer_field(L, "biome_parameters", 0, 0, 16);
|
uint biomeParameters = root->get<integer_t>("biome_parameters");
|
||||||
uint seaLevel = lua::get_integer_field(L, "sea_level", 0, 0, CHUNK_H);
|
uint seaLevel = root->get<integer_t>("sea_level");
|
||||||
|
|
||||||
std::vector<Biome> biomes;
|
std::vector<Biome> biomes;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue