Skip to content

Commit

Permalink
Fix error message and build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Oct 7, 2023
1 parent e7b7326 commit 46ab19f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/supertux/autotile_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,22 +181,24 @@ AutotileParser::parse_autotile(const ReaderMapping& reader, bool corner)
void
AutotileParser::parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid)
{
parse_mask(mask, autotile_masks, solid, 8);
parse_mask(mask, autotile_masks, solid, false);
}

void
AutotileParser::parse_mask_corner(std::string mask, std::vector<AutotileMask>& autotile_masks)
{
parse_mask(mask, autotile_masks, true, 4);
parse_mask(mask, autotile_masks, true, true);
}

void
AutotileParser::parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid, int mask_size)
AutotileParser::parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid, bool is_corner)
{
size_t mask_size = is_corner ? 4 : 8;
if (mask.size() != mask_size)
{
std::ostringstream msg;
msg << "Autotile config : mask isn't exactly " << mask_size << " characters.";
msg << is_corner ? "Autotile config : corner-based mask isn't exactly 4 characters." :
"Autotile config : mask isn't exactly 8 characters.";
throw std::runtime_error(msg.str());
}

Expand Down
2 changes: 1 addition & 1 deletion src/supertux/autotile_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AutotileParser final
Autotile* parse_autotile(const ReaderMapping& reader, bool corner);
void parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid);
void parse_mask_corner(std::string mask, std::vector<AutotileMask>& autotile_masks);
void parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid, int mask_size);
void parse_mask(std::string mask, std::vector<AutotileMask>& autotile_masks, bool solid, bool is_corner);

private:
AutotileParser(const AutotileParser&) = delete;
Expand Down

0 comments on commit 46ab19f

Please sign in to comment.