diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-28 01:59:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-28 01:59:04 +0300 |
commit | c79403e1341ac533df1771b866d1f5cee15e12b5 (patch) | |
tree | 5bed6dfb44f7fce0432bd7a7a28d2d23db07ce80 /src/gui/setup_relations.cpp | |
parent | 7c79aa2b8e484319e3e511fa21db6d2448347024 (diff) | |
download | plus-c79403e1341ac533df1771b866d1f5cee15e12b5.tar.gz plus-c79403e1341ac533df1771b866d1f5cee15e12b5.tar.bz2 plus-c79403e1341ac533df1771b866d1f5cee15e12b5.tar.xz plus-c79403e1341ac533df1771b866d1f5cee15e12b5.zip |
Add const to more classes.
Diffstat (limited to 'src/gui/setup_relations.cpp')
-rw-r--r-- | src/gui/setup_relations.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 635adebe2..b8b8627f1 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -141,7 +141,7 @@ public: signalBeforeUpdate(); freeWidgets(); - StringVect *player_names = player_relations.getPlayers(); + StringVect *const player_names = player_relations.getPlayers(); if (!player_names) return; @@ -154,10 +154,10 @@ public: player_names->size()); r < sz; ++r) { std::string name = (*player_names)[r]; - gcn::Widget *widget = new Label(name); + gcn::Widget *const widget = new Label(name); mWidgets.push_back(widget); - gcn::DropDown *choicebox = new DropDown(mListModel); + gcn::DropDown *const choicebox = new DropDown(mListModel); choicebox->setSelected(player_relations.getRelation(name)); mWidgets.push_back(choicebox); } @@ -165,10 +165,10 @@ public: signalAfterUpdate(); } - virtual void updateModelInRow(int row) + virtual void updateModelInRow(const int row) { - gcn::DropDown *choicebox = static_cast<gcn::DropDown *>( - getElementAt(row, RELATION_CHOICE_COLUMN)); + const gcn::DropDown *const choicebox = static_cast<gcn::DropDown *>( + getElementAt(row, RELATION_CHOICE_COLUMN)); player_relations.setRelation(getPlayerAt(row), static_cast<PlayerRelation::Relation>( choicebox->getSelected())); @@ -189,7 +189,7 @@ public: mWidgets.clear(); } - std::string getPlayerAt(int index) const + std::string getPlayerAt(const int index) const { if (index < 0 || index >= static_cast<signed>(mPlayers->size())) return ""; @@ -265,7 +265,7 @@ Setup_Relations::Setup_Relations(): mPlayerTable->setLinewiseSelection(true); mPlayerTable->addActionListener(this); - gcn::Label *ignore_action_label = new Label(_("When ignoring:")); + gcn::Label *const ignore_action_label = new Label(_("When ignoring:")); mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY); mIgnoreActionChoicesBox->addActionListener(this); @@ -333,9 +333,8 @@ void Setup_Relations::apply() { player_relations.store(); - unsigned int old_default_relations = player_relations.getDefault() & - ~(PlayerRelation::TRADE | - PlayerRelation::WHISPER); + const unsigned int old_default_relations = player_relations.getDefault() & + ~(PlayerRelation::TRADE | PlayerRelation::WHISPER); player_relations.setDefault(old_default_relations | (mDefaultTrading->isSelected() ? PlayerRelation::TRADE : 0) @@ -363,7 +362,7 @@ void Setup_Relations::action(const gcn::ActionEvent &event) // embarrassing.) player_relations.removeListener(this); - int row = mPlayerTable->getSelectedRow(); + const int row = mPlayerTable->getSelectedRow(); if (row >= 0) mPlayerTableModel->updateModelInRow(row); @@ -372,7 +371,7 @@ void Setup_Relations::action(const gcn::ActionEvent &event) } else if (event.getId() == ACTION_DELETE) { - int player_index = mPlayerTable->getSelectedRow(); + const int player_index = mPlayerTable->getSelectedRow(); if (player_index < 0) return; @@ -383,9 +382,9 @@ void Setup_Relations::action(const gcn::ActionEvent &event) } else if (event.getId() == ACTION_STRATEGY) { - PlayerIgnoreStrategy *s = + PlayerIgnoreStrategy *const s = (*player_relations.getPlayerIgnoreStrategies())[ - mIgnoreActionChoicesBox->getSelected()]; + mIgnoreActionChoicesBox->getSelected()]; player_relations.setPlayerIgnoreStrategy(s); } @@ -404,7 +403,7 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED) void Setup_Relations::updateAll() { - PlayerTableModel *model = new PlayerTableModel(); + PlayerTableModel *const model = new PlayerTableModel(); mPlayerTable->setModel(model); delete mPlayerTableModel; mPlayerTableModel = model; |