summaryrefslogtreecommitdiff
path: root/src/gui/setup_players.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
commit5afe88df2538274859a162ffd63ed52118e80c19 (patch)
treeb610dfd58dc748fd63f49565b2a43eea2316714f /src/gui/setup_players.cpp
parent73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff)
downloadmana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz
mana-5afe88df2538274859a162ffd63ed52118e80c19.zip
Apply C++11 fixits
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
Diffstat (limited to 'src/gui/setup_players.cpp')
-rw-r--r--src/gui/setup_players.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index ad50baad..a3b0ef53 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -70,14 +70,14 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] =
class PlayerRelationListModel : public gcn::ListModel
{
public:
- virtual ~PlayerRelationListModel() { }
+ ~PlayerRelationListModel() override { }
- virtual int getNumberOfElements()
+ int getNumberOfElements() override
{
return PlayerRelation::RELATIONS_NR;
}
- virtual std::string getElementAt(int i)
+ std::string getElementAt(int i) override
{
if (i >= getNumberOfElements() || i < 0)
return "";
@@ -89,35 +89,35 @@ class PlayerTableModel : public TableModel
{
public:
PlayerTableModel() :
- mPlayers(NULL),
+ mPlayers(nullptr),
mListModel(new PlayerRelationListModel)
{
playerRelationsUpdated();
}
- virtual ~PlayerTableModel()
+ ~PlayerTableModel() override
{
freeWidgets();
delete mListModel;
delete mPlayers;
}
- virtual int getRows() const
+ int getRows() const override
{
return mPlayers->size();
}
- virtual int getColumns() const
+ int getColumns() const override
{
return COLUMNS_NR;
}
- virtual int getRowHeight() const
+ int getRowHeight() const override
{
return ROW_HEIGHT;
}
- virtual int getColumnWidth(int index) const
+ int getColumnWidth(int index) const override
{
if (index == NAME_COLUMN)
return NAME_COLUMN_WIDTH;
@@ -151,7 +151,7 @@ public:
virtual void updateModelInRow(int row)
{
- gcn::DropDown *choicebox = static_cast<gcn::DropDown *>(
+ auto *choicebox = static_cast<gcn::DropDown *>(
getElementAt(row, RELATION_CHOICE_COLUMN));
player_relations.setRelation(getPlayerAt(row),
static_cast<PlayerRelation::Relation>(
@@ -159,7 +159,7 @@ public:
}
- virtual gcn::Widget *getElementAt(int row, int column) const
+ gcn::Widget *getElementAt(int row, int column) const override
{
return mWidgets[WIDGET_AT(row, column)];
}
@@ -168,7 +168,7 @@ public:
{
if (mPlayers)
delete mPlayers;
- mPlayers = NULL;
+ mPlayers = nullptr;
delete_all(mWidgets);
mWidgets.clear();
@@ -191,14 +191,14 @@ protected:
class IgnoreChoicesListModel : public gcn::ListModel
{
public:
- virtual ~IgnoreChoicesListModel() { }
+ ~IgnoreChoicesListModel() override { }
- virtual int getNumberOfElements()
+ int getNumberOfElements() override
{
return player_relations.getPlayerIgnoreStrategies()->size();
}
- virtual std::string getElementAt(int i)
+ std::string getElementAt(int i) override
{
if (i >= getNumberOfElements())
return _("???");