summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Beller <stefanbeller@googlemail.com>2012-08-01 23:25:41 +0200
committerStefan Beller <stefanbeller@googlemail.com>2012-08-02 20:58:04 +0200
commitd2df9cfb227ab8d6a302183c5f4a3377bb8f5140 (patch)
tree013922ba1773a658fd469dc8042637301cd49e20
parent7011c8eddfdf1b12a1249e01323db57f05e0334e (diff)
downloadmana-d2df9cfb227ab8d6a302183c5f4a3377bb8f5140.tar.gz
mana-d2df9cfb227ab8d6a302183c5f4a3377bb8f5140.tar.bz2
mana-d2df9cfb227ab8d6a302183c5f4a3377bb8f5140.tar.xz
mana-d2df9cfb227ab8d6a302183c5f4a3377bb8f5140.zip
Add a checkbox to the debugging window to show being ids.
Reviewed-by: Ablu
-rw-r--r--src/gui/debugwindow.cpp21
-rw-r--r--src/gui/viewport.cpp22
-rw-r--r--src/map.h7
3 files changed, 46 insertions, 4 deletions
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index d2fd4a29..13babb73 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -137,6 +137,7 @@ public:
mBeingPosition = new CheckBox(_("Being positions"));
mBeingPath = new CheckBox(_("Being path"));
mMousePath = new CheckBox(_("Mouse path"));
+ mBeingIds = new CheckBox(_("Being Ids"));
Label *specialsLabel = new Label(_("Specials:"));
mSpecialNormal = new RadioButton(_("Normal"), "mapdebug");
@@ -154,6 +155,7 @@ public:
place(0, 4, mBeingPosition, 1);
place(0, 5, mBeingPath, 1);
place(0, 6, mMousePath, 1);
+ place(0, 7, mBeingIds, 1);
place(1, 0, specialsLabel, 1);
place(1, 1, mSpecialNormal, 1);
place(1, 2, mSpecial1, 1);
@@ -170,12 +172,28 @@ public:
mBeingPosition->addActionListener(this);
mBeingPath->addActionListener(this);
mMousePath->addActionListener(this);
+ mBeingIds->addActionListener(this);
mSpecialNormal->addActionListener(this);
mSpecial1->addActionListener(this);
mSpecial2->addActionListener(this);
mSpecial3->addActionListener(this);
}
+ ~DebugSwitches()
+ {
+ delete mGrid;
+ delete mCollisionTiles;
+ delete mBeingCollisionRadius;
+ delete mBeingPosition;
+ delete mBeingPath;
+ delete mMousePath;
+ delete mBeingIds;
+ delete mSpecialNormal;
+ delete mSpecial1;
+ delete mSpecial2;
+ delete mSpecial3;
+ }
+
void action(const gcn::ActionEvent &event)
{
int flags = 0;
@@ -192,6 +210,8 @@ public:
flags |= Map::DEBUG_BEING_PATH;
if (mMousePath->isSelected())
flags |= Map::DEBUG_MOUSE_PATH;
+ if (mBeingIds->isSelected())
+ flags |= Map::DEBUG_BEING_IDS;
if (mSpecial1->isSelected())
flags |= Map::DEBUG_SPECIAL1;
if (mSpecial2->isSelected())
@@ -209,6 +229,7 @@ private:
CheckBox *mBeingPosition;
CheckBox *mBeingPath;
CheckBox *mMousePath;
+ CheckBox *mBeingIds;
RadioButton *mSpecialNormal;
RadioButton *mSpecial1;
RadioButton *mSpecial2;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 1b5b00c3..e06c5f8d 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -249,6 +249,26 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
b->drawSpeech((int) mPixelViewX, (int) mPixelViewY);
}
+ if (mDebugFlags & Map::DEBUG_BEING_IDS)
+ {
+ graphics->setColor(gcn::Color(255, 0, 255, 255));
+ ActorSpritesConstIterator it, it_end;
+ const ActorSprites &actors = actorSpriteManager->getAll();
+ for (it = actors.begin(), it_end = actors.end(); it != it_end; ++it)
+ {
+ Being *being = dynamic_cast<Being*>(*it);
+ if (!being)
+ continue;
+
+ const Vector &beingPos = being->getPosition();
+ std::string idString = toString(being->getId());
+ graphics->drawText(idString,
+ beingPos.x - mPixelViewX,
+ beingPos.y - mPixelViewY,
+ gcn::Graphics::CENTER);
+ }
+ }
+
if (miniStatusWindow)
miniStatusWindow->drawIcons(graphics);
@@ -364,7 +384,7 @@ void Viewport::_drawDebugPath(Graphics *graphics)
// Draw the path debug information for every beings.
ActorSpritesConstIterator it, it_end;
const ActorSprites &actors = actorSpriteManager->getAll();
- for (it = actors.begin(), it_end = actors.end() ; it != it_end; it++)
+ for (it = actors.begin(), it_end = actors.end(); it != it_end; it++)
{
Being *being = dynamic_cast<Being*>(*it);
if (!being)
diff --git a/src/map.h b/src/map.h
index b7917275..ed247eb7 100644
--- a/src/map.h
+++ b/src/map.h
@@ -169,9 +169,10 @@ class Map : public Properties
DEBUG_BEING_POSITION = 0x8,
DEBUG_BEING_PATH = 0x10,
DEBUG_MOUSE_PATH = 0x20,
- DEBUG_SPECIAL1 = 0x40,
- DEBUG_SPECIAL2 = 0x80,
- DEBUG_SPECIAL3 = 0x100
+ DEBUG_BEING_IDS = 0x40,
+ DEBUG_SPECIAL1 = 0x80,
+ DEBUG_SPECIAL2 = 0x100,
+ DEBUG_SPECIAL3 = 0x200
};
/**