summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-26 20:08:44 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-28 21:17:59 +0300
commitc430b75e370a21a17f80d4ba3acd84111828a462 (patch)
tree6d4ea8421de26c623c4196a7dd2aa3d86c5add01 /src/gui
parent1dcb42c708c92216c7c9cacd3d3c9301e71e6006 (diff)
downloadmv-c430b75e370a21a17f80d4ba3acd84111828a462.tar.gz
mv-c430b75e370a21a17f80d4ba3acd84111828a462.tar.bz2
mv-c430b75e370a21a17f80d4ba3acd84111828a462.tar.xz
mv-c430b75e370a21a17f80d4ba3acd84111828a462.zip
add const for methods return values.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/equipmentwindow.h2
-rw-r--r--src/gui/popupmenu.cpp2
-rw-r--r--src/gui/quitdialog.cpp2
-rw-r--r--src/gui/sdlfont.cpp2
-rw-r--r--src/gui/sdlfont.h2
-rw-r--r--src/gui/skilldialog.cpp14
-rw-r--r--src/gui/skilldialog.h4
-rw-r--r--src/gui/viewport.h6
8 files changed, 17 insertions, 17 deletions
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 2d2e2ca81..5fd69c23a 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -85,7 +85,7 @@ class EquipmentWindow final : public Window, public gcn::ActionListener
void mousePressed(gcn::MouseEvent& mouseEvent) override;
- Item* getEquipment(int i) const A_WARN_UNUSED
+ const Item* getEquipment(const int i) const A_WARN_UNUSED
{ return mEquipment ? mEquipment->getEquipment(i) : nullptr; }
void setBeing(Being *const being);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index ed770047f..c12365cc6 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -1239,7 +1239,7 @@ void PopupMenu::handleLink(const std::string &link,
{
if (viewport)
{
- const Map *const map = viewport->getCurrentMap();
+ const Map *const map = viewport->getMap();
if (map)
{
SpecialLayer *const specialLayer = map->getSpecialLayer();
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index da67231d5..b601fe323 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -151,7 +151,7 @@ void QuitDialog::action(const gcn::ActionEvent &event)
{
if (viewport)
{
- const Map *const map = viewport->getCurrentMap();
+ const Map *const map = viewport->getMap();
if (map)
map->saveExtraLayer();
}
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index d332b59db..65ba14fc6 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -599,7 +599,7 @@ void SDLFont::doClean()
}
}
-TextChunkList *SDLFont::getCache() const
+const TextChunkList *SDLFont::getCache() const
{
return mCache;
}
diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h
index eedc4c6e0..55dafe744 100644
--- a/src/gui/sdlfont.h
+++ b/src/gui/sdlfont.h
@@ -125,7 +125,7 @@ class SDLFont final : public gcn::Font
int getHeight() const override A_WARN_UNUSED;
- TextChunkList *getCache() const A_WARN_UNUSED;
+ const TextChunkList *getCache() const A_WARN_UNUSED;
/**
* @see Font::drawString
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 1f36d6de9..672928551 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -629,14 +629,20 @@ void SkillDialog::addSkill(const int id, const int level, const int range,
}
}
-SkillInfo* SkillDialog::getSkill(const int id)
+SkillInfo* SkillDialog::getSkill(const int id) const
{
- return mSkills[id];
+ SkillMap::const_iterator it = mSkills.find(id);
+ if (it != mSkills.end())
+ return (*it).second;
+ return nullptr;
}
-SkillInfo* SkillDialog::getSkillByItem(const int itemId)
+SkillInfo* SkillDialog::getSkillByItem(const int itemId) const
{
- return mSkills[itemId - SKILL_MIN_ID];
+ SkillMap::const_iterator it = mSkills.find(itemId - SKILL_MIN_ID);
+ if (it != mSkills.end())
+ return (*it).second;
+ return nullptr;
}
void SkillDialog::widgetResized(const gcn::Event &event)
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 9406293a4..9715a3bf3 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -76,9 +76,9 @@ class SkillDialog final : public Window, public gcn::ActionListener
void addSkill(const int id, const int level, const int range,
const bool modifiable);
- SkillInfo* getSkill(const int id) A_WARN_UNUSED;
+ SkillInfo* getSkill(const int id) const A_WARN_UNUSED;
- SkillInfo* getSkillByItem(const int itemId) A_WARN_UNUSED;
+ SkillInfo* getSkillByItem(const int itemId) const A_WARN_UNUSED;
bool hasSkills() const A_WARN_UNUSED
{ return !mSkills.empty(); }
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 3d491e9c2..45b5fd753 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -229,12 +229,6 @@ class Viewport final : public WindowContainer,
void scrollBy(const int x, const int y)
{ mPixelViewX += x; mPixelViewY += y; }
- /**
- * Returns the current map object.
- */
- Map *getCurrentMap() const A_WARN_UNUSED
- { return mMap; }
-
int getDebugPath() const A_WARN_UNUSED
{ return mShowDebugPath; }