Add test for importing legacy town data

This commit is contained in:
2016-09-03 15:43:14 -04:00
parent 7e7d30869a
commit bd412a70c8
4 changed files with 254 additions and 0 deletions

View File

@@ -106,6 +106,7 @@
9169C3241B3B23610041002B /* libboost_thread.dylib in Copy Libraries and Frameworks */ = {isa = PBXBuildFile; fileRef = 910D9CA31B36439100414B17 /* libboost_thread.dylib */; };
9176FEC71D550EFE006EF694 /* out_legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9176FEC01D550EFC006EF694 /* out_legacy.cpp */; };
9176FEC81D550EFE006EF694 /* scen_legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9176FEC11D550EFC006EF694 /* scen_legacy.cpp */; };
9176FECC1D550EFE006EF694 /* town_legacy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9176FEC51D550EFE006EF694 /* town_legacy.cpp */; };
9178235D1B2EA0C5007F3444 /* vorbisenc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9178235C1B2EA0C5007F3444 /* vorbisenc.framework */; };
9178235E1B2EA0C5007F3444 /* vorbisenc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9178235C1B2EA0C5007F3444 /* vorbisenc.framework */; };
9178235F1B2EA0C5007F3444 /* vorbisenc.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9178235C1B2EA0C5007F3444 /* vorbisenc.framework */; };
@@ -648,6 +649,7 @@
9169C31F1B37A5D50041002B /* BoE Scenario Editor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "BoE Scenario Editor.app"; sourceTree = BUILT_PRODUCTS_DIR; };
9176FEC01D550EFC006EF694 /* out_legacy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = out_legacy.cpp; sourceTree = "<group>"; };
9176FEC11D550EFC006EF694 /* scen_legacy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scen_legacy.cpp; sourceTree = "<group>"; };
9176FEC51D550EFE006EF694 /* town_legacy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = town_legacy.cpp; sourceTree = "<group>"; };
9178235C1B2EA0C5007F3444 /* vorbisenc.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbisenc.framework; path = ../../../../../../Library/Frameworks/vorbisenc.framework; sourceTree = "<group>"; };
917823671B2F32DD007F3444 /* vorbisfile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbisfile.framework; path = ../../../../../../Library/Frameworks/vorbisfile.framework; sourceTree = "<group>"; };
9178236E1B2F331D007F3444 /* vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = vorbis.framework; path = ../../../../../../Library/Frameworks/vorbis.framework; sourceTree = "<group>"; };
@@ -1365,6 +1367,7 @@
91E128E31BC1624700C8BE1D /* ter_legacy.cpp */,
91EF27721B693D3800666469 /* ter_read.cpp */,
91EF27741B693D4800666469 /* ter_write.cpp */,
9176FEC51D550EFE006EF694 /* town_legacy.cpp */,
91C2A6EC1B8FA91400346948 /* town_read.cpp */,
91E381451B97671E00F69B81 /* town_write.cpp */,
);
@@ -1896,6 +1899,7 @@
91E128E61BC19DA400C8BE1D /* init.cpp in Sources */,
9176FEC71D550EFE006EF694 /* out_legacy.cpp in Sources */,
9176FEC81D550EFE006EF694 /* scen_legacy.cpp in Sources */,
9176FECC1D550EFE006EF694 /* town_legacy.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -27,6 +27,8 @@ void cTown::import_legacy(legacy::town_record_type& old){
exits[i].x = old.exit_locs[i].x;
exits[i].y = old.exit_locs[i].y;
exits[i].spec = old.exit_specs[i];
wandering_locs[i].x = old.wandering_locs[i].x;
wandering_locs[i].y = old.wandering_locs[i].y;
wandering[i].import_legacy(old.wandering[i]);
}
preset_fields.clear();

View File

@@ -25,6 +25,7 @@ struct import_helper {
template<typename T>
void cTown::import_legacy(T& old, int){
typedef import_helper<T> sizes;
assert(max_dim == sizes::dim && "Tried to import legacy town into wrong-sized town");
cField the_field, the_road;
the_field.type = SPECIAL_SPOT;
the_road.type = SPECIAL_ROAD;