From 9938b1a19309709bb7fe05dd710da74e1ad70814 Mon Sep 17 00:00:00 2001 From: Deskull Date: Fri, 9 Jan 2015 21:48:34 +0900 Subject: [PATCH] =?utf8?q?HavePosition=20=E3=82=AF=E3=83=A9=E3=82=B9?= =?utf8?q?=E3=81=AB=E3=82=B3=E3=83=B3=E3=82=B9=E3=83=88=E3=83=A9=E3=82=AF?= =?utf8?q?=E3=82=BF=EF=BC=91=E3=81=A4=E8=BF=BD=E5=8A=A0=E3=80=82=20/=20Add?= =?utf8?q?=20another=20constructor=20of=20HavePosition=20class.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Deeangband/Creature.cpp | 8 +++----- Deeangband/Creature.h | 2 +- Deeangband/GameWorld.cpp | 10 ++++++++++ Deeangband/HavePosition.cpp | 8 ++++++++ Deeangband/HavePosition.h | 9 +++++++++ 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Deeangband/Creature.cpp b/Deeangband/Creature.cpp index 944b665..1cc1281 100644 --- a/Deeangband/Creature.cpp +++ b/Deeangband/Creature.cpp @@ -104,13 +104,11 @@ namespace Deeangband SetSpeciesData(&(*speciesIt->second)); } - Creature::Creature(std::map>::iterator* speciesIt, std::map>::iterator* fieldIt, MAP_LENGTH x, MAP_LENGTH y) - : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(fieldID, x, y), HaveInventory(), HaveSize() + Creature::Creature(std::map>::iterator& speciesIt, std::map>::iterator& fieldIt, MAP_LENGTH x, MAP_LENGTH y) + : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(fieldIt, x, y), HaveInventory(), HaveSize() { - this->fieldID = (*fieldIt)->first; - this->fieldPtr = (*fieldIt)->second; WipeData(); - SetSpeciesData((*speciesIt)->second.get()); + SetSpeciesData(speciesIt->second.get()); } diff --git a/Deeangband/Creature.h b/Deeangband/Creature.h index 708d8ad..2f7c5ab 100644 --- a/Deeangband/Creature.h +++ b/Deeangband/Creature.h @@ -209,7 +209,7 @@ namespace Deeangband * @param x ¶¬æXÀ•W * @param y ¶¬æYÀ•W */ - Creature::Creature(std::map>::iterator* speciesIt, std::map>::iterator* fieldIt, MAP_LENGTH x, MAP_LENGTH y); + Creature::Creature(std::map>::iterator& speciesIt, std::map>::iterator& fieldIt, MAP_LENGTH x, MAP_LENGTH y); /*! * @brief CreatureƒNƒ‰ƒXƒRƒ“ƒXƒgƒ‰ƒNƒ^ diff --git a/Deeangband/GameWorld.cpp b/Deeangband/GameWorld.cpp index e4476a8..6cf01fe 100644 --- a/Deeangband/GameWorld.cpp +++ b/Deeangband/GameWorld.cpp @@ -52,6 +52,7 @@ namespace Deeangband int i; Dice::Initialize(); XMLLoad(); + std::map>::iterator fieldIt; this->itemID = 0; this->trapID = 0; @@ -60,10 +61,19 @@ namespace Deeangband this->gameTime = 0; fieldList.emplace(0, boost::make_shared(dungeonList.find("VANILLA_WOMB"), 1)); + fieldIt = fieldList.find(0); GameWorld::GenerateCreature("VANILLA_STIGMATIC", 0, 10, 10); GameWorld::GenerateCreature("VANILLA_RAVING_LUNATIC", 0, 5, 5); + /* + speciesIt = SpeciesList.find("VANILLA_STIGMATIC"); + GameWorld::GenerateCreature(speciesIt, fieldIt, 10, 10); + speciesIt = SpeciesList.find("VANILLA_RAVING_LUNATIC"); + GameWorld::GenerateCreature(speciesIt, fieldIt, 5, 5); + */ + + for(i = 0; i < MAX_KARMAS; i++) { karmaList.emplace("VANILLA_", boost::make_shared()); diff --git a/Deeangband/HavePosition.cpp b/Deeangband/HavePosition.cpp index 7ee1596..4af0046 100644 --- a/Deeangband/HavePosition.cpp +++ b/Deeangband/HavePosition.cpp @@ -52,6 +52,14 @@ namespace Deeangband return; } + HavePosition::HavePosition(std::map>::iterator fieldIt, MAP_LENGTH x, MAP_LENGTH y) + { + this->position.Set(x, y); + this->fieldID = fieldIt->first; + this->fieldPtr = fieldIt->second; + return; + } + void HavePosition::WipeData(void) { this->position.Set(0, 0); diff --git a/Deeangband/HavePosition.h b/Deeangband/HavePosition.h index e608549..0c0580e 100644 --- a/Deeangband/HavePosition.h +++ b/Deeangband/HavePosition.h @@ -84,6 +84,15 @@ namespace Deeangband HavePosition::HavePosition(ID fieldID, int x, int y); /*! + * @brief HavePositionƒNƒ‰ƒXƒRƒ“ƒXƒgƒ‰ƒNƒ^ + * @param fieldIt ‰ŠúƒtƒB[ƒ‹ƒhƒCƒeƒŒ[ƒ^ŽQÆ + * @param x ‰ŠúxÀ•W + * @param y ‰ŠúyÀ•W + */ + HavePosition::HavePosition(std::map>::iterator fieldIt, MAP_LENGTH x, MAP_LENGTH y); + + + /*! * @brief HavePositionƒNƒ‰ƒXƒfƒXƒgƒ‰ƒNƒ^ */ HavePosition::~HavePosition(void); -- 2.11.0