Basic write tests for towns, dialogue, and outdoors sectors
Also: - Additional read test for dialogue - Don't save empty outdoor encounters - Don't save town timers without an assigned node
This commit is contained in:
@@ -253,6 +253,9 @@
|
||||
91CC173E1B421CA0003D9A69 /* scen_write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91CC173B1B421CA0003D9A69 /* scen_write.cpp */; };
|
||||
91CC17491B422D5C003D9A69 /* scen_read.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91CC173A1B421CA0003D9A69 /* scen_read.cpp */; };
|
||||
91D634560F8FD77800674AB3 /* BoE.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2B8F435C0C0973680012E4A8 /* BoE.icns */; };
|
||||
91E381461B97673700F69B81 /* town_write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91E381451B97671E00F69B81 /* town_write.cpp */; };
|
||||
91E381481B97677900F69B81 /* talk_write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91E381471B97675900F69B81 /* talk_write.cpp */; };
|
||||
91E3814A1B97679800F69B81 /* out_write.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91E381491B97678D00F69B81 /* out_write.cpp */; };
|
||||
91EF052C1904D099001BEF85 /* bold.ttf in Copy Fonts */ = {isa = PBXBuildFile; fileRef = 91EF05291904D082001BEF85 /* bold.ttf */; };
|
||||
91EF052D1904D099001BEF85 /* plain.ttf in Copy Fonts */ = {isa = PBXBuildFile; fileRef = 91EF052A1904D082001BEF85 /* plain.ttf */; };
|
||||
91EF27731B693D3900666469 /* ter_read.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91EF27721B693D3800666469 /* ter_read.cpp */; };
|
||||
@@ -766,6 +769,9 @@
|
||||
91E1862B1B2B2AC0006A99EA /* estreams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = estreams.cpp; sourceTree = "<group>"; };
|
||||
91E30F2A1A74819B0057C54A /* fileio_party.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fileio_party.cpp; sourceTree = "<group>"; };
|
||||
91E30F2D1A7481C20057C54A /* fileio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fileio.cpp; sourceTree = "<group>"; };
|
||||
91E381451B97671E00F69B81 /* town_write.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = town_write.cpp; sourceTree = "<group>"; };
|
||||
91E381471B97675900F69B81 /* talk_write.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = talk_write.cpp; sourceTree = "<group>"; };
|
||||
91E381491B97678D00F69B81 /* out_write.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = out_write.cpp; sourceTree = "<group>"; };
|
||||
91E5C5A10F9EACE200C21460 /* oldstructs.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = oldstructs.hpp; path = ../oldstructs.hpp; sourceTree = "<group>"; };
|
||||
91E5C7970F9F60EC00C21460 /* town.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = town.hpp; sourceTree = "<group>"; };
|
||||
91E5C7980F9F60EC00C21460 /* town.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = town.cpp; sourceTree = "<group>"; };
|
||||
@@ -1336,8 +1342,11 @@
|
||||
91EF277A1B693D6E00666469 /* monst_read.cpp */,
|
||||
91EF277C1B693D7D00666469 /* monst_write.cpp */,
|
||||
91C2A6EC1B8FA91400346948 /* town_read.cpp */,
|
||||
91E381451B97671E00F69B81 /* town_write.cpp */,
|
||||
91C2A6EE1B8FAA8E00346948 /* talk_read.cpp */,
|
||||
91E381471B97675900F69B81 /* talk_write.cpp */,
|
||||
91C2A6ED1B8FA9FB00346948 /* out_read.cpp */,
|
||||
91E381491B97678D00F69B81 /* out_write.cpp */,
|
||||
);
|
||||
name = src;
|
||||
sourceTree = "<group>";
|
||||
@@ -1855,6 +1864,9 @@
|
||||
911A14031B8FAFC600900FD9 /* town_read.cpp in Sources */,
|
||||
911A14041B8FB00300900FD9 /* talk_read.cpp in Sources */,
|
||||
911A14051B8FB00600900FD9 /* out_read.cpp in Sources */,
|
||||
91E381461B97673700F69B81 /* town_write.cpp in Sources */,
|
||||
91E381481B97677900F69B81 /* talk_write.cpp in Sources */,
|
||||
91E3814A1B97679800F69B81 /* out_write.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@@ -46,6 +46,9 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario);
|
||||
void writeTerrainToXml(ticpp::Printer&& data, cScenario& scenario);
|
||||
void writeItemsToXml(ticpp::Printer&& data, cScenario& scenario);
|
||||
void writeMonstersToXml(ticpp::Printer&& data, cScenario& scenario);
|
||||
void writeOutdoorsToXml(ticpp::Printer&& data, cOutdoors& sector);
|
||||
void writeTownToXml(ticpp::Printer&& data, cTown& town);
|
||||
void writeDialogueToXml(ticpp::Printer&& data, cSpeech& talk, int town_num);
|
||||
map_data buildOutMapData(location which, cScenario& scenario);
|
||||
map_data buildTownMapData(size_t which, cScenario& scenario);
|
||||
|
||||
@@ -597,7 +600,7 @@ void writeMonstersToXml(ticpp::Printer&& data, cScenario& scenario) {
|
||||
data.CloseElement("monsters");
|
||||
}
|
||||
|
||||
static void writeOutdoorsToXml(ticpp::Printer&& data, cOutdoors& sector) {
|
||||
void writeOutdoorsToXml(ticpp::Printer&& data, cOutdoors& sector) {
|
||||
data.OpenElement("sector");
|
||||
data.PushAttribute("boes", scenario.format_ed_version());
|
||||
data.PushElement("name", sector.out_name);
|
||||
@@ -609,10 +612,14 @@ static void writeOutdoorsToXml(ticpp::Printer&& data, cOutdoors& sector) {
|
||||
case AMBIENT_DRIP: data.PushElement("sound", "drip"); break;
|
||||
case AMBIENT_CUSTOM: data.PushElement("sound", sector.out_sound); break;
|
||||
}
|
||||
for(auto& enc : sector.special_enc)
|
||||
data.PushElement("encounter", enc);
|
||||
for(auto& enc : sector.wandering)
|
||||
data.PushElement("wandering", enc);
|
||||
for(auto& enc : sector.special_enc) {
|
||||
if(!enc.isNull())
|
||||
data.PushElement("encounter", enc);
|
||||
}
|
||||
for(auto& enc : sector.wandering) {
|
||||
if(!enc.isNull())
|
||||
data.PushElement("wandering", enc);
|
||||
}
|
||||
for(size_t i = 0; i < sector.sign_locs.size(); i++) {
|
||||
if(sector.sign_locs[i].text.empty()) continue;
|
||||
data.OpenElement("sign");
|
||||
@@ -634,7 +641,7 @@ static void writeOutdoorsToXml(ticpp::Printer&& data, cOutdoors& sector) {
|
||||
data.CloseElement("sector");
|
||||
}
|
||||
|
||||
static void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
static const char directions[] = {'n', 'w', 's', 'e'};
|
||||
data.OpenElement("town");
|
||||
data.PushAttribute("boes", scenario.format_ed_version());
|
||||
@@ -679,7 +686,7 @@ static void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
if(town.spec_on_hostile >= 0)
|
||||
data.PushElement("onoffend", town.spec_on_hostile);
|
||||
for(size_t i = 0; i < town.timers.size(); i++) {
|
||||
if(town.timers[i].time < 0) continue;
|
||||
if(town.timers[i].time < 0 || town.timers[i].node < 0) continue;
|
||||
data.OpenElement("timer");
|
||||
data.PushAttribute("freq", town.timers[i].time);
|
||||
data.PushText(town.timers[i].node);
|
||||
@@ -776,7 +783,7 @@ static void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
data.CloseElement("town");
|
||||
}
|
||||
|
||||
static void writeDialogueToXml(ticpp::Printer&& data, cSpeech& talk, int town_num) {
|
||||
void writeDialogueToXml(ticpp::Printer&& data, cSpeech& talk, int town_num) {
|
||||
data.OpenElement("dialogue");
|
||||
data.PushAttribute("boes", scenario.format_ed_version());
|
||||
for(size_t i = 0; i < 10; i++) {
|
||||
|
Reference in New Issue
Block a user