OSDN Git Service

Remove duplicated member in Creature class by super class.
authorDeskull <desull@users.sourceforge.jp>
Wed, 18 Jun 2014 10:41:40 +0000 (19:41 +0900)
committerDeskull <desull@users.sourceforge.jp>
Wed, 18 Jun 2014 10:41:40 +0000 (19:41 +0900)
Deeangband/Creature.cpp
Deeangband/Creature.h
Deeangband/GameSurfaceSDL.cpp
Deeangband/Item.h

index 65fc858..f8dbc2c 100644 (file)
@@ -266,11 +266,6 @@ namespace Deeangband
                return this->savings.GetVolition();
        }
 
-       Coordinates *Creature::GetPosition(void)
-       {
-               return &(this->position);
-       }
-
        SOUL Creature::GetCurrentSoul(void)
        {
                return this->currentSoul;
index 26f5bb0..1b4ec72 100644 (file)
@@ -19,6 +19,7 @@
 #include "HaveGameTime.h"
 #include "HaveHp.h"
 #include "HaveSymbol.h"
+#include "HavePosition.h"
 #include "Item.h"
 #include "GameConstants.h"
 #include "GameInstance.h"
@@ -61,7 +62,7 @@ namespace Deeangband
        * <li>\8f\8a\8e\9d\83X\83L\83\8b\88ê\97\97 / Current Pisition</li>
        * </ul>
        */
-       class Creature : public GameInstance, public HaveSymbol, public HaveHp, public HaveGameTime
+       class Creature : public GameInstance, public HaveSymbol, public HaveHp, public HaveGameTime, public HavePosition
        {
        private:
 
@@ -92,7 +93,6 @@ namespace Deeangband
                SavingTable savings; //!< \83Z\81[\83r\83\93\83O
 
                ID floorID;           //!< \8c»\8dÝ\82¢\82é\83t\83\8d\83AID
-               Coordinates position; //!< \8c»\8dÀ\95W
                std::vector<Item> itemList;  //!< \8f\8a\8e\9d\83A\83C\83e\83\80\83\8a\83X\83g
                std::map<TAG, SKILL_EXP> skillExpList; //!< \83X\83L\83\8b\8co\8c±\92l\83\8a\83X\83g
 
@@ -302,12 +302,6 @@ namespace Deeangband
                VO Creature::GetVolitionSaving(void);
 
                /*!
-               * @brief \83N\83\8a\81[\83`\83\83\81[\82Ì\8c»\8dÝ\88Ê\92u\82ð\95Ô\82·
-               * @return \83N\83\8a\81[\83`\83\83\81[\8c»\8dÝ\88Ê\92u\82ð\8e¦\82·Coordinates
-               */
-               Coordinates *Creature::GetPosition(void);
-
-               /*!
                * @brief \83N\83\8a\81[\83`\83\83\81[\82Ì\8f\8a\8e\9d\95i\83\8a\83X\83g\82ð\95Ô\82·
                * @return \83N\83\8a\81[\83`\83\83\81[\8f\8a\8e\9d\95i\83\8a\83X\83g\83}\83b\83v
                */
index 6270617..2d2d270 100644 (file)
@@ -445,7 +445,7 @@ namespace Deeangband
                        Color symColor = creatureIt->second->GetSymbolColor();
                        SDL_Color sdlSymCol = {(Uint8)symColor.GetRed(), (Uint8)symColor.GetGreen(), (Uint8)symColor.GetBlue(), (Uint8)symColor.GetAlpha()};
                        sprintf_s(symBuf, 5, "%s", creatureIt->second->GetSymbol().c_str()); 
-                       SDL_Rect blitRect = {240 + creatureIt->second->GetPosition()->GetX() * 24, creatureIt->second->GetPosition()->GetY() * 24 , 24, 24};
+                       SDL_Rect blitRect = {240 + creatureIt->second->GetPosition().GetX() * 24, creatureIt->second->GetPosition().GetY() * 24 , 24, 24};
                        symbolSurface = TTF_RenderUTF8_Blended(font, toUTF8(symBuf).c_str(), sdlSymCol);
                        blitRect.x += (24 - symbolSurface->w) / 2;
                        blitRect.y += (24 - symbolSurface->h) / 2;
index 2bb0fd4..c105e78 100644 (file)
@@ -19,6 +19,7 @@
 #include "SavingTable.h"
 #include "HaveGameTime.h"
 #include "HaveSymbol.h"
+#include "HavePosition.h"
 
 BOOST_CLASS_VERSION(Item, 1);
 
@@ -29,7 +30,7 @@ namespace Deeangband
        * @class Item
        * @brief \83A\83C\83e\83\80\82Ì\83N\83\89\83X
        */
-       class Item : public ItemTemplate, public GameInstance, public HaveSymbol, public HaveGameTime
+       class Item : public ItemTemplate, public GameInstance, public HaveSymbol, public HaveGameTime, public HavePosition
        {
        private: