Skip to content

Commit

Permalink
Change direction rotation syntax to not be confused with variable sub…
Browse files Browse the repository at this point in the history
…stitution
  • Loading branch information
CelticMinstrel committed Sep 19, 2015
1 parent 4ca0aeb commit 34b0a9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/map_location.cpp
Expand Up @@ -73,9 +73,9 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
return NDIRECTIONS;
}

// Syntax: [-] (n|ne|se|s|sw|nw) [.cw|.ccw]
// Syntax: [-] (n|ne|se|s|sw|nw) [:cw|:ccw]
// - means "take opposite direction" and has higher precedence
// .cw and .ccw mean "one step (counter-)clockwise"
// :cw and :ccw mean "one step (counter-)clockwise"
// Parentheses can be used for grouping or to apply an operator more than once

const size_t open = str.find_first_of('('), close = str.find_last_of(')');
Expand All @@ -88,7 +88,7 @@ map_location::DIRECTION map_location::parse_direction(const std::string& str)
}

const size_t start = str[0] == '-' ? 1 : 0;
const size_t end = str.find_first_of('.');
const size_t end = str.find_first_of(':');
const std::string& main_dir = str.substr(start, end - start);
map_location::DIRECTION dir;

Expand Down

0 comments on commit 34b0a9c

Please sign in to comment.