Skip to content

Commit

Permalink
Fix MSVC compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-johansson committed Oct 28, 2023
1 parent 7eafd17 commit 5e059bc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
1 change: 0 additions & 1 deletion modules/core/inc/tactile/core/debug/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#pragma once

#include <exception> // exception
#include <utility> // move

#include "tactile/core/api.hpp"
#include "tactile/core/container/string.hpp"
Expand Down
4 changes: 2 additions & 2 deletions modules/core/inc/tactile/core/io/ir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
1 change: 1 addition & 0 deletions modules/core/src/tactile/core/debug/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "tactile/core/debug/error.hpp"

#include <sstream> // stringstream
#include <utility> // move

#include <boost/stacktrace.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<JSON> { return std::move(embedded_tileset_json); });
.and_then([&]() -> Result<JSON> { return std::move(embedded_tileset_json); });
}

auto emit_external_tileset(const ir::TilesetRef& tileset_ref,
Expand All @@ -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<void> {
.and_then([&] {
const StreamToFileOptions stream_options {
.indentation = options.use_indentation ? 2 : 0,
.binary_mode = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inline const HashMap<StringView, LayerType> kLayerTypeNames = {
auto _parse_layer_type(const JSON& layer_json, LayerType& layer_type) -> Result<void>
{
String type_name {};
return parse(layer_json, "type", type_name).and_then([&] -> Result<void> {
return parse(layer_json, "type", type_name).and_then([&]() -> Result<void> {
if (const auto* found_type = find_in(kLayerTypeNames, type_name)) {
layer_type = *found_type;
return kSuccess;
Expand All @@ -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<void> {
.and_then([&]() -> Result<void> {
if (encoding_name == "csv") {
tile_format.encoding = TileEncoding::kPlainText;
}
Expand All @@ -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<void> {
.and_then([&]() -> Result<void> {
if (compression_name.empty()) {
tile_format.compression = CompressionMode::kNone;
}
Expand Down Expand Up @@ -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<TileMatrix> {
.and_then([&]() -> Result<TileMatrix> {
const MatrixExtent layer_extent {static_cast<usize>(layer.height),
static_cast<usize>(layer.width)};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
.and_then([&]() -> Result<void> {
if (orientation != "orthogonal") {
return error(SaveFormatError::kUnsupportedOrientation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace {
auto _parse_string_value(const JSON& json, Attribute& value) -> Result<void>
{
Attribute::string_type str {};
return parse(json, "value", str).and_then([&] -> Result<void> {
return parse(json, "value", str).and_then([&] {
value = std::move(str);
return kSuccess;
});
Expand All @@ -27,7 +27,7 @@ auto _parse_string_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_int_value(const JSON& json, Attribute& value) -> Result<void>
{
Attribute::int_type integer {};
return parse(json, "value", integer).and_then([&] -> Result<void> {
return parse(json, "value", integer).and_then([&] {
value = integer;
return kSuccess;
});
Expand All @@ -37,7 +37,7 @@ auto _parse_int_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_float_value(const JSON& json, Attribute& value) -> Result<void>
{
Attribute::float_type real {};
return parse(json, "value", real).and_then([&] -> Result<void> {
return parse(json, "value", real).and_then([&] {
value = real;
return kSuccess;
});
Expand All @@ -47,7 +47,7 @@ auto _parse_float_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_bool_value(const JSON& json, Attribute& value) -> Result<void>
{
bool boolean {};
return parse(json, "value", boolean).and_then([&] -> Result<void> {
return parse(json, "value", boolean).and_then([&] {
value = boolean;
return kSuccess;
});
Expand All @@ -57,7 +57,7 @@ auto _parse_bool_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_path_value(const JSON& json, Attribute& value) -> Result<void>
{
Attribute::string_type path {};
return parse(json, "value", path).and_then([&] -> Result<void> {
return parse(json, "value", path).and_then([&] {
value = Attribute::path_type {std::move(path)};
return kSuccess;
});
Expand All @@ -67,7 +67,7 @@ auto _parse_path_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_color_value(const JSON& json, Attribute& value) -> Result<void>
{
String color_code {};
return parse(json, "value", color_code).and_then([&] -> Result<void> {
return parse(json, "value", color_code).and_then([&]() -> Result<void> {
// Empty color properties are not supported, so just assume the default color value.
if (color_code.empty()) {
TACTILE_LOG_WARN(
Expand All @@ -92,7 +92,7 @@ auto _parse_color_value(const JSON& json, Attribute& value) -> Result<void>
auto _parse_object_ref_value(const JSON& json, Attribute& value) -> Result<void>
{
int32 object_ref {};
return parse(json, "value", object_ref).and_then([&] -> Result<void> {
return parse(json, "value", object_ref).and_then([&] {
value = ObjectRef {object_ref};
return kSuccess;
});
Expand Down Expand Up @@ -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<void>
{
String type_name {};
return parse(json, "type", type_name).and_then([&] -> Result<void> {
return parse(json, "type", type_name).and_then([&]() -> Result<void> {
if (const auto attribute_type = parse_attribute_type(type_name)) {
out_type = *attribute_type;
return kSuccess;
Expand Down Expand Up @@ -174,4 +174,4 @@ auto parse_metadata(const JSON& json, ir::Metadata& meta) -> Result<void>
return kSuccess;
}

} // namespace tactile
} // namespace tactile::tmj
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
.and_then([&]() -> Result<void> {
// TODO make it possible to recover from missing tileset images
if (options.strict_mode &&
!std::filesystem::exists(options.base_dir / relative_image_path)) {
Expand Down

0 comments on commit 5e059bc

Please sign in to comment.