metaforce/Runtime/Character/CSegId.hpp

30 lines
701 B
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-09 23:19:17 +00:00
#include "Runtime/IOStreams.hpp"
#include "Runtime/RetroTypes.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
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) {}
explicit CSegId(CInputStream& in) : x0_segId(in.readUint32Big()) {}
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
};
2018-12-08 05:30:43 +00:00
} // namespace urde