Deeangbandのフルスクラッチ新ソースコード。BSD系ライセンスを採用予定。
Revision | c9abd0ea6be51d80e827f003f5bd80adec9c0fc5 (tree) |
---|---|
Time | 2014-03-12 22:46:12 |
Author | Deskull <deskull@user...> |
Commiter | Deskull |
Add SetDammyData() to Square class.
@@ -298,13 +298,13 @@ void GameSurfaceSDL::ViewFloor(Floor *floorPtr, int x, int y, int w, int h) | ||
298 | 298 | { |
299 | 299 | if(px < floorPtr->GetWidth() && py < floorPtr->GetHeight()) |
300 | 300 | { |
301 | - ID id = floorPtr->GetSquare(px, py)->getFeatureID(); | |
302 | - Color symColor = floorPtr->GetGameWorld()->GetFeature("NONE")->GetSymColor(); | |
303 | - Color backColor = floorPtr->GetGameWorld()->GetFeature("NONE")->GetBackColor(); | |
301 | + TAG tag = floorPtr->GetSquare(px, py)->getFeatureTag(); | |
302 | + Color symColor = floorPtr->GetGameWorld()->GetFeature(tag)->GetSymColor(); | |
303 | + Color backColor = floorPtr->GetGameWorld()->GetFeature(tag)->GetBackColor(); | |
304 | 304 | SDL_Color sdlSymCol = {symColor.r, symColor.g, symColor.b, symColor.a}; |
305 | 305 | SDL_Rect blitRect = {240 + px * 24, py * 24 , 24, 24}; |
306 | 306 | SDL_FillRect(windowSurface, &blitRect, SDL_MapRGBA(windowSurface->format, backColor.r, backColor.g, backColor.b, backColor.a)); |
307 | - sprintf_s(symBuf, 5, "%c", floorPtr->GetGameWorld()->GetFeature("NONE")->GetSymbol()); | |
307 | + sprintf_s(symBuf, 5, "%c", floorPtr->GetGameWorld()->GetFeature(tag)->GetSymbol()); | |
308 | 308 | |
309 | 309 | symbolSurface = TTF_RenderUTF8_Blended(font, toUTF8(symBuf).c_str(), sdlSymCol); |
310 | 310 | blitRect.x += (24 - symbolSurface->w) / 2; |
@@ -331,7 +331,7 @@ void GameSurfaceSDL::drawFloor(Floor *floorPtr, int x, int y, int w, int h) | ||
331 | 331 | { |
332 | 332 | if(px < floorPtr->GetWidth() && py < floorPtr->GetHeight()) |
333 | 333 | { |
334 | - ID id = floorPtr->GetSquare(px, py)->getFeatureID(); | |
334 | + //ID id = floorPtr->GetSquare(px, py)->getFeatureID(); | |
335 | 335 | SDL_Rect blitRect = {280 + px * 24, py * 24 , 30, 30}; |
336 | 336 | sprintf_s(symBuf, 5, "%c", floorPtr->GetGameWorld()->GetFeature("NONE")->GetSymbol()); |
337 | 337 | symbolSurface = TTF_RenderUTF8_Blended(font, toUTF8(symBuf).c_str(), color); |
@@ -11,17 +11,20 @@ | ||
11 | 11 | |
12 | 12 | Square::Square(Floor *floorPtr) |
13 | 13 | { |
14 | - this->floorPtr = NULL; | |
15 | - this->featureID = 0; | |
16 | - this->hitPoint = this->maxPoint = 100; | |
17 | - this->floorPtr = floorPtr; | |
14 | + SetDammyData(); | |
18 | 15 | } |
19 | 16 | |
20 | 17 | Square::Square() |
21 | 18 | { |
19 | + SetDammyData(); | |
20 | +} | |
21 | + | |
22 | +void Square::SetDammyData() | |
23 | +{ | |
22 | 24 | this->floorPtr = NULL; |
23 | - this->featureID = 0; | |
25 | + this->featureTag = "UNKNOWN"; | |
24 | 26 | this->hitPoint = this->maxPoint = 100; |
27 | + this->floorPtr = floorPtr; | |
25 | 28 | } |
26 | 29 | |
27 | 30 | Square::~Square() |
@@ -37,9 +40,9 @@ bool Square::TakeEffect(Effect *effectPtr, POWER amount) | ||
37 | 40 | return false; |
38 | 41 | } |
39 | 42 | |
40 | -ID Square::getFeatureID(void) | |
43 | +TAG Square::getFeatureTag(void) | |
41 | 44 | { |
42 | - return this->featureID; | |
45 | + return this->featureTag; | |
43 | 46 | } |
44 | 47 | |
45 | 48 | Feature *Square::getFeaturePtr(void) |
@@ -19,10 +19,10 @@ | ||
19 | 19 | class Square : public GameElement |
20 | 20 | { |
21 | 21 | private: |
22 | - Floor *floorPtr; //!<所属フロア参照ポインタ | |
23 | - ID featureID; //!<地形ID | |
24 | - HP hitPoint; //!<地形現HP | |
25 | - HP maxPoint; //!<地形最大HP | |
22 | + Floor *floorPtr; //!<所属フロア参照ポインタ | |
23 | + TAG featureTag; //!<地形タグ | |
24 | + HP hitPoint; //!<地形現HP | |
25 | + HP maxPoint; //!<地形最大HP | |
26 | 26 | public: |
27 | 27 | |
28 | 28 | /*! |
@@ -41,15 +41,21 @@ public: | ||
41 | 41 | */ |
42 | 42 | Square::~Square(); |
43 | 43 | |
44 | + /*! | |
45 | + * @brief ダミーデータによる初期化 | |
46 | + * @return なし | |
47 | + */ | |
48 | + void Square::SetDammyData(void); | |
49 | + | |
44 | 50 | /*! |
45 | 51 | * @brief 所属するフロアのポインタを返す。 |
46 | 52 | */ |
47 | 53 | Floor* getFloorPtr(void); |
48 | 54 | |
49 | 55 | /*! |
50 | - * @brief 対応する地形のIDを返す。 | |
56 | + * @brief 対応する地形のタグを返す。 | |
51 | 57 | */ |
52 | - ID getFeatureID(void); | |
58 | + TAG getFeatureTag(void); | |
53 | 59 | |
54 | 60 | /*! |
55 | 61 | * @brief 対応する地形のポインタを返す。 |