[nostalgia] Fix ioOps to use setTypeInfo instead of setFields

This commit is contained in:
Gary Talent 2019-02-25 19:58:05 -06:00
parent def449607c
commit fb3e94b45c
3 changed files with 7 additions and 9 deletions

View File

@ -39,7 +39,7 @@ class Bounds {
template<typename T>
ox::Error ioOp(T *io, Bounds *obj) {
ox::Error err = 0;
io->setFields(4);
io->setTypeInfo("nostalgia::common::Bounds", 4);
err |= io->op("x", &obj->x);
err |= io->op("y", &obj->y);
err |= io->op("width", &obj->width);

View File

@ -61,7 +61,7 @@ class Point {
template<typename T>
ox::Error ioOp(T *io, Point *obj) {
ox::Error err = 0;
io->setFields(2);
io->setTypeInfo("nostalgia::common::Bounds", 2);
err |= io->op("x", &obj->x);
err |= io->op("y", &obj->y);
return err;

View File

@ -14,8 +14,7 @@
#include <nostalgia/common/common.hpp>
#include <nostalgia/core/core.hpp>
namespace nostalgia {
namespace world {
namespace nostalgia::world {
struct Tile {
uint8_t bgTile = 0;
@ -62,7 +61,7 @@ struct Zone {
template<typename T>
ox::Error ioOpRead(T *io, Zone *obj) {
ox::Error err = 0;
io->setFields(Zone::FIELDS);
io->setTypeInfo("nostalgia::world::Zone", Zone::FIELDS);
err |= io->op("bounds", &obj->m_bounds);
return err;
}
@ -70,7 +69,7 @@ ox::Error ioOpRead(T *io, Zone *obj) {
template<typename T>
ox::Error ioOpWrite(T *io, Zone *obj) {
ox::Error err = 0;
io->setFields(Zone::FIELDS);
io->setTypeInfo("nostalgia::world::Zone", Zone::FIELDS);
err |= io->op("bounds", &obj->m_bounds);
return err;
}
@ -98,16 +97,15 @@ struct Region {
template<typename T>
ox::Error ioOpRead(T *io, Region *obj) {
ox::Error err = 0;
io->setTypeInfo("nostalgia::world::Tile", Region::FIELDS);
io->setTypeInfo("nostalgia::World::Region", Region::FIELDS);
return err;
}
template<typename T>
ox::Error ioOpWrite(T *io, Region *obj) {
ox::Error err = 0;
io->setTypeInfo("nostalgia::world::Tile", Region::FIELDS);
io->setTypeInfo("nostalgia::World::Region", Region::FIELDS);
return err;
}
}
}