GameWorldコンストラクタから、GameWorld::Initialize()を分離。 / Split GameWorld::Initialize() from GameWorld constructor.
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());
}
}
}
squarePtr = this->GetSquare(x, y);
if(squarePtr)
{
- squarePtr->SetFloorTag(dungeonPtr->GetFloorFloorTag());
+ squarePtr->SetFloor(dungeonPtr->GetFloorFloorTag());
}
}
}
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));
}
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)
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");
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;
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);
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)
{
}
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·
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;
}
* @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