diff --git a/modules/core/inc/tactile/core/debug/error.hpp b/modules/core/inc/tactile/core/debug/error.hpp index b40c49b67b..1517de6dc8 100644 --- a/modules/core/inc/tactile/core/debug/error.hpp +++ b/modules/core/inc/tactile/core/debug/error.hpp @@ -3,7 +3,6 @@ #pragma once #include // exception -#include // move #include "tactile/core/api.hpp" #include "tactile/core/container/string.hpp" diff --git a/modules/core/inc/tactile/core/io/ir.hpp b/modules/core/inc/tactile/core/io/ir.hpp index 36517c514c..663f1aed74 100644 --- a/modules/core/inc/tactile/core/io/ir.hpp +++ b/modules/core/inc/tactile/core/io/ir.hpp @@ -98,8 +98,8 @@ struct Layer final { * \brief Intermediate representation of a frame in a tile animation. */ struct AnimationFrame final { - int32 tile_index; ///< The index of the rendered tile in the associated tileset. - uint64 duration_ms; ///< The duration that the frame is shown in milliseconds. + TileIndex tile_index; ///< The index of the rendered tile in the associated tileset. + uint64 duration_ms; ///< The duration that the frame is shown in milliseconds. [[nodiscard]] auto operator==(const AnimationFrame&) const -> bool = default; }; diff --git a/modules/core/src/tactile/core/debug/error.cpp b/modules/core/src/tactile/core/debug/error.cpp index cb65ee72f4..85d2c36ede 100644 --- a/modules/core/src/tactile/core/debug/error.cpp +++ b/modules/core/src/tactile/core/debug/error.cpp @@ -3,6 +3,7 @@ #include "tactile/core/debug/error.hpp" #include // stringstream +#include // move #include diff --git a/modules/tmj-format/src/tactile/tmj-format/emit/tmj_tileset_emitter.cpp b/modules/tmj-format/src/tactile/tmj-format/emit/tmj_tileset_emitter.cpp index 7b3aceca2a..13d66fda52 100644 --- a/modules/tmj-format/src/tactile/tmj-format/emit/tmj_tileset_emitter.cpp +++ b/modules/tmj-format/src/tactile/tmj-format/emit/tmj_tileset_emitter.cpp @@ -69,7 +69,7 @@ auto emit_embedded_tileset(const ir::Tileset& tileset, embedded_tileset_json["firstgid"] = first_tile_id; return _add_common_tileset_attributes(tileset, options, embedded_tileset_json) - .and_then([&] -> Result { return std::move(embedded_tileset_json); }); + .and_then([&]() -> Result { return std::move(embedded_tileset_json); }); } auto emit_external_tileset(const ir::TilesetRef& tileset_ref, @@ -95,7 +95,7 @@ auto emit_tileset_ref(const ir::TilesetRef& tileset_ref, return _add_common_tileset_attributes(tileset_ref.tileset, options, external_tileset_json) - .and_then([&] -> Result { + .and_then([&] { const StreamToFileOptions stream_options { .indentation = options.use_indentation ? 2 : 0, .binary_mode = false, diff --git a/modules/tmj-format/src/tactile/tmj-format/load/tmj_layer_parser.cpp b/modules/tmj-format/src/tactile/tmj-format/load/tmj_layer_parser.cpp index 740f359d58..8d77fc6402 100644 --- a/modules/tmj-format/src/tactile/tmj-format/load/tmj_layer_parser.cpp +++ b/modules/tmj-format/src/tactile/tmj-format/load/tmj_layer_parser.cpp @@ -26,7 +26,7 @@ inline const HashMap kLayerTypeNames = { auto _parse_layer_type(const JSON& layer_json, LayerType& layer_type) -> Result { String type_name {}; - return parse(layer_json, "type", type_name).and_then([&] -> Result { + return parse(layer_json, "type", type_name).and_then([&]() -> Result { if (const auto* found_type = find_in(kLayerTypeNames, type_name)) { layer_type = *found_type; return kSuccess; @@ -42,7 +42,7 @@ auto _parse_tile_encoding(const JSON& layer_json, ir::TileFormat& tile_format) { String encoding_name {}; return parse(layer_json, "encoding", encoding_name, "csv") - .and_then([&] -> Result { + .and_then([&]() -> Result { if (encoding_name == "csv") { tile_format.encoding = TileEncoding::kPlainText; } @@ -65,7 +65,7 @@ auto _parse_compression_mode(const JSON& layer_json, ir::TileFormat& tile_format { String compression_name {}; return parse(layer_json, "compression", compression_name) // - .and_then([&] -> Result { + .and_then([&]() -> Result { if (compression_name.empty()) { tile_format.compression = CompressionMode::kNone; } @@ -130,7 +130,7 @@ auto _parse_tile_layer_data(const JSON& layer_json, .and_then([&] { return parse(layer_json, "width", layer.width); }) .and_then([&] { return parse(layer_json, "height", layer.height); }) .and_then([&] { return parse(layer_json, "data", tile_data_json); }) - .and_then([&] -> Result { + .and_then([&]() -> Result { const MatrixExtent layer_extent {static_cast(layer.height), static_cast(layer.width)}; diff --git a/modules/tmj-format/src/tactile/tmj-format/load/tmj_map_parser.cpp b/modules/tmj-format/src/tactile/tmj-format/load/tmj_map_parser.cpp index 7023d1edf9..123b89612b 100644 --- a/modules/tmj-format/src/tactile/tmj-format/load/tmj_map_parser.cpp +++ b/modules/tmj-format/src/tactile/tmj-format/load/tmj_map_parser.cpp @@ -19,7 +19,7 @@ auto parse_map(const JSON& json, String filename, const SaveFormatReadOptions& o String orientation {}; return parse(json, "orientation", orientation) - .and_then([&] -> Result { + .and_then([&]() -> Result { if (orientation != "orthogonal") { return error(SaveFormatError::kUnsupportedOrientation); } diff --git a/modules/tmj-format/src/tactile/tmj-format/load/tmj_meta_parser.cpp b/modules/tmj-format/src/tactile/tmj-format/load/tmj_meta_parser.cpp index 3380941b48..27789698aa 100644 --- a/modules/tmj-format/src/tactile/tmj-format/load/tmj_meta_parser.cpp +++ b/modules/tmj-format/src/tactile/tmj-format/load/tmj_meta_parser.cpp @@ -17,7 +17,7 @@ namespace { auto _parse_string_value(const JSON& json, Attribute& value) -> Result { Attribute::string_type str {}; - return parse(json, "value", str).and_then([&] -> Result { + return parse(json, "value", str).and_then([&] { value = std::move(str); return kSuccess; }); @@ -27,7 +27,7 @@ auto _parse_string_value(const JSON& json, Attribute& value) -> Result auto _parse_int_value(const JSON& json, Attribute& value) -> Result { Attribute::int_type integer {}; - return parse(json, "value", integer).and_then([&] -> Result { + return parse(json, "value", integer).and_then([&] { value = integer; return kSuccess; }); @@ -37,7 +37,7 @@ auto _parse_int_value(const JSON& json, Attribute& value) -> Result auto _parse_float_value(const JSON& json, Attribute& value) -> Result { Attribute::float_type real {}; - return parse(json, "value", real).and_then([&] -> Result { + return parse(json, "value", real).and_then([&] { value = real; return kSuccess; }); @@ -47,7 +47,7 @@ auto _parse_float_value(const JSON& json, Attribute& value) -> Result auto _parse_bool_value(const JSON& json, Attribute& value) -> Result { bool boolean {}; - return parse(json, "value", boolean).and_then([&] -> Result { + return parse(json, "value", boolean).and_then([&] { value = boolean; return kSuccess; }); @@ -57,7 +57,7 @@ auto _parse_bool_value(const JSON& json, Attribute& value) -> Result auto _parse_path_value(const JSON& json, Attribute& value) -> Result { Attribute::string_type path {}; - return parse(json, "value", path).and_then([&] -> Result { + return parse(json, "value", path).and_then([&] { value = Attribute::path_type {std::move(path)}; return kSuccess; }); @@ -67,7 +67,7 @@ auto _parse_path_value(const JSON& json, Attribute& value) -> Result auto _parse_color_value(const JSON& json, Attribute& value) -> Result { String color_code {}; - return parse(json, "value", color_code).and_then([&] -> Result { + return parse(json, "value", color_code).and_then([&]() -> Result { // Empty color properties are not supported, so just assume the default color value. if (color_code.empty()) { TACTILE_LOG_WARN( @@ -92,7 +92,7 @@ auto _parse_color_value(const JSON& json, Attribute& value) -> Result auto _parse_object_ref_value(const JSON& json, Attribute& value) -> Result { int32 object_ref {}; - return parse(json, "value", object_ref).and_then([&] -> Result { + return parse(json, "value", object_ref).and_then([&] { value = ObjectRef {object_ref}; return kSuccess; }); @@ -125,7 +125,7 @@ auto _parse_property_value(const JSON& json, const AttributeType type, Attribute auto _parse_property_type(const JSON& json, AttributeType& out_type) -> Result { String type_name {}; - return parse(json, "type", type_name).and_then([&] -> Result { + return parse(json, "type", type_name).and_then([&]() -> Result { if (const auto attribute_type = parse_attribute_type(type_name)) { out_type = *attribute_type; return kSuccess; @@ -174,4 +174,4 @@ auto parse_metadata(const JSON& json, ir::Metadata& meta) -> Result return kSuccess; } -} // namespace tactile +} // namespace tactile::tmj diff --git a/modules/tmj-format/src/tactile/tmj-format/load/tmj_tileset_parser.cpp b/modules/tmj-format/src/tactile/tmj-format/load/tmj_tileset_parser.cpp index 58bc8dec98..0fd6bb1294 100644 --- a/modules/tmj-format/src/tactile/tmj-format/load/tmj_tileset_parser.cpp +++ b/modules/tmj-format/src/tactile/tmj-format/load/tmj_tileset_parser.cpp @@ -113,7 +113,7 @@ auto parse_tileset(const JSON& json, const SaveFormatReadOptions& options) .and_then([&] { return parse(json, "imagewidth", tileset.image_width); }) .and_then([&] { return parse(json, "imageheight", tileset.image_height); }) .and_then([&] { return parse(json, "image", relative_image_path); }) - .and_then([&] -> Result { + .and_then([&]() -> Result { // TODO make it possible to recover from missing tileset images if (options.strict_mode && !std::filesystem::exists(options.base_dir / relative_image_path)) {