[nostalgia/world] Update models
This commit is contained in:
parent
18f02ae25e
commit
71f70cb2e6
@ -13,32 +13,26 @@
|
||||
namespace nostalgia::world {
|
||||
|
||||
struct Tile {
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.world.Tile";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
|
||||
uint8_t bgTile = 0;
|
||||
uint8_t type = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
ox::Error modelRead(T *io, Tile *obj) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("nostalgia::world::Tile", Tile::Fields);
|
||||
err |= io->field("bgTile", &obj->bgTile);
|
||||
err |= io->field("type", &obj->type);
|
||||
return err;
|
||||
}
|
||||
oxModelBegin(Tile)
|
||||
oxModelField(bgTile)
|
||||
oxModelField(type)
|
||||
oxModelEnd()
|
||||
|
||||
|
||||
struct Zone {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.world.Zone";
|
||||
static constexpr auto TypeVersion = 2;
|
||||
|
||||
template<typename T>
|
||||
friend ox::Error modelRead(T*, Zone*);
|
||||
|
||||
template<typename T>
|
||||
friend ox::Error modelWrite(T*, Zone*);
|
||||
oxModelFriend(Zone);
|
||||
|
||||
protected:
|
||||
static constexpr auto Fields = 2;
|
||||
geo::Bounds m_bounds;
|
||||
Tile *m_tiles = nullptr;
|
||||
|
||||
@ -59,51 +53,24 @@ struct Zone {
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
ox::Error modelRead(T *io, Zone *obj) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("net.drinkingtea.nostalgia.world.Zone", Zone::Fields);
|
||||
err |= io->field("bounds", &obj->m_bounds);
|
||||
return err;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ox::Error modelWrite(T *io, Zone *obj) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("net.drinkingtea.nostalgia.world.Zone", Zone::Fields);
|
||||
err |= io->field("bounds", &obj->m_bounds);
|
||||
return err;
|
||||
}
|
||||
|
||||
oxModelBegin(Zone)
|
||||
oxModelFieldRename(bounds, m_bounds)
|
||||
oxModelEnd()
|
||||
|
||||
struct Region {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.world.Region";
|
||||
static constexpr auto TypeVersion = 1;
|
||||
|
||||
template<typename T>
|
||||
friend ox::Error modelRead(T*, Region*);
|
||||
|
||||
template<typename T>
|
||||
friend ox::Error modelWrite(T*, Region*);
|
||||
oxModelFriend(Region);
|
||||
|
||||
protected:
|
||||
static constexpr auto Fields = 1;
|
||||
ox::Vector<Zone*> m_zones;
|
||||
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
ox::Error modelRead(T *io, Region*) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("net.drinkingtea.nostalgia.world.Region", Region::Fields);
|
||||
return err;
|
||||
}
|
||||
oxModelBegin(Region)
|
||||
oxModelFieldRename(zones, m_zones)
|
||||
oxModelEnd()
|
||||
|
||||
template<typename T>
|
||||
ox::Error modelWrite(T *io, Region*) {
|
||||
auto err = OxError(0);
|
||||
io->setTypeInfo("net.drinkingtea.nostalgia.world.Region", Region::Fields);
|
||||
return err;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user