X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FArea.cpp;h=1b9488a01120d045e2eddbeb0df94e402c0797a8;hb=7c43158af1abf38fa896a442cb3c6d8a5bc630e7;hp=985dea2d5462f4aae5ecba7663d6c79651f635d3;hpb=77915e0186f4fc0788054eb34651c726b80d981c;p=l2e.git diff --git a/src/map/Area.cpp b/src/map/Area.cpp index 985dea2..1b9488a 100644 --- a/src/map/Area.cpp +++ b/src/map/Area.cpp @@ -9,11 +9,14 @@ #include "Tile.h" #include "../graphics/Sprite.h" +#include "../loader/TypeDescription.h" #include "../sdl/utility.h" #include using geometry::Vector; +using loader::FieldDescription; +using loader::TypeDescription; namespace map { @@ -86,4 +89,25 @@ void Area::RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const } } + +void Area::CreateTypeDescription() { + Area a; + + int imageId(TypeDescription::GetTypeId("Image")); + int numberId(TypeDescription::GetTypeId("Number")); + int tileId(TypeDescription::GetTypeId("Tile")); + + TypeDescription &td(TypeDescription::CreateOrGet("Area")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Area)); + + td.AddField("battlebg", FieldDescription(((char *)&a.battlebg) - ((char *)&a), imageId).SetReferenced()); + td.AddField("tiles", FieldDescription(((char *)&a.tiles) - ((char *)&a), tileId).SetReferenced().SetAggregate()); + td.AddField("width", FieldDescription(((char *)&a.width) - ((char *)&a), numberId)); +} + +void Area::Construct(void *data) { + new (data) Area; +} + }