Fixed namespacing issues. Added spaceship to Flag and RefrFlag. Codegen needs to be updated to reflect changes.
This commit is contained in:
@@ -25,16 +25,16 @@ class RecordNode;
|
||||
|
||||
// This is defined by the file spec, do not change unless the file spec changes.
|
||||
enum class GroupType : int32_t {
|
||||
Top = 0,
|
||||
WorldChildren = 1,
|
||||
InteriorCellBlock = 2,
|
||||
InteriorCellSubBlock = 3,
|
||||
ExteriorCellBlock = 4,
|
||||
ExteriorCellSubBlock = 5,
|
||||
CellChildren = 6,
|
||||
TopicChildren = 7,
|
||||
Top = 0,
|
||||
WorldChildren = 1,
|
||||
InteriorCellBlock = 2,
|
||||
InteriorCellSubBlock = 3,
|
||||
ExteriorCellBlock = 4,
|
||||
ExteriorCellSubBlock = 5,
|
||||
CellChildren = 6,
|
||||
TopicChildren = 7,
|
||||
CellPersistentChildren = 8,
|
||||
CellTemporaryChildren = 9,
|
||||
CellTemporaryChildren = 9,
|
||||
};
|
||||
|
||||
enum class RecordType {
|
||||
@@ -62,24 +62,26 @@ using Node = std::variant<GroupNode, RecordNode>;
|
||||
// Aggregate types
|
||||
//
|
||||
|
||||
struct FourCC : utility::Store<uint32_t> {
|
||||
struct FourCC : utility::Store<uint32_t> {
|
||||
constexpr FourCC() noexcept = default;
|
||||
explicit constexpr FourCC(const char (&str)[5]) noexcept : Store{ utility::fourcc_lit_to_val(str) } { }
|
||||
explicit constexpr FourCC(const char(&str)[5]) noexcept : Store{ utility::fourcc_lit_to_val(str) } { }
|
||||
};
|
||||
static_assert(std::is_trivial_v<FourCC>);
|
||||
|
||||
struct FormID : utility::Store<uint32_t> { };
|
||||
struct Timestamp : utility::Store<uint16_t> { };
|
||||
struct VCInfo : utility::Store<uint16_t> { };
|
||||
struct FormID : utility::Store<uint32_t> { };
|
||||
struct Timestamp : utility::Store<uint16_t> { };
|
||||
struct VCInfo : utility::Store<uint16_t> { };
|
||||
|
||||
struct Flag {
|
||||
RecordType type;
|
||||
unsigned bit;
|
||||
friend constexpr auto operator<=>(const Flag &, const Flag &) noexcept = default;
|
||||
};
|
||||
|
||||
struct RefrFlag {
|
||||
RecordType refr_type;
|
||||
unsigned bit;
|
||||
friend constexpr auto operator<=>(const RefrFlag &, const RefrFlag &) noexcept = default;
|
||||
};
|
||||
|
||||
struct GroupHeader {
|
||||
@@ -87,13 +89,13 @@ struct GroupHeader {
|
||||
int16_t y, x;
|
||||
};
|
||||
|
||||
struct TopType : utility::Store<FourCC> { };
|
||||
struct ParentWorld : utility::Store<FormID> { };
|
||||
struct BlockNumber : utility::Store<int32_t> { };
|
||||
struct TopType : utility::Store<FourCC> { };
|
||||
struct ParentWorld : utility::Store<FormID> { };
|
||||
struct BlockNumber : utility::Store<int32_t> { };
|
||||
struct SubBlockNumber : utility::Store<int32_t> { };
|
||||
struct BlockCoord : utility::Store<Coord> { };
|
||||
struct SubBlockCoord : utility::Store<Coord> { };
|
||||
struct ParentCell : utility::Store<FormID> { };
|
||||
struct BlockCoord : utility::Store<Coord> { };
|
||||
struct SubBlockCoord : utility::Store<Coord> { };
|
||||
struct ParentCell : utility::Store<FormID> { };
|
||||
struct ParentDialogue : utility::Store<FormID> { };
|
||||
|
||||
union GroupLabel {
|
||||
@@ -118,7 +120,7 @@ struct GroupHeader {
|
||||
static_assert(sizeof(GroupHeader) == 24);
|
||||
|
||||
struct RecordHeader {
|
||||
struct Flags : utility::Store<uint32_t> { };
|
||||
struct Flags : utility::Store<uint32_t> { };
|
||||
struct Version : utility::Store<uint16_t> { };
|
||||
|
||||
RecordType type;
|
||||
@@ -152,12 +154,13 @@ private:
|
||||
// Free functions
|
||||
//
|
||||
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> esxr_lut::group_type_to_name(GroupType group_type) noexcept;
|
||||
[[nodiscard]] constexpr std::optional<FourCC> esxr_lut::record_type_to_fourcc(RecordType record_type) noexcept;
|
||||
[[nodiscard]] constexpr std::optional<RecordType> esxr_lut::fourcc_to_record_type(FourCC fourcc) noexcept;
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> esxr_lut::record_type_to_name(RecordType record_type) noexcept;
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> esxr_lut::flag_to_description(Flag flag) noexcept;
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> esxr_lut::refr_flag_to_description(RefrFlag refr_flag) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<std::string_view> group_type_to_name(GroupType group_type) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<FourCC> record_type_to_fourcc(RecordType record_type) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<RecordType> fourcc_to_record_type(FourCC fourcc) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<std::string_view> record_type_to_name(RecordType record_type) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<std::string_view> flag_to_description(Flag flag) noexcept;
|
||||
[[nodiscard]] extern constexpr std::optional<std::string_view> refr_flag_to_description(RefrFlag refr_flag) noexcept;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
using namespace esxr;
|
||||
|
||||
namespace esxr_lut {
|
||||
|
||||
static constexpr std::pair<GroupType, std::string_view> group_type_name_map_builtin[] {
|
||||
{GroupType::Top , "Top Type" },
|
||||
{GroupType::WorldChildren , "World Children" },
|
||||
@@ -18,10 +16,6 @@ static constexpr std::pair<GroupType, std::string_view> group_type_name_map_buil
|
||||
};
|
||||
static constexpr auto group_type_name_map_std = utility::array_builtin_to_std(group_type_name_map_builtin);
|
||||
static constexpr auto group_type_name_map = utility::map_to_soa(group_type_name_map_std);
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> group_type_to_name(GroupType group_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(group_type_name_map, group_type);
|
||||
}
|
||||
|
||||
static constexpr std::pair<RecordType, FourCC> record_type_fourcc_map_builtin[] {
|
||||
{RecordType::AACT, FourCC("AACT")}, {RecordType::ACHR, FourCC("ACHR")},
|
||||
@@ -95,14 +89,6 @@ static constexpr std::pair<RecordType, FourCC> record_type_fourcc_map_builtin[]
|
||||
};
|
||||
static constexpr auto record_type_fourcc_map_std = utility::array_builtin_to_std(record_type_fourcc_map_builtin);
|
||||
static constexpr auto record_type_fourcc_map = utility::map_to_soa(record_type_fourcc_map_std);
|
||||
[[nodiscard]] constexpr std::optional<FourCC> record_type_to_fourcc(RecordType record_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(record_type_fourcc_map, record_type);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<RecordType> fourcc_to_record_type(FourCC fourcc) noexcept
|
||||
{
|
||||
return utility::soa_second_to_first(record_type_fourcc_map, fourcc);
|
||||
}
|
||||
|
||||
static constexpr std::pair<RecordType, std::string_view> record_type_name_map_builtin[] {
|
||||
{RecordType::AACT, "Action" },
|
||||
@@ -244,10 +230,6 @@ static constexpr std::pair<RecordType, std::string_view> record_type_name_map_bu
|
||||
};
|
||||
static constexpr auto record_type_name_map_std = utility::array_builtin_to_std(record_type_name_map_builtin);
|
||||
static constexpr auto record_type_name_map = utility::map_to_soa(record_type_name_map_std);
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> record_type_to_name(RecordType record_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(record_type_name_map, record_type);
|
||||
}
|
||||
|
||||
static constexpr std::pair<Flag, std::string_view> flag_description_map_builtin[] {
|
||||
{{RecordType::ACHR, 9}, "Starts Dead" },
|
||||
@@ -420,10 +402,6 @@ static constexpr std::pair<Flag, std::string_view> flag_description_map_builtin[
|
||||
};
|
||||
static constexpr auto flag_description_map_std = utility::array_builtin_to_std(flag_description_map_builtin);
|
||||
static constexpr auto flag_description_map = utility::map_to_soa(flag_description_map_std);
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> flag_to_description(Flag flag) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(flag_description_map, flag);
|
||||
}
|
||||
|
||||
static constexpr std::pair<RefrFlag, std::string_view> refr_flag_description_map_builtin[] {
|
||||
{{RecordType::ACTI, 9}, "Hidden From Local Map" },
|
||||
@@ -606,6 +584,29 @@ static constexpr std::pair<RefrFlag, std::string_view> refr_flag_description_map
|
||||
};
|
||||
static constexpr auto refr_flag_description_map_std = utility::array_builtin_to_std(refr_flag_description_map_builtin);
|
||||
static constexpr auto refr_flag_description_map = utility::map_to_soa(refr_flag_description_map_std);
|
||||
|
||||
namespace esxr {
|
||||
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> group_type_to_name(GroupType group_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(group_type_name_map, group_type);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<FourCC> record_type_to_fourcc(RecordType record_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(record_type_fourcc_map, record_type);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<RecordType> fourcc_to_record_type(FourCC fourcc) noexcept
|
||||
{
|
||||
return utility::soa_second_to_first(record_type_fourcc_map, fourcc);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> record_type_to_name(RecordType record_type) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(record_type_name_map, record_type);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> flag_to_description(Flag flag) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(flag_description_map, flag);
|
||||
}
|
||||
[[nodiscard]] constexpr std::optional<std::string_view> refr_flag_to_description(RefrFlag refr_flag) noexcept
|
||||
{
|
||||
return utility::soa_first_to_second(refr_flag_description_map, refr_flag);
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Test" << std::endl;
|
||||
std::cout << esxr::flag_to_description({ esxr::RecordType::TES4, 0 }).value() << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user