OSDN Git Service

Square::SetFloorTag()をSetFloor()に変更して修正。 / Rename Square::SetFloorTag() to SetFloor...
authorDeskull <desull@users.sourceforge.jp>
Mon, 26 Jan 2015 14:38:46 +0000 (23:38 +0900)
committerDeskull <desull@users.sourceforge.jp>
Mon, 26 Jan 2015 14:38:46 +0000 (23:38 +0900)
GameWorldコンストラクタから、GameWorld::Initialize()を分離。 / Split GameWorld::Initialize() from GameWorld constructor.

Deeangband/Field.cpp
Deeangband/GameEngine.cpp
Deeangband/GameWorld.cpp
Deeangband/GameWorld.h
Deeangband/Square.cpp
Deeangband/Square.h

index 19bef0f..9f4bc4e 100644 (file)
@@ -32,11 +32,11 @@ namespace Deeangband
                                squares[y].push_back(boost::shared_ptr<Square>(new Square()));
                                if(Dice::Cast(1, 4) == 3)
                                {
-                                       squares[y][x]->SetFloorTag(dungeonPtr->GetInnerWallFloorTag());
+                                       squares[y][x]->SetFloor(dungeonPtr->GetInnerWallFloorTag());
                                }
                                else
                                {
-                                       squares[y][x]->SetFloorTag(dungeonPtr->GetFloorFloorTag());
+                                       squares[y][x]->SetFloor(dungeonPtr->GetFloorFloorTag());
                                }
                        }
                }
@@ -216,7 +216,7 @@ namespace Deeangband
                                squarePtr = this->GetSquare(x, y);
                                if(squarePtr)
                                {
-                                       squarePtr->SetFloorTag(dungeonPtr->GetFloorFloorTag());
+                                       squarePtr->SetFloor(dungeonPtr->GetFloorFloorTag());
                                }
                        }
                }
@@ -224,9 +224,9 @@ namespace Deeangband
                for(y = sy; y <= ey; y++)
                {
                        squarePtr = this->GetSquare(sx, y);
-                       squarePtr->SetFloorTag(dungeonPtr->GetInnerWallFloorTag());
+                       squarePtr->SetFloor(dungeonPtr->GetInnerWallFloorTag());
                        squarePtr = this->GetSquare(ex, y);
-                       squarePtr->SetFloorTag(dungeonPtr->GetInnerWallFloorTag());
+                       squarePtr->SetFloor(dungeonPtr->GetInnerWallFloorTag());
                        wallVec.push_back(boost::make_shared<Coordinates>(sx, y));
                        wallVec.push_back(boost::make_shared<Coordinates>(ex, y));
                }
@@ -234,14 +234,14 @@ namespace Deeangband
                for(x = sx + 1; x < ex; x++)
                {
                        squarePtr = this->GetSquare(x, sy);
-                       squarePtr->SetFloorTag(dungeonPtr->GetInnerWallFloorTag());
+                       squarePtr->SetFloor(dungeonPtr->GetInnerWallFloorTag());
                        squarePtr = this->GetSquare(x, ey);
-                       squarePtr->SetFloorTag(dungeonPtr->GetInnerWallFloorTag());
+                       squarePtr->SetFloor(dungeonPtr->GetInnerWallFloorTag());
                        wallVec.push_back(boost::make_shared<Coordinates>(x, sy));
                        wallVec.push_back(boost::make_shared<Coordinates>(x, ey));
                }
 
-               this->GetSquare(*wallVec[Dice::Rand0(wallVec.size())].get())->SetFloorTag(dungeonPtr->GetFloorFloorTag());
+               this->GetSquare(*wallVec[Dice::Rand0(wallVec.size())].get())->SetFloor(dungeonPtr->GetFloorFloorTag());
        }
 
        void Field::createRectRoom(Coordinates& leftTop, Coordinates& rightBottom)
index c373c92..1892534 100644 (file)
@@ -28,6 +28,9 @@ namespace Deeangband
                GameElement::GameSurfacePtr = gameSurface;
                GameElement::GameLoggerPtr = gameLogger;
 
+               Dice::Initialize();
+               gameWorld->Initialize();
+
                gameSurface->SetField(gameWorld->GetField(0));
                gameSurface->SetSideStatusCreature(gameWorld->GetCreature(0));
                this->gameLogger->PutLog("GameEngine\8aJ\8en");
index 2ab3876..9fcfa7d 100644 (file)
@@ -49,11 +49,7 @@ namespace Deeangband
 
        GameWorld::GameWorld(void)
        {
-               int i;
-               Dice::Initialize();
                XMLLoad();
-               std::map<ID, boost::shared_ptr<Field>>::iterator fieldIt;
-               std::map<TAG, boost::shared_ptr<Species>>::iterator speciesIt;
 
                this->itemID = 0;
                this->trapID = 0;
@@ -61,6 +57,13 @@ namespace Deeangband
                this->fieldID = 0;
                this->gameTime = 0;
 
+       }
+
+       void GameWorld::Initialize(void)
+       {
+               int i;
+               std::map<ID, boost::shared_ptr<Field>>::iterator fieldIt;
+               std::map<TAG, boost::shared_ptr<Species>>::iterator speciesIt;
                fieldList.emplace(0, boost::make_shared<Field>(dungeonList.find("VANILLA_WOMB"), 1));
                fieldIt = fieldList.find(0);
 
@@ -70,15 +73,14 @@ namespace Deeangband
                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<Karma>());
                }
-
                playerIt = creatureList.begin()++;
        }
 
+
        GameWorld::~GameWorld(void)
        {
        }
index 46a4c04..cf721a4 100644 (file)
@@ -305,17 +305,23 @@ namespace Deeangband
        public:
 
                /*!
-               * @brief GameWorld\83N\83\89\83X\82Ì\83R\83\93\83X\83g\83\89\83N\83^
-               * @param gSurface \83Q\81[\83\80\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Æ\82È\82é GameSurface \8eQ\8fÆ
-               */
+                * @brief GameWorld\83N\83\89\83X\82Ì\83R\83\93\83X\83g\83\89\83N\83^
+                * @param gSurface \83Q\81[\83\80\82Ì\83C\83\93\83^\81[\83t\83F\83C\83X\82Æ\82È\82é GameSurface \8eQ\8fÆ
+                */
                GameWorld::GameWorld(void);
 
                /*!
-               * @brief GameWorld\83N\83\89\83X\82Ì\83f\83X\83g\83\89\83N\83^
-               */
+                * @brief GameWorld\83N\83\89\83X\82Ì\83f\83X\83g\83\89\83N\83^
+                */
                GameWorld::~GameWorld(void);
 
                /*!
+                * @brief \83Q\81[\83\80\90¢\8aE\82Ì\8f\89\8aú\90\90¬\82ð\8ds\82¤
+                */
+               void GameWorld::Initialize(void);
+
+
+               /*!
                * @brief \83N\83\8a\81[\83`\83\83\81[\82ð\90\90¬\82µGameWorld\92\86\82Ì\8f\94\97v\91f\82Æ\98A\8cg\82³\82¹\82é
                * @param creatureTag \83N\83\8a\81[\83`\83\83\81[\83^\83O
                * @return \90\90¬\82É\90¬\8c÷\82µ\82½\8fê\8d\87true\82ð\95Ô\82·
index f0a5610..1fc3d87 100644 (file)
@@ -52,9 +52,10 @@ namespace Deeangband
                return this->spaceTag;
        }
 
-       bool Square::SetFloorTag(TAG tag)
+       bool Square::SetFloor(TAG tag)
        {
                this->floorTag = tag;
+               this->floorPtr = GameElement::GameWorldPtr->GetFloorList()->operator[](tag).get();
                return true;
        }
 
index 81b17d1..3723111 100644 (file)
@@ -70,7 +70,7 @@ namespace Deeangband
                 * @return \83^\83O\82Ì\95Ï\8dX\82ª\82Å\82«\82½\8fê\8d\87true\82ð\95Ô\82·\81B
                 * @todo \90³\8bK\82Ì\83^\83O\82©\82Ç\82¤\82©\94»\92è\82·\82é\8b@\94\\82ð\8eÀ\91\95\82·\82é\81B
                 */
-               bool Square::SetFloorTag(TAG tag);
+               bool Square::SetFloor(TAG tag);
 
                /*!
                 * @brief \91Î\89\9e\82·\82é\8f°\92n\8c`\82Ì\83^\83O\82ð\95Ô\82·\81B