• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Deeangbandのフルスクラッチ新ソースコード。BSD系ライセンスを採用予定。


Commit MetaInfo

Revisionc9abd0ea6be51d80e827f003f5bd80adec9c0fc5 (tree)
Time2014-03-12 22:46:12
AuthorDeskull <deskull@user...>
CommiterDeskull

Log Message

Add SetDammyData() to Square class.

Change Summary

Incremental Difference

--- a/Deeangband/GameSurfaceSDL.cpp
+++ b/Deeangband/GameSurfaceSDL.cpp
@@ -298,13 +298,13 @@ void GameSurfaceSDL::ViewFloor(Floor *floorPtr, int x, int y, int w, int h)
298298 {
299299 if(px < floorPtr->GetWidth() && py < floorPtr->GetHeight())
300300 {
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();
304304 SDL_Color sdlSymCol = {symColor.r, symColor.g, symColor.b, symColor.a};
305305 SDL_Rect blitRect = {240 + px * 24, py * 24 , 24, 24};
306306 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());
308308
309309 symbolSurface = TTF_RenderUTF8_Blended(font, toUTF8(symBuf).c_str(), sdlSymCol);
310310 blitRect.x += (24 - symbolSurface->w) / 2;
@@ -331,7 +331,7 @@ void GameSurfaceSDL::drawFloor(Floor *floorPtr, int x, int y, int w, int h)
331331 {
332332 if(px < floorPtr->GetWidth() && py < floorPtr->GetHeight())
333333 {
334- ID id = floorPtr->GetSquare(px, py)->getFeatureID();
334+ //ID id = floorPtr->GetSquare(px, py)->getFeatureID();
335335 SDL_Rect blitRect = {280 + px * 24, py * 24 , 30, 30};
336336 sprintf_s(symBuf, 5, "%c", floorPtr->GetGameWorld()->GetFeature("NONE")->GetSymbol());
337337 symbolSurface = TTF_RenderUTF8_Blended(font, toUTF8(symBuf).c_str(), color);
--- a/Deeangband/Square.cpp
+++ b/Deeangband/Square.cpp
@@ -11,17 +11,20 @@
1111
1212 Square::Square(Floor *floorPtr)
1313 {
14- this->floorPtr = NULL;
15- this->featureID = 0;
16- this->hitPoint = this->maxPoint = 100;
17- this->floorPtr = floorPtr;
14+ SetDammyData();
1815 }
1916
2017 Square::Square()
2118 {
19+ SetDammyData();
20+}
21+
22+void Square::SetDammyData()
23+{
2224 this->floorPtr = NULL;
23- this->featureID = 0;
25+ this->featureTag = "UNKNOWN";
2426 this->hitPoint = this->maxPoint = 100;
27+ this->floorPtr = floorPtr;
2528 }
2629
2730 Square::~Square()
@@ -37,9 +40,9 @@ bool Square::TakeEffect(Effect *effectPtr, POWER amount)
3740 return false;
3841 }
3942
40-ID Square::getFeatureID(void)
43+TAG Square::getFeatureTag(void)
4144 {
42- return this->featureID;
45+ return this->featureTag;
4346 }
4447
4548 Feature *Square::getFeaturePtr(void)
--- a/Deeangband/Square.h
+++ b/Deeangband/Square.h
@@ -19,10 +19,10 @@
1919 class Square : public GameElement
2020 {
2121 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
2626 public:
2727
2828 /*!
@@ -41,15 +41,21 @@ public:
4141 */
4242 Square::~Square();
4343
44+ /*!
45+ * @brief ダミーデータによる初期化
46+ * @return なし
47+ */
48+ void Square::SetDammyData(void);
49+
4450 /*!
4551 * @brief 所属するフロアのポインタを返す。
4652 */
4753 Floor* getFloorPtr(void);
4854
4955 /*!
50- * @brief 対応する地形のIDを返す。
56+ * @brief 対応する地形のタグを返す。
5157 */
52- ID getFeatureID(void);
58+ TAG getFeatureTag(void);
5359
5460 /*!
5561 * @brief 対応する地形のポインタを返す。