OSDN Git Service

ゲーム時間経過処理を実装中 / Implementing game time processing.
authorDeskull <desull@users.sourceforge.jp>
Fri, 7 Aug 2015 11:32:35 +0000 (20:32 +0900)
committerDeskull <desull@users.sourceforge.jp>
Fri, 7 Aug 2015 11:32:35 +0000 (20:32 +0900)
Deeangband/GameEngine.cpp
Deeangband/GameEngine.h
Deeangband/GameSurfaceSDL.cpp
Deeangband/GameWorld.cpp
Deeangband/GameWorld.h
Deeangband/HaveGameTime.cpp

index 951149b..5d26e48 100644 (file)
@@ -49,10 +49,13 @@ namespace Deeangband
                GAME_COMMAND commandID;
                PLAY_EXIT_CODE code = PLAY_EXIT_NONE;
                ACTION_IT actionIt;
+               HaveGameTime *currentHaveGameTimeObject;
                gameSurface->Draw(gameWorld->GetPlayerCreature());
 
                while(code == PLAY_EXIT_NONE)
                {
+                       currentHaveGameTimeObject = this->gameWorld->GetNextActionObject();
+                       currentHaveGameTimeObject->TurnProcess();
                        this->gameSurface->UpdateTimeStatus(this->gameWorld->GetGameTime());
                        //actionIt = this->toNextProcess();
                        commandID = gameSurface->GetCommand(gameWorld->GetPlayerCreature());
@@ -156,10 +159,4 @@ namespace Deeangband
 
                return deadNum;
        }
-
-       ACTION_IT GameEngine::toNextProcess(void)
-       {
-               return this->gameWorld->GetActionList()->begin()++;
-       }
-
 }
index d1e05de..fa911c4 100644 (file)
@@ -32,12 +32,6 @@ namespace Deeangband
                GameSurface *gameSurface; //!< GameSurface\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
                GameLogger *gameLogger; //!< GameLogger\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
 
-               /*!
-                * @brief \8e\9f\82Ì\8f\88\97\9d\91Î\8fÛ\82ð\8eæ\93¾\82µ\81A\82»\82ê\82Ü\82Å\82Ì\83Q\81[\83\80\8e\9e\8aÔ\89Á\8eZ\82ð\8ds\82¤\81B
-                * @return \8e\9f\82Ì\8f\88\97\9d\91Î\8fÛ
-                */
-               ACTION_IT GameEngine::toNextProcess(void);
-
        public:
                GameEngine::GameEngine();
                GameEngine::~GameEngine();
index 1cf0796..7651030 100644 (file)
@@ -386,7 +386,7 @@ namespace Deeangband
                if(gameTimeStatusTexture) SDL_DestroyTexture(gameTimeStatusTexture);
                surface = SDL_CreateRGBSurface(0, 200, 50, 32, 0, 0, 0, 0);
                SDL_FillRect(surface, &rect, SDL_MapRGBA(windowSurface->format, 0, 0, 0, 120));
-               sprintf_s(statusBuf, STATUS_BUFSIZE, "\83^\81[\83\93:%d", currentTime); 
+               sprintf_s(statusBuf, STATUS_BUFSIZE, "\83Q\81[\83\80\8e\9e\8aÔ:%d", currentTime); 
                statusSurface = TTF_RenderUTF8_Blended(font, toUTF8(statusBuf).c_str(), color);
                SDL_BlitSurface(statusSurface, &StatusViewRect, surface, &StatusViewPosition); 
                gameTimeStatusTexture = SDL_CreateTextureFromSurface(renderer, surface);
index 9fcfa7d..30cbe55 100644 (file)
@@ -25,6 +25,8 @@
 #include "Effect.h"
 #include "Floor.h"
 
+#include "HaveGameTime.h"
+
 #include "FixedArtifact.h"
 #include "GameMessage.h"
 #include "ItemBase.h"
@@ -97,11 +99,15 @@ namespace Deeangband
 
        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)
        {
-               std::map<ID, boost::shared_ptr<Creature>>::iterator creatureIt; 
+               std::map<ID, boost::shared_ptr<Creature>>::iterator creatureIt;
+               HaveGameTime *test;
                creatureList.emplace(this->creatureID, boost::make_shared<Creature>(speciesIt, fieldIt, x, y));
                creatureIt = creatureList.find(this->creatureID);
                creatureIt->second->PlusWait(100, TRUE);
                creatureIt->second->UpdateFieldLore();
+               actionList2.push_back(creatureIt->second.get());
+               test = creatureIt->second.get();
+               //actionList3.push_back(test);
                do
                {
                        this->creatureID++;
@@ -674,11 +680,6 @@ namespace Deeangband
                return this->playerIt;
        }
 
-       ACTION_LIST* GameWorld::GetActionList(void)
-       {
-               return &(this->actionList);
-       }
-
        Creature *GameWorld::GetCreatureFromPosition(ID fieldID, Coordinates *positionPtr)
        {
                CREATURE_IT creatureIt;
@@ -715,4 +716,16 @@ namespace Deeangband
                return &creatureList;
        }
 
+       ACTION_LIST* GameWorld::GetActionList(void)
+       {
+               return &(this->actionList);
+       }
+
+       HaveGameTime *GameWorld::GetNextActionObject(void)
+       {
+               this->gameTime++;
+               return this->playerIt->second.get();
+       }
+
+
 }
\ No newline at end of file
index cf721a4..b0795b2 100644 (file)
@@ -47,6 +47,7 @@ namespace Deeangband
        class TrapBase;
 
        class Coordinates;
+       class HaveGameTime;
 
 #include "EngineTypedef.h"
 
@@ -93,6 +94,8 @@ namespace Deeangband
                ID trapID;     //!<\8bó\82«\83g\83\89\83b\83vID
 
                std::vector<boost::shared_ptr<HaveGameTime>> actionList; /*!<\8ds\93®\8f\87\83\8a\83X\83g*/
+               std::vector<Creature *> actionList2; /*!<\8ds\93®\8f\87\83\8a\83X\83g*/
+               std::vector<HaveGameTime*> actionList3; /*!<\8ds\93®\8f\87\83\8a\83X\83g*/
 
                CREATURE_IT playerIt; //!< \83v\83\8c\83C\83\84\81[\83N\83\8a\81[\83`\83\83\81[\8eQ\8fÆ\83|\83C\83\93\83^
                GAME_TIME gameTime; //!<\83Q\81[\83\80\8e\9e\8aÔ
@@ -539,6 +542,13 @@ namespace Deeangband
 
                std::map<TAG, boost::shared_ptr<Species>> *GameWorld::GetSpeciesList(void);
 
+               /*!
+                * @brief \8e\9e\8aÔ\8co\89ß\8f\88\97\9d\82ð\8ds\82¢\81A\8e\9f\82Ì\83A\83N\83V\83\87\83\93\83I\83u\83W\83F\83N\83g\82ð\95Ô\82·\81B
+                * @return \8ds\93®\8f\87\83\8a\83X\83g
+                */
+               HaveGameTime *GameWorld::GetNextActionObject(void);
+
+
        };
 
 }
\ No newline at end of file
index f2de629..6189818 100644 (file)
@@ -1,6 +1,6 @@
 /*!
 * @file HaveGameTime.cpp
-* @brief \83Q\81[\83\80\83^\81[\83\93\95Û\8e\9d\92\8a\8fÛ\83N\83\89\83X\82ð\92è\8b`\82·\82é
+* @brief \83Q\81[\83\80\83^\83C\83\80\95Û\8e\9d\92\8a\8fÛ\83N\83\89\83X\82ð\92è\8b`\82·\82é
 * @date 2014/06/11
 * @author Deskull
 * 2014 Sikabane Works.