metaforce/Runtime/Character/CSegId.hpp

30 lines
714 B
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-09 23:19:17 +00:00
#include "Runtime/Streams/IOStreams.hpp"
#include "Runtime/RetroTypes.hpp"
2021-04-10 08:42:06 +00:00
namespace metaforce {
2018-12-08 05:30:43 +00:00
class CSegId {
u8 x0_segId = 0xFF;
2016-04-09 23:19:17 +00:00
public:
constexpr CSegId() noexcept = default;
constexpr CSegId(u8 id) noexcept : x0_segId(id) {}
2022-02-21 00:02:40 +00:00
explicit CSegId(CInputStream& in) : x0_segId(in.ReadLong()) {}
constexpr CSegId& operator++() noexcept {
2018-12-08 05:30:43 +00:00
++x0_segId;
return *this;
}
constexpr CSegId& operator--() noexcept {
2018-12-08 05:30:43 +00: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 23:19:17 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce