From 5355808cfcff88d6b4ef9288f66edeabdd1d6e14 Mon Sep 17 00:00:00 2001 From: Deskull Date: Sat, 17 May 2014 15:17:27 +0900 Subject: [PATCH] Game:xmlSave*() functions return bool type. --- Deeangband/GameWorld.cpp | 48 ++++++++++++++++++++++++++++++++---------------- Deeangband/GameWorld.h | 32 ++++++++++++++++---------------- 2 files changed, 48 insertions(+), 32 deletions(-) diff --git a/Deeangband/GameWorld.cpp b/Deeangband/GameWorld.cpp index 91f2414..5a27b0c 100644 --- a/Deeangband/GameWorld.cpp +++ b/Deeangband/GameWorld.cpp @@ -24,142 +24,157 @@ namespace Deeangband { } - void GameWorld::xmlSaveAuthority(void) + bool GameWorld::xmlSaveAuthority(void) { std::ofstream ofs("lib-Vanilla\\Authority.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Authorities", this->authorityList); ofs.close(); + return true; } - void GameWorld::xmlSaveBuilding(void) + bool GameWorld::xmlSaveBuilding(void) { std::ofstream ofs("lib-Vanilla\\Building.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Buildings", this->buildingList); ofs.close(); + return true; } - void GameWorld::xmlSaveCamp(void) + bool GameWorld::xmlSaveCamp(void) { std::ofstream ofs("lib-Vanilla\\Camp.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Camps", this->campList); ofs.close(); + return true; } - void GameWorld::xmlSaveDungeon(void) + bool GameWorld::xmlSaveDungeon(void) { std::ofstream ofs("lib-Vanilla\\Dungeon.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Dungeons", this->dungeonList); ofs.close(); + return true; } - void GameWorld::xmlSaveEffect(void) + bool GameWorld::xmlSaveEffect(void) { std::ofstream ofs("lib-Vanilla\\Effect.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Effects", this->effectList); ofs.close(); + return true; } - void GameWorld::xmlSaveFeature(void) + bool GameWorld::xmlSaveFeature(void) { std::ofstream ofs("lib-Vanilla\\Feature.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Features", this->featureList); ofs.close(); + return true; } - void GameWorld::xmlSaveFixedArtifact(void) + bool GameWorld::xmlSaveFixedArtifact(void) { std::ofstream ofs("lib-Vanilla\\FixedArtifact.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("FixedArtifacts", this->fixedArtifactList); ofs.close(); + return true; } - void GameWorld::xmlSaveItemBase(void) + bool GameWorld::xmlSaveItemBase(void) { std::ofstream ofs("lib-Vanilla\\ItemBase.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("ItemBases", this->itemBaseList); ofs.close(); + return true; } - void GameWorld::xmlSaveItemEgo(void) + bool GameWorld::xmlSaveItemEgo(void) { std::ofstream ofs("lib-Vanilla\\ItemEgo.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("ItemEgos", this->itemEgoList); ofs.close(); + return true; } - void GameWorld::xmlSaveItemTrait(void) + bool GameWorld::xmlSaveItemTrait(void) { std::ofstream ofs("lib-Vanilla\\ItemTrait.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("ItemTraits", this->itemTraitList); ofs.close(); + return true; } - void GameWorld::xmlSaveKarma(void) + bool GameWorld::xmlSaveKarma(void) { std::ofstream ofs("lib-Vanilla\\Karma.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Karmas", this->karmaList); ofs.close(); + return true; } - void GameWorld::xmlSaveQuest(void) + bool GameWorld::xmlSaveQuest(void) { std::ofstream ofs("lib-Vanilla\\Quest.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Quests", this->questList); ofs.close(); + return true; } - void GameWorld::xmlSaveSkill(void) + bool GameWorld::xmlSaveSkill(void) { std::ofstream ofs("lib-Vanilla\\Skill.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Skils", this->skillList); ofs.close(); + return true; } - void GameWorld::xmlSaveSpecie(void) + bool GameWorld::xmlSaveSpecie(void) { std::ofstream ofs("lib-Vanilla\\Specie.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Species", this->speciesList); ofs.close(); + return true; } - void GameWorld::xmlSaveTrap(void) + bool GameWorld::xmlSaveTrap(void) { std::ofstream ofs("lib-Vanilla\\Trap.xml"); assert(ofs); boost::archive::xml_oarchive oa(ofs); oa << boost::serialization::make_nvp("Trap", this->trapList); ofs.close(); + return true; } - void GameWorld::XMLSave(void) + bool GameWorld::XMLSave(void) { this->xmlSaveAuthority(); this->xmlSaveBuilding(); @@ -176,6 +191,7 @@ namespace Deeangband this->xmlSaveSkill(); this->xmlSaveSpecie(); this->xmlSaveTrap(); + return true; } void GameWorld::XMLLoad(void) diff --git a/Deeangband/GameWorld.h b/Deeangband/GameWorld.h index 9eb7bde..1d98be4 100644 --- a/Deeangband/GameWorld.h +++ b/Deeangband/GameWorld.h @@ -76,21 +76,21 @@ namespace Deeangband friend class boost::serialization::access; - void GameWorld::xmlSaveAuthority(void); - void GameWorld::xmlSaveBuilding(void); - void GameWorld::xmlSaveCamp(void); - void GameWorld::xmlSaveDungeon(void); - void GameWorld::xmlSaveEffect(void); - void GameWorld::xmlSaveFeature(void); - void GameWorld::xmlSaveFixedArtifact(void); - void GameWorld::xmlSaveItemBase(void); - void GameWorld::xmlSaveItemEgo(void); - void GameWorld::xmlSaveItemTrait(void); - void GameWorld::xmlSaveKarma(void); - void GameWorld::xmlSaveQuest(void); - void GameWorld::xmlSaveSkill(void); - void GameWorld::xmlSaveSpecie(void); - void GameWorld::xmlSaveTrap(void); + bool GameWorld::xmlSaveAuthority(void); + bool GameWorld::xmlSaveBuilding(void); + bool GameWorld::xmlSaveCamp(void); + bool GameWorld::xmlSaveDungeon(void); + bool GameWorld::xmlSaveEffect(void); + bool GameWorld::xmlSaveFeature(void); + bool GameWorld::xmlSaveFixedArtifact(void); + bool GameWorld::xmlSaveItemBase(void); + bool GameWorld::xmlSaveItemEgo(void); + bool GameWorld::xmlSaveItemTrait(void); + bool GameWorld::xmlSaveKarma(void); + bool GameWorld::xmlSaveQuest(void); + bool GameWorld::xmlSaveSkill(void); + bool GameWorld::xmlSaveSpecie(void); + bool GameWorld::xmlSaveTrap(void); /*! @@ -283,7 +283,7 @@ namespace Deeangband * @brief XMLƒVƒŠƒAƒ‰ƒCƒY‚É‚æ‚éƒQ[ƒ€ƒf[ƒ^•Û‘¶ˆ— * @return ‚È‚µ */ - void GameWorld::XMLSave(void); + bool GameWorld::XMLSave(void); /*! * @brief XMLƒfƒVƒŠƒAƒ‰ƒCƒY‚É‚æ‚éƒQ[ƒ€ƒf[ƒ^“Ǎžˆ— -- 2.11.0