summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-16 02:43:31 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-16 02:43:31 +0300
commitcbf5a66ac0d5cbcd2f0058b9e326ef9b6d56f23b (patch)
tree5acc50addb37120aa7719e52a2fa0d451118fb74 /src
parent572c2e0048400388c71b962b74b9a443a0b076a0 (diff)
downloadplus-cbf5a66ac0d5cbcd2f0058b9e326ef9b6d56f23b.tar.gz
plus-cbf5a66ac0d5cbcd2f0058b9e326ef9b6d56f23b.tar.bz2
plus-cbf5a66ac0d5cbcd2f0058b9e326ef9b6d56f23b.tar.xz
plus-cbf5a66ac0d5cbcd2f0058b9e326ef9b6d56f23b.zip
Add race name to status and debug windows.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp8
-rw-r--r--src/being.h7
-rw-r--r--src/gui/debugwindow.cpp25
-rw-r--r--src/gui/debugwindow.h1
-rw-r--r--src/gui/statuswindow.cpp8
5 files changed, 38 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 47a74c7b2..e1cb9b0ae 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -338,7 +338,15 @@ void Being::setSubtype(Uint16 subtype)
// Prevent showing errors when sprite doesn't exist
if (!ItemDB::exists(id))
+ {
id = -100;
+ setRaceName(_("Human"));
+ }
+ else
+ {
+ const ItemInfo &info = ItemDB::get(id);
+ setRaceName(info.getName());
+ }
setSprite(Net::getCharHandler()->baseSprite(), id);
}
diff --git a/src/being.h b/src/being.h
index 0b9257e83..859ebf26c 100644
--- a/src/being.h
+++ b/src/being.h
@@ -769,6 +769,12 @@ class Being : public ActorSprite, public ConfigListener
void updatePercentHP();
+ void setRaceName(std::string name)
+ { mRaceName = name; }
+
+ std::string getRaceName()
+ { return mRaceName; }
+
protected:
/**
* Sets the new path for this being.
@@ -804,6 +810,7 @@ class Being : public ActorSprite, public ConfigListener
Uint8 mSpriteDirection; /**< Facing direction */
std::string mName; /**< Name of character */
+ std::string mRaceName;
std::string mPartyName;
std::string mGuildName;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 19db5540a..b65068dc5 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -62,7 +62,7 @@ DebugWindow::DebugWindow():
setSaveVisible(true);
setStickyButtonLock(true);
- setDefaultSize(400, 150, ImageRect::CENTER);
+ setDefaultSize(400, 300, ImageRect::CENTER);
mTabs = new TabbedArea;
mMapWidget = new MapDebugTab;
@@ -269,9 +269,10 @@ TargetDebugTab::TargetDebugTab()
mTargetLabel = new Label(strprintf("%s ?", _("Target:")));
mTargetIdLabel = new Label(strprintf("%s ? ", _("Target Id:")));
- mTargetLevelLabel = new Label(strprintf("%s ?", _("Target Level:")));
- mTargetPartyLabel = new Label(strprintf("%s ?", _("Target Party:")));
- mTargetGuildLabel = new Label(strprintf("%s ?", _("Target Guild:")));
+ mTargetLevelLabel = new Label(strprintf("%s ?", _("Target level:")));
+ mTargetRaceLabel = new Label(strprintf("%s ?", _("Target race:")));
+ mTargetPartyLabel = new Label(strprintf("%s ?", _("Target party:")));
+ mTargetGuildLabel = new Label(strprintf("%s ?", _("Target guild:")));
mAttackDelayLabel = new Label(strprintf("%s ?", _("Attack delay:")));
mMinHitLabel = new Label(strprintf("%s ?", _("Minimal hit:")));
mMaxHitLabel = new Label(strprintf("%s ?", _("Maximum hit:")));
@@ -280,12 +281,13 @@ TargetDebugTab::TargetDebugTab()
place(0, 0, mTargetLabel, 2);
place(0, 1, mTargetIdLabel, 2);
place(0, 2, mTargetLevelLabel, 2);
- place(0, 3, mAttackDelayLabel, 2);
- place(0, 4, mTargetPartyLabel, 2);
- place(0, 5, mTargetGuildLabel, 2);
- place(0, 6, mMinHitLabel, 2);
- place(0, 7, mMaxHitLabel, 2);
- place(0, 8, mCriticalHitLabel, 2);
+ place(0, 3, mTargetRaceLabel, 2);
+ place(0, 4, mAttackDelayLabel, 2);
+ place(0, 5, mTargetPartyLabel, 2);
+ place(0, 6, mTargetGuildLabel, 2);
+ place(0, 7, mMinHitLabel, 2);
+ place(0, 8, mMaxHitLabel, 2);
+ place(0, 9, mCriticalHitLabel, 2);
place.getCell().matchColWidth(0, 0);
place = h.getPlacer(0, 1);
@@ -315,6 +317,9 @@ void TargetDebugTab::logic()
_("Target Level:")));
}
+ mTargetRaceLabel->setCaption(strprintf("%s %s",
+ _("Target race:"), target->getRaceName().c_str()));
+
mTargetPartyLabel->setCaption(strprintf("%s %s", _("Target Party:"),
target->getPartyName().c_str()));
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index ff86eaf74..8be6f1220 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -82,6 +82,7 @@ class TargetDebugTab : public DebugTab
Label *mTargetLabel;
Label *mTargetIdLabel;
Label *mTargetLevelLabel;
+ Label *mTargetRaceLabel;
Label *mTargetPartyLabel;
Label *mTargetGuildLabel;
Label *mAttackDelayLabel;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 25403e544..1964b974d 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -135,7 +135,13 @@ StatusWindow::StatusWindow():
setSaveVisible(true);
setStickyButtonLock(true);
setDefaultSize((windowContainer->getWidth() - 480) / 2,
- (windowContainer->getHeight() - 500) / 2, 480, 500);
+ (windowContainer->getHeight() - 500) / 2, 480, 500);
+
+ if (player_node && !player_node->getRaceName().empty())
+ {
+ setCaption(strprintf("%s (%s)", player_node->getName().c_str(),
+ player_node->getRaceName().c_str()));
+ }
// ----------------------
// Status Part