Rename PathElement::Edges for clarity

PathElement::Edges actualy stores both 'edges' (in the lower 4 bits) and 'corners' in the upper four. Rename the variable to make this dual usage easier to see.
This commit is contained in:
Richard Fine 2020-09-07 13:21:19 -04:00
parent 4e6935f689
commit 4d3ba7a6f0
2 changed files with 9 additions and 9 deletions

View File

@ -2219,34 +2219,34 @@ void PathElement::SetAdditionStatus(uint8_t newStatus)
uint8_t PathElement::GetEdges() const uint8_t PathElement::GetEdges() const
{ {
return Edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK; return EdgesAndCorners & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
} }
void PathElement::SetEdges(uint8_t newEdges) void PathElement::SetEdges(uint8_t newEdges)
{ {
Edges &= ~FOOTPATH_PROPERTIES_EDGES_EDGES_MASK; EdgesAndCorners &= ~FOOTPATH_PROPERTIES_EDGES_EDGES_MASK;
Edges |= (newEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK); EdgesAndCorners |= (newEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK);
} }
uint8_t PathElement::GetCorners() const uint8_t PathElement::GetCorners() const
{ {
return Edges >> 4; return EdgesAndCorners >> 4;
} }
void PathElement::SetCorners(uint8_t newCorners) void PathElement::SetCorners(uint8_t newCorners)
{ {
Edges &= ~FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK; EdgesAndCorners &= ~FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK;
Edges |= (newCorners << 4); EdgesAndCorners |= (newCorners << 4);
} }
uint8_t PathElement::GetEdgesAndCorners() const uint8_t PathElement::GetEdgesAndCorners() const
{ {
return Edges; return EdgesAndCorners;
} }
void PathElement::SetEdgesAndCorners(uint8_t newEdgesAndCorners) void PathElement::SetEdgesAndCorners(uint8_t newEdgesAndCorners)
{ {
Edges = newEdgesAndCorners; EdgesAndCorners = newEdgesAndCorners;
} }
bool PathElement::IsLevelCrossing(const CoordsXY& coords) const bool PathElement::IsLevelCrossing(const CoordsXY& coords) const

View File

@ -203,7 +203,7 @@ private:
PathRailingsIndex RailingsIndex; // 6 PathRailingsIndex RailingsIndex; // 6
#pragma clang diagnostic pop #pragma clang diagnostic pop
uint8_t Additions; // 7 (0 means no addition) uint8_t Additions; // 7 (0 means no addition)
uint8_t Edges; // 8 uint8_t EdgesAndCorners;// 8 (edges in lower 4 bits, corners in upper 4)
uint8_t Flags2; // 9 uint8_t Flags2; // 9
uint8_t SlopeDirection; // 10 uint8_t SlopeDirection; // 10
union union