X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fapp.cpp;h=367f3c21bc2e0bc175d2554d1d428616b7ac6fc1;hb=ba55bf4293f3abc742eef710545a4b207ba2c820;hp=eb3dac1b8b4aa0eedcbd3456981a8554c408ebfa;hpb=3a487f44c26f9bb9d1a1c831406b6497b2b3b425;p=blank.git diff --git a/src/app/app.cpp b/src/app/app.cpp index eb3dac1..367f3c2 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -313,7 +313,12 @@ CuboidBounds slab_shape({{ -0.5f, -0.5f, -0.5f }, { 0.5f, 0.0f, 0.5f }}); } -void AssetLoader::LoadBlockTypes(const string &set_name, BlockTypeRegistry ®, TextureIndex &tex_index) const { +void AssetLoader::LoadBlockTypes( + const string &set_name, + BlockTypeRegistry ®, + TextureIndex &tex_index, + const ShapeRegistry &shapes +) const { string full = data + set_name + ".types"; std::ifstream file(full); if (!file) { @@ -395,20 +400,12 @@ void AssetLoader::LoadBlockTypes(const string &set_name, BlockTypeRegistry ®, type.commonness = in.GetFloat(); } else if (name == "shape") { in.ReadIdentifier(shape_name); - if (shape_name == "block") { - type.shape = &block_shape; - type.fill = { true, true, true, true, true, true }; - } else if (shape_name == "slab") { - type.shape = &slab_shape; - type.fill = { false, true, false, false, false, false }; - } else if (shape_name == "stair") { - type.shape = &stair_shape; - type.fill = { false, true, false, false, false, true }; - } else { - throw runtime_error("unknown block shape: " + shape_name); - } + type.shape = &shapes.Get(shape_name); } else { - throw runtime_error("unknown block property: " + name); + std::cerr << "warning: unknown block type property " << name << std::endl; + while (in.Peek().type != Token::SEMICOLON) { + in.Next(); + } } in.Skip(Token::SEMICOLON); }