From 863dcd56daaaafc7b87196236b85d40909b4f390 Mon Sep 17 00:00:00 2001 From: Deskull Date: Wed, 18 Jun 2014 19:41:40 +0900 Subject: [PATCH] Remove duplicated member in Creature class by super class. --- Deeangband/Creature.cpp | 5 ----- Deeangband/Creature.h | 10 ++-------- Deeangband/GameSurfaceSDL.cpp | 2 +- Deeangband/Item.h | 3 ++- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Deeangband/Creature.cpp b/Deeangband/Creature.cpp index 65fc858..f8dbc2c 100644 --- a/Deeangband/Creature.cpp +++ b/Deeangband/Creature.cpp @@ -266,11 +266,6 @@ namespace Deeangband return this->savings.GetVolition(); } - Coordinates *Creature::GetPosition(void) - { - return &(this->position); - } - SOUL Creature::GetCurrentSoul(void) { return this->currentSoul; diff --git a/Deeangband/Creature.h b/Deeangband/Creature.h index 26f5bb0..1b4ec72 100644 --- a/Deeangband/Creature.h +++ b/Deeangband/Creature.h @@ -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 *
  • ŠŽƒXƒLƒ‹ˆê—— / Current Pisition
  • * */ - 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; //!< ƒZ[ƒrƒ“ƒO ID floorID; //!< Œ»Ý‚¢‚éƒtƒƒAID - Coordinates position; //!< Œ»À•W std::vector itemList; //!< ŠŽƒAƒCƒeƒ€ƒŠƒXƒg std::map skillExpList; //!< ƒXƒLƒ‹ŒoŒ±’lƒŠƒXƒg @@ -302,12 +302,6 @@ namespace Deeangband VO Creature::GetVolitionSaving(void); /*! - * @brief ƒNƒŠ[ƒ`ƒƒ[‚ÌŒ»ÝˆÊ’u‚ð•Ô‚· - * @return ƒNƒŠ[ƒ`ƒƒ[Œ»ÝˆÊ’u‚ðŽ¦‚·Coordinates - */ - Coordinates *Creature::GetPosition(void); - - /*! * @brief ƒNƒŠ[ƒ`ƒƒ[‚̏ŠŽ•iƒŠƒXƒg‚ð•Ô‚· * @return ƒNƒŠ[ƒ`ƒƒ[ŠŽ•iƒŠƒXƒgƒ}ƒbƒv */ diff --git a/Deeangband/GameSurfaceSDL.cpp b/Deeangband/GameSurfaceSDL.cpp index 6270617..2d2d270 100644 --- a/Deeangband/GameSurfaceSDL.cpp +++ b/Deeangband/GameSurfaceSDL.cpp @@ -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; diff --git a/Deeangband/Item.h b/Deeangband/Item.h index 2bb0fd4..c105e78 100644 --- a/Deeangband/Item.h +++ b/Deeangband/Item.h @@ -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 ƒAƒCƒeƒ€‚̃Nƒ‰ƒX */ - class Item : public ItemTemplate, public GameInstance, public HaveSymbol, public HaveGameTime + class Item : public ItemTemplate, public GameInstance, public HaveSymbol, public HaveGameTime, public HavePosition { private: -- 2.11.0