From 366e0b120624cb382fd3b233b8ec7a75c31a2da4 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 17 Feb 2009 20:33:28 +0100 Subject: Got rid of const where it does not make much sense It's not that useful to make variables that are passed by value const. In the declaration it is even completely ignored. --- src/gui/color.cpp | 6 +++--- src/gui/color.h | 12 ++++++------ src/gui/equipmentwindow.cpp | 2 +- src/gui/equipmentwindow.h | 2 +- src/gui/itemcontainer.cpp | 2 +- src/gui/itemcontainer.h | 2 +- src/gui/npcintegerdialog.cpp | 4 ++-- src/gui/npcintegerdialog.h | 4 ++-- src/units.cpp | 6 +++--- src/units.h | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gui/color.cpp b/src/gui/color.cpp index 02469893..31fa8ea4 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -52,7 +52,7 @@ Color::~Color() } } -void Color::setColor(const char c, const int rgb) +void Color::setColor(char c, int rgb) { for (ColVector::iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -67,7 +67,7 @@ void Color::setColor(const char c, const int rgb) } } -int Color::getColor(const char c, bool &valid) const +int Color::getColor(char c, bool &valid) const { for (ColVector::const_iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -102,7 +102,7 @@ char Color::getColorCharAt(int i) return mColVector[i].ch; } -void Color::addColor(const char c, const int rgb, const std::string &text) +void Color::addColor(char c, int rgb, const std::string &text) { int trueRgb = (int) config.getValue("Color" + text, rgb); mColVector.push_back(ColorElem(c, trueRgb, text)); diff --git a/src/gui/color.h b/src/gui/color.h index 8684a1a7..2816cedc 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -46,7 +46,7 @@ class Color : public gcn::ListModel * @param c charater to be replaced * @param rgb color to replace character */ - void setColor(const char c, const int rgb); + void setColor(char c, int rgb); /** * Define the color replacement for a character @@ -56,7 +56,7 @@ class Color : public gcn::ListModel * @param g green component * @param b blue component */ - void setColor(const char c, const int r, const int g, const int b) + void setColor(char c, int r, int g, int b) { setColor(c, (r << 16) | (g << 8) | b); } @@ -67,12 +67,12 @@ class Color : public gcn::ListModel * @param c character requested * @param valid indicate whether character is known */ - int getColor(const char c, bool &valid) const; + int getColor(char c, bool &valid) const; /** * Return the number of colors known */ - int getNumberOfElements() {return mColVector.size(); } + int getNumberOfElements() { return mColVector.size(); } /** * Return the name of the ith color @@ -111,7 +111,7 @@ class Color : public gcn::ListModel private: struct ColorElem { - ColorElem(const char c, const int rgb, const std::string &text) : + ColorElem(char c, int rgb, const std::string &text) : ch(c), rgb(rgb), text(text) {} char ch; int rgb; @@ -128,7 +128,7 @@ class Color : public gcn::ListModel * @param rgb default color if not found in config * @param text identifier of color */ - void addColor(const char c, const int rgb, const std::string &text); + void addColor(char c, int rgb, const std::string &text); }; extern Color *textColor; diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index ae60eaf7..7361f7ab 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -156,7 +156,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event) } } -Item* EquipmentWindow::getItem(const int &x, const int &y) +Item* EquipmentWindow::getItem(int x, int y) const { for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++) { diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index c491062a..24438477 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -89,7 +89,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); - Item* getItem(const int &x, const int &y); + Item* getItem(int x, int y) const; Equipment *mEquipment; Inventory *mInventory; diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 2894ca26..6e73731b 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -277,7 +277,7 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event) mItemPopup->setVisible(false); } -int ItemContainer::getSlotIndex(const int posX, const int posY) const +int ItemContainer::getSlotIndex(int posX, int posY) const { int columns = getWidth() / gridWidth; int index = posX / gridWidth + ((posY / gridHeight) * columns) + mOffset; diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 71fcc5d0..5ad140be 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -137,7 +137,7 @@ class ItemContainer : public gcn::Widget, * @param posY The Y Coordinate position. * @return The slot index on success, -1 on failure. */ - int getSlotIndex(const int posX, const int posY) const; + int getSlotIndex(int posX, int posY) const; Inventory *mInventory; Image *mSelImg; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 6b26349a..463f46ae 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -63,7 +63,7 @@ NpcIntegerDialog::NpcIntegerDialog(): setLocationRelativeTo(getParent()); } -void NpcIntegerDialog::setRange(const int min, const int max) +void NpcIntegerDialog::setRange(int min, int max) { mValueField->setRange(min, max); } @@ -109,7 +109,7 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) } } -void NpcIntegerDialog::setDefaultValue(const int value) +void NpcIntegerDialog::setDefaultValue(int value) { mValueField->setDefaultValue(value); } diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h index 7c064ca6..941bb55a 100644 --- a/src/gui/npcintegerdialog.h +++ b/src/gui/npcintegerdialog.h @@ -59,14 +59,14 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener * @param min The minimum value to allow * @param max The maximum value to allow */ - void setRange(const int min, const int max); + void setRange(int min, int max); /** * Sets the default value. * * @param value The new default value */ - void setDefaultValue(const int value); + void setDefaultValue(int value); /** * Checks whether NpcStringDialog is Focused or not. diff --git a/src/units.cpp b/src/units.cpp index 3c02fb05..f4bc01b7 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -159,7 +159,7 @@ void Units::loadUnits() } } -std::string formatUnit(const int value, const int type) +std::string formatUnit(int value, int type) { struct UnitDescription ud = units[type]; struct UnitLevel ul; @@ -222,12 +222,12 @@ std::string formatUnit(const int value, const int type) } } -std::string Units::formatCurrency(const int value) +std::string Units::formatCurrency(int value) { return formatUnit(value, UNIT_CURRENCY); } -std::string Units::formatWeight(const int value) +std::string Units::formatWeight(int value) { return formatUnit(value, UNIT_WEIGHT); } diff --git a/src/units.h b/src/units.h index 67e027de..6aa07b70 100644 --- a/src/units.h +++ b/src/units.h @@ -35,12 +35,12 @@ class Units /** * Formats the given number in the correct currency format. */ - static std::string formatCurrency(const int value); + static std::string formatCurrency(int value); /** * Formats the given number in the correct weight/mass format. */ - static std::string formatWeight(const int value); + static std::string formatWeight(int value); }; #endif // UNITS_H -- cgit v1.2.3-70-g09d2