2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 23:47:42 +00:00

Proper TUniqueId implementation, minor bug fixes in CSortedListManager

This commit is contained in:
2017-08-10 06:40:07 -07:00
parent 9d85e7dbfe
commit 8409cf7868
12 changed files with 123 additions and 101 deletions

View File

@@ -52,11 +52,23 @@ struct TEditorId
bool operator==(const TEditorId& other) const { return (id & 0x3ffffff) == (other.id & 0x3ffffff); }
};
using TUniqueId = s16;
struct TUniqueId
{
TUniqueId() = default;
TUniqueId(u16 value, u16 version) : id(value | (version << 10)) {}
u16 id = u16(-1);
s16 Version() const { return s16((id >> 10) & 0x3f);}
s16 Value() const { return s16(id & 0x3ff);}
bool operator<(const TUniqueId& other) const { return (id < other.id); }
bool operator!=(const TUniqueId& other) const { return (id != other.id); }
bool operator==(const TUniqueId& other) const { return (id == other.id); }
};
using TAreaId = s32;
#define kInvalidEditorId TEditorId()
#define kInvalidUniqueId TUniqueId(-1)
#define kInvalidUniqueId TUniqueId()
#define kInvalidAreaId TAreaId(-1)
}