summaryrefslogtreecommitdiff
path: root/src/gui/statuswindow.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-25 23:45:27 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-26 06:53:05 -0600
commit3be9cace41bcef4b7bf55bffea5d3596bd588e7e (patch)
tree174cb77c11ddf755eaea52bba836b496d177ff91 /src/gui/statuswindow.cpp
parent48754058d7be3f433734cb1524e9e74cfd4fd55f (diff)
downloadmana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.gz
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.bz2
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.xz
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.zip
Replace most dynamic_casts with static_casts
The remaining instances can't easily or safely be changed as the classes involved don't have type information like Being does. Reviewed-by: Freeyorp
Diffstat (limited to 'src/gui/statuswindow.cpp')
-rw-r--r--src/gui/statuswindow.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 7312078e..498a4523 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -46,7 +46,12 @@
class AttrDisplay : public Container
{
public:
+ enum Type {
+ DERIVED, CHANGEABLE, UNKNOWN
+ };
+
virtual std::string update();
+ virtual Type getType() { return UNKNOWN; }
protected:
AttrDisplay(int id, const std::string &name);
@@ -63,6 +68,7 @@ class DerDisplay : public AttrDisplay
{
public:
DerDisplay(int id, const std::string &name);
+ virtual Type getType() { return DERIVED; }
};
class ChangeDisplay : public AttrDisplay, gcn::ActionListener
@@ -70,6 +76,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener
public:
ChangeDisplay(int id, const std::string &name);
std::string update();
+ virtual Type getType() { return CHANGEABLE; }
void setPointsNeeded(int needed);
private:
@@ -269,9 +276,9 @@ void StatusWindow::setPointsNeeded(int id, int needed)
if (it != mAttrs.end())
{
- ChangeDisplay *disp = dynamic_cast<ChangeDisplay*>(it->second);
- if (disp)
- disp->setPointsNeeded(needed);
+ AttrDisplay *disp = it->second;
+ if (disp->getType() == AttrDisplay::CHANGEABLE)
+ static_cast<ChangeDisplay*>(disp)->setPointsNeeded(needed);
}
}