OSDN Git Service

HavePosition クラスのコンストラクタを整理 / Delete some constructors of HavePosition class.
authorDeskull <desull@users.sourceforge.jp>
Fri, 9 Jan 2015 13:12:24 +0000 (22:12 +0900)
committerDeskull <desull@users.sourceforge.jp>
Fri, 9 Jan 2015 13:12:24 +0000 (22:12 +0900)
Deeangband/Creature.cpp
Deeangband/GameWorld.cpp
Deeangband/GameWorld.h
Deeangband/HavePosition.cpp
Deeangband/HavePosition.h
Deeangband/StartingClass.h

index 1cc1281..6a4e013 100644 (file)
@@ -89,7 +89,7 @@ namespace Deeangband
        }
 
        Creature::Creature(std::map<TAG, boost::shared_ptr<Species>>::iterator speciesIt, ID FieldID, Coordinates *coordinates)
-               : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(fieldID, coordinates), HaveInventory(), HaveSize()
+               : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(coordinates->GetX(), coordinates->GetY()), HaveInventory(), HaveSize()
        {
                this->fieldID = FieldID;
                WipeData();
@@ -97,7 +97,7 @@ namespace Deeangband
        }
 
        Creature::Creature(std::map<TAG, boost::shared_ptr<Species>>::iterator speciesIt, ID FieldID, MAP_LENGTH x, MAP_LENGTH y)
-               : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(fieldID, x, y), HaveInventory(), HaveSize()
+               : GameInstance(), HaveSymbol(), HaveHp(), HaveGameTime(), HavePosition(x, y), HaveInventory(), HaveSize()
        {
                this->fieldID = FieldID;
                WipeData();
index 4ad09a6..b2ea10f 100644 (file)
@@ -93,7 +93,7 @@ namespace Deeangband
                return true;
        }
 
-       bool GameWorld::GenerateCreature(std::map<TAG, boost::shared_ptr<Species>>::iterator& speciesIt, std::map<ID, boost::shared_ptr<Field>>::iterator& fieldIt, int x, int y)
+       bool GameWorld::GenerateCreature(std::map<TAG, boost::shared_ptr<Species>>::iterator& speciesIt, std::map<ID, boost::shared_ptr<Field>>::iterator& fieldIt, MAP_LENGTH x, MAP_LENGTH y)
        {
                creatureList.emplace(this->creatureID, boost::make_shared<Creature>(speciesIt, fieldIt, x, y));
                creatureList[this->creatureID]->PlusWait(100, TRUE);
index 98a513d..46a4c04 100644 (file)
@@ -330,7 +330,7 @@ namespace Deeangband
                * @param y \94z\92u\90æY\8dÀ\95W
                * @return \90\90¬\82É\90¬\8c÷\82µ\82½\8fê\8d\87true\82ð\95Ô\82·
                */
-               bool GameWorld::GenerateCreature(std::map<TAG, boost::shared_ptr<Species>>::iterator& speciesIt, std::map<ID, boost::shared_ptr<Field>>::iterator& fieldIt, int x, int y);
+               bool GameWorld::GenerateCreature(std::map<TAG, boost::shared_ptr<Species>>::iterator& speciesIt, std::map<ID, boost::shared_ptr<Field>>::iterator& fieldIt, MAP_LENGTH x, MAP_LENGTH y);
 
                /*!
                * @brief GameWorld\92\86\82É\91\8dÝ\82·\82é\8c \94\\82ð\95Ô\82·
index 4af0046..8b3f5dc 100644 (file)
@@ -24,31 +24,10 @@ namespace Deeangband
                return;
        }
 
-       HavePosition::HavePosition(Coordinates *coordinates)
-       {
-               this->position = *coordinates;
-               this->fieldID = 0;
-               return;
-       }
-
-       HavePosition::HavePosition(int x, int y)
-       {
-               this->position.Set(x, y);
-               this->fieldID = 0;
-               return;
-       }
-
-       HavePosition::HavePosition(ID fieldID, Coordinates *coordinates)
-       {
-               this->position = *coordinates;
-               this->fieldID = fieldID;
-               return;
-       }
-
-       HavePosition::HavePosition(ID fieldID, int x, int y)
+       HavePosition::HavePosition(MAP_LENGTH x, MAP_LENGTH y)
        {
+               WipeData();
                this->position.Set(x, y);
-               this->fieldID = fieldID;
                return;
        }
 
@@ -64,6 +43,7 @@ namespace Deeangband
        {
                this->position.Set(0, 0);
                this->fieldID = 0;
+               this->fieldPtr = NULL;
        }
 
        Coordinates HavePosition::GetPosition(void)
index 0c0580e..6077a5b 100644 (file)
@@ -57,31 +57,10 @@ namespace Deeangband
 
                /*! 
                 * @brief HavePosition\83N\83\89\83X\83R\83\93\83X\83g\83\89\83N\83^
-                * @param coordinates \8f\89\8aú\8dÀ\95W
-                */
-               HavePosition::HavePosition(Coordinates *coordinates);
-
-               /*! 
-                * @brief HavePosition\83N\83\89\83X\83R\83\93\83X\83g\83\89\83N\83^
-                * @param x \8f\89\8aúx\8dÀ\95W
-                * @param y \8f\89\8aúy\8dÀ\95W
-                */
-               HavePosition::HavePosition(int x, int y);
-
-               /*! 
-                * @brief HavePosition\83N\83\89\83X\83R\83\93\83X\83g\83\89\83N\83^
-                * @param fieldID \8f\89\8aú\83t\83B\81[\83\8b\83hID
-                * @param coordinates \8f\89\8aú\8dÀ\95W
-                */
-               HavePosition::HavePosition(ID fieldID, Coordinates *coordinates);
-
-               /*! 
-                * @brief HavePosition\83N\83\89\83X\83R\83\93\83X\83g\83\89\83N\83^
-                * @param fieldID \8f\89\8aú\83t\83B\81[\83\8b\83hID
                 * @param x \8f\89\8aúx\8dÀ\95W
                 * @param y \8f\89\8aúy\8dÀ\95W
                 */
-               HavePosition::HavePosition(ID fieldID, int x, int y);
+               HavePosition::HavePosition(MAP_LENGTH x, MAP_LENGTH y);
 
                /*! 
                 * @brief HavePosition\83N\83\89\83X\83R\83\93\83X\83g\83\89\83N\83^
index 20e4b30..994227e 100644 (file)
@@ -47,8 +47,11 @@ namespace Deeangband
                */
                template<class Archive> void serialize(Archive &archive, const unsigned int version) 
                {
-                       archive & boost::serialization::make_nvp("Name", name);
-                       archive & boost::serialization::make_nvp("StatusPlus", statusPlus);
+                       if(version > 0)
+                       {
+                               archive & boost::serialization::make_nvp("Name", name);
+                               archive & boost::serialization::make_nvp("StatusPlus", statusPlus);
+                       }
                }
 
        public: