summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_players.cpp19
-rw-r--r--src/gui/setup_players.h2
-rw-r--r--src/gui/widgets/tablemodel.h9
3 files changed, 11 insertions, 19 deletions
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index ebe570bb..89c588c0 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -120,7 +120,7 @@ public:
return RELATION_CHOICE_COLUMN_WIDTH;
}
- virtual void playerRelationsUpdated()
+ void playerRelationsUpdated()
{
signalBeforeUpdate();
@@ -303,18 +303,11 @@ void Setup_Players::reset()
// We now have to search through the list of ignore choices to find the
// current selection. We could use an index into the table of config
// options in player_relations instead of strategies to sidestep this.
- int selection = 0;
- for (unsigned int i = 0;
- i < player_relations.getPlayerIgnoreStrategies().size();
- ++i)
- if (player_relations.getPlayerIgnoreStrategies()[i] ==
- player_relations.getPlayerIgnoreStrategy())
- {
-
- selection = i;
- break;
- }
+ const auto &strategies = player_relations.getPlayerIgnoreStrategies();
+ auto i = std::find(strategies.begin(), strategies.end(),
+ player_relations.getPlayerIgnoreStrategy());
+ int selection = i == strategies.end() ? 0 : i - strategies.begin();
mIgnoreActionChoicesBox->setSelected(selection);
}
@@ -401,7 +394,7 @@ void Setup_Players::action(const gcn::ActionEvent &event)
}
}
-void Setup_Players::updatedPlayer(const std::string &name)
+void Setup_Players::playerRelationsUpdated()
{
mPlayerTableModel->playerRelationsUpdated();
mDefaultTrading->setSelected(
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 90663029..758c646d 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -48,7 +48,7 @@ public:
void action(const gcn::ActionEvent &event) override;
- void updatedPlayer(const std::string &name) override;
+ void playerRelationsUpdated() override;
private:
StaticTableModel *mPlayerTableTitleModel;
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index 2e36992a..d4274e39 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -77,20 +77,19 @@ public:
*/
virtual gcn::Widget *getElementAt(int row, int column) const = 0;
- virtual void installListener(TableModelListener *listener);
-
- virtual void removeListener(TableModelListener *listener);
+ void installListener(TableModelListener *listener);
+ void removeListener(TableModelListener *listener);
protected:
/**
* Tells all listeners that the table is about to see an update
*/
- virtual void signalBeforeUpdate();
+ void signalBeforeUpdate();
/**
* Tells all listeners that the table has seen an update
*/
- virtual void signalAfterUpdate();
+ void signalAfterUpdate();
private:
std::set<TableModelListener *> listeners;