make accessors const, add comments
This commit is contained in:
parent
2e3d33dfcd
commit
bcd55626ef
@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef TRAVEL_MODE_H
|
#ifndef TRAVEL_MODE_H
|
||||||
#define TRAVEL_MODE_H
|
#define TRAVEL_MODE_H
|
||||||
|
|
||||||
typedef unsigned char TravelMode;
|
using TravelMode = unsigned char;
|
||||||
static const TravelMode TRAVEL_MODE_INACCESSIBLE = 0;
|
static const TravelMode TRAVEL_MODE_INACCESSIBLE = 0;
|
||||||
static const TravelMode TRAVEL_MODE_DEFAULT = 1;
|
static const TravelMode TRAVEL_MODE_DEFAULT = 1;
|
||||||
|
|
||||||
|
@ -62,6 +62,9 @@ struct ExtractionWay
|
|||||||
bidirectional,
|
bidirectional,
|
||||||
opposite };
|
opposite };
|
||||||
|
|
||||||
|
// These accessor methods exists to support the depreciated "way.direction" access
|
||||||
|
// in LUA. Since the direction attribute was removed from ExtractionWay, the
|
||||||
|
// accessors translate to/from the mode attributes.
|
||||||
inline void set_direction(const Directions m)
|
inline void set_direction(const Directions m)
|
||||||
{
|
{
|
||||||
if (Directions::oneway == m)
|
if (Directions::oneway == m)
|
||||||
@ -81,7 +84,7 @@ struct ExtractionWay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Directions get_direction()
|
inline const Directions get_direction() const
|
||||||
{
|
{
|
||||||
if (TRAVEL_MODE_INACCESSIBLE != forward_travel_mode && TRAVEL_MODE_INACCESSIBLE != backward_travel_mode)
|
if (TRAVEL_MODE_INACCESSIBLE != forward_travel_mode && TRAVEL_MODE_INACCESSIBLE != backward_travel_mode)
|
||||||
{
|
{
|
||||||
@ -101,10 +104,12 @@ struct ExtractionWay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These accessors exists because it's not possible to take the address of a bitfield,
|
||||||
|
// and LUA therefore cannot read/write the mode attributes directly.
|
||||||
inline void set_forward_mode(const TravelMode m) { forward_travel_mode = m; }
|
inline void set_forward_mode(const TravelMode m) { forward_travel_mode = m; }
|
||||||
inline const TravelMode get_forward_mode() { return forward_travel_mode; }
|
inline const TravelMode get_forward_mode() const { return forward_travel_mode; }
|
||||||
inline void set_backward_mode(const TravelMode m) { backward_travel_mode = m; }
|
inline void set_backward_mode(const TravelMode m) { backward_travel_mode = m; }
|
||||||
inline const TravelMode get_backward_mode() { return backward_travel_mode; }
|
inline const TravelMode get_backward_mode() const { return backward_travel_mode; }
|
||||||
|
|
||||||
unsigned id;
|
unsigned id;
|
||||||
unsigned nameID;
|
unsigned nameID;
|
||||||
|
Loading…
Reference in New Issue
Block a user