metaforce/Runtime/Character/CSegId.hpp

30 lines
715 B
C++
Raw Normal View History

2018-10-06 20:42:33 -07:00
#pragma once
2016-04-09 16:19:17 -07:00
#include "Runtime/Streams/IOStreams.hpp"
#include "Runtime/RetroTypes.hpp"
2021-04-10 01:42:06 -07:00
namespace metaforce {
2018-12-07 21:30:43 -08:00
class CSegId {
u8 x0_segId = 0xFF;
2016-04-09 16:19:17 -07:00
public:
constexpr CSegId() noexcept = default;
constexpr CSegId(u8 id) noexcept : x0_segId(id) {}
explicit CSegId(CInputStream& in) : x0_segId(in.ReadUint8()) {}
constexpr CSegId& operator++() noexcept {
2018-12-07 21:30:43 -08:00
++x0_segId;
return *this;
}
constexpr CSegId& operator--() noexcept {
2018-12-07 21:30:43 -08:00
--x0_segId;
return *this;
}
constexpr operator u8() const noexcept { return x0_segId; }
constexpr bool IsValid() const noexcept { return !IsInvalid(); }
constexpr bool IsInvalid() const noexcept { return x0_segId == 0xFF; }
2016-04-09 16:19:17 -07:00
};
2021-04-10 01:42:06 -07:00
} // namespace metaforce