From 0c9dfcc0179dfd35984087667cfb22f15b6d60e3 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sun, 29 Apr 2012 09:26:03 +0200 Subject: [PATCH] Some changes --- apps/esmtool/esmtool.cpp | 6 ++++-- components/esm/loadland.cpp | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index 2eab0bc1a8..abbf5ca0e6 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -41,6 +41,8 @@ struct Arguments string outname; ESMData data; + ESMReader reader; + ESMWriter writer; }; bool parseOptions (int argc, char** argv, Arguments &info) @@ -230,7 +232,7 @@ void printRaw(ESMReader &esm) int load(Arguments& info) { - ESMReader esm; + ESMReader& esm = info.reader; esm.setEncoding(info.encoding); string filename = info.filename; @@ -806,7 +808,7 @@ int clone(Arguments& info) cout << endl << "Saving records to: " << info.outname << "..." << endl; - ESMWriter esm; + ESMWriter& esm = info.writer; esm.setEncoding(info.encoding); esm.setAuthor(info.data.author); esm.setDescription(info.data.description); diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 222772041a..512363fa0b 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -91,13 +91,17 @@ void Land::save(ESMWriter &esm) esm.writeHNT("DATA", flags); - /* TODO: Land! - if (hasData && !dataLoaded) + // TODO: Land! + bool wasLoaded = dataLoaded; + if (hasData) loadData(); // I think it might be a good idea to have // the data loaded before trying to save it - */ + if (dataLoaded) landData->save(esm); + + if (!wasLoaded) + unloadData(); } void Land::loadData()