summaryrefslogtreecommitdiff
path: root/src/gui/models
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/gui/models
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadmanaverse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
manaverse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
manaverse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
manaverse-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/beingslistmodel.h2
-rw-r--r--src/gui/models/colormodel.cpp8
-rw-r--r--src/gui/models/extendednamesmodel.cpp8
-rw-r--r--src/gui/models/iconsmodel.h2
-rw-r--r--src/gui/models/ignorechoiceslistmodel.h2
-rw-r--r--src/gui/models/itemsmodel.h2
-rw-r--r--src/gui/models/modelistmodel.h4
-rw-r--r--src/gui/models/namesmodel.cpp4
-rw-r--r--src/gui/models/playertablemodel.cpp8
-rw-r--r--src/gui/models/serverslistmodel.h4
-rw-r--r--src/gui/models/shopitems.cpp10
-rw-r--r--src/gui/models/shopitems.h2
-rw-r--r--src/gui/models/skillmodel.cpp2
-rw-r--r--src/gui/models/skillmodel.h2
-rw-r--r--src/gui/models/updatelistmodel.h2
-rw-r--r--src/gui/models/worldlistmodel.h2
16 files changed, 32 insertions, 32 deletions
diff --git a/src/gui/models/beingslistmodel.h b/src/gui/models/beingslistmodel.h
index 953c78119..ccf0338c7 100644
--- a/src/gui/models/beingslistmodel.h
+++ b/src/gui/models/beingslistmodel.h
@@ -55,7 +55,7 @@ class BeingsListModel final : public AvatarListModel
int getNumberOfElements() override final
{
- return static_cast<int>(mMembers.size());
+ return CAST_S32(mMembers.size());
}
std::vector<Avatar*> mMembers;
diff --git a/src/gui/models/colormodel.cpp b/src/gui/models/colormodel.cpp
index 88dee3c93..046d69a92 100644
--- a/src/gui/models/colormodel.cpp
+++ b/src/gui/models/colormodel.cpp
@@ -38,22 +38,22 @@ ColorModel::~ColorModel()
int ColorModel::getNumberOfElements()
{
- return static_cast<int>(mNames.size());
+ return CAST_S32(mNames.size());
}
std::string ColorModel::getElementAt(int i)
{
if (i >= getNumberOfElements() || i < 0)
return "???";
- return mNames[static_cast<size_t>(i)];
+ return mNames[CAST_SIZE(i)];
}
const ColorPair *ColorModel::getColorAt(const int i) const
{
- if (i >= static_cast<int>(mColors.size()) || i < 0)
+ if (i >= CAST_S32(mColors.size()) || i < 0)
return &mColors[0];
- return &mColors[static_cast<size_t>(i)];
+ return &mColors[CAST_SIZE(i)];
}
void ColorModel::add(const std::string &name, const Color *const color1,
diff --git a/src/gui/models/extendednamesmodel.cpp b/src/gui/models/extendednamesmodel.cpp
index ac65c8b21..28eececc4 100644
--- a/src/gui/models/extendednamesmodel.cpp
+++ b/src/gui/models/extendednamesmodel.cpp
@@ -35,22 +35,22 @@ ExtendedNamesModel::~ExtendedNamesModel()
int ExtendedNamesModel::getNumberOfElements()
{
- return static_cast<int>(mNames.size());
+ return CAST_S32(mNames.size());
}
std::string ExtendedNamesModel::getElementAt(int i)
{
if (i >= getNumberOfElements() || i < 0)
return "???";
- return mNames[static_cast<size_t>(i)];
+ return mNames[CAST_SIZE(i)];
}
const Image *ExtendedNamesModel::getImageAt(int i)
{
- if (i >= static_cast<int>(mImages.size()) || i < 0)
+ if (i >= CAST_S32(mImages.size()) || i < 0)
return nullptr;
- return mImages[static_cast<size_t>(i)];
+ return mImages[CAST_SIZE(i)];
}
void ExtendedNamesModel::clear()
diff --git a/src/gui/models/iconsmodel.h b/src/gui/models/iconsmodel.h
index d9cb0be5a..a04703149 100644
--- a/src/gui/models/iconsmodel.h
+++ b/src/gui/models/iconsmodel.h
@@ -70,7 +70,7 @@ class IconsModel final : public ListModel
int getNumberOfElements() override final
{
- return static_cast<int>(mStrings.size());
+ return CAST_S32(mStrings.size());
}
std::string getElementAt(int i) override final
diff --git a/src/gui/models/ignorechoiceslistmodel.h b/src/gui/models/ignorechoiceslistmodel.h
index fc87a7690..8a8a7f053 100644
--- a/src/gui/models/ignorechoiceslistmodel.h
+++ b/src/gui/models/ignorechoiceslistmodel.h
@@ -39,7 +39,7 @@ class IgnoreChoicesListModel final : public ListModel
int getNumberOfElements() override final
{
- return static_cast<int>(player_relations.
+ return CAST_S32(player_relations.
getPlayerIgnoreStrategies()->size());
}
diff --git a/src/gui/models/itemsmodel.h b/src/gui/models/itemsmodel.h
index 96fe37b7c..032a090eb 100644
--- a/src/gui/models/itemsmodel.h
+++ b/src/gui/models/itemsmodel.h
@@ -69,7 +69,7 @@ class ItemsModal final : public ListModel
int getNumberOfElements() override final
{
- return static_cast<int>(mStrings.size());
+ return CAST_S32(mStrings.size());
}
std::string getElementAt(int i) override final
diff --git a/src/gui/models/modelistmodel.h b/src/gui/models/modelistmodel.h
index e74dcb69f..9e5339a3d 100644
--- a/src/gui/models/modelistmodel.h
+++ b/src/gui/models/modelistmodel.h
@@ -43,13 +43,13 @@ class ModeListModel final : public ListModel
* Returns the number of elements in container.
*/
int getNumberOfElements() override final
- { return static_cast<int>(mVideoModes.size()); }
+ { return CAST_S32(mVideoModes.size()); }
/**
* Returns element from container.
*/
std::string getElementAt(int i) override final
- { return mVideoModes[static_cast<size_t>(i)]; }
+ { return mVideoModes[CAST_SIZE(i)]; }
/**
* Returns the index corresponding to the given video mode.
diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp
index a66cea6b2..2e7606274 100644
--- a/src/gui/models/namesmodel.cpp
+++ b/src/gui/models/namesmodel.cpp
@@ -35,14 +35,14 @@ NamesModel::~NamesModel()
int NamesModel::getNumberOfElements()
{
- return static_cast<int>(mNames.size());
+ return CAST_S32(mNames.size());
}
std::string NamesModel::getElementAt(int i)
{
if (i >= getNumberOfElements() || i < 0)
return "???";
- return mNames[static_cast<size_t>(i)];
+ return mNames[CAST_SIZE(i)];
}
void NamesModel::fillFromArray(const char *const *const arr, std::size_t sz)
diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp
index c4a438c4c..80eab3694 100644
--- a/src/gui/models/playertablemodel.cpp
+++ b/src/gui/models/playertablemodel.cpp
@@ -67,7 +67,7 @@ PlayerTableModel::~PlayerTableModel()
int PlayerTableModel::getRows() const
{
if (mPlayers)
- return static_cast<int>(mPlayers->size());
+ return CAST_S32(mPlayers->size());
else
return 0;
}
@@ -100,7 +100,7 @@ void PlayerTableModel::playerRelationsUpdated()
mPlayers = player_names;
// set up widgets
- for (unsigned int r = 0, sz = static_cast<unsigned int>(
+ for (unsigned int r = 0, sz = CAST_U32(
player_names->size()); r < sz; ++r)
{
const std::string name = (*player_names)[r];
@@ -108,7 +108,7 @@ void PlayerTableModel::playerRelationsUpdated()
mWidgets.push_back(widget);
DropDown *const choicebox = new DropDown(this, mListModel);
- choicebox->setSelected(static_cast<int>(
+ choicebox->setSelected(CAST_S32(
player_relations.getRelation(name)));
mWidgets.push_back(choicebox);
}
@@ -140,7 +140,7 @@ void PlayerTableModel::freeWidgets()
std::string PlayerTableModel::getPlayerAt(const int index) const
{
if (!mPlayers || index < 0
- || index >= static_cast<signed>(mPlayers->size()))
+ || index >= CAST_S32(mPlayers->size()))
{
return std::string();
}
diff --git a/src/gui/models/serverslistmodel.h b/src/gui/models/serverslistmodel.h
index d41f54bf9..15d3d7e9a 100644
--- a/src/gui/models/serverslistmodel.h
+++ b/src/gui/models/serverslistmodel.h
@@ -56,7 +56,7 @@ class ServersListModel final : public ListModel
int getNumberOfElements() override final A_WARN_UNUSED
{
MutexLocker lock = mParent->lock();
- return static_cast<int>(mServers->size());
+ return CAST_S32(mServers->size());
}
/**
@@ -80,7 +80,7 @@ class ServersListModel final : public ListModel
void setVersionString(const int index, const std::string &version)
{
- if (index < 0 || index >= static_cast<int>(mVersionStrings.size()))
+ if (index < 0 || index >= CAST_S32(mVersionStrings.size()))
return;
if (version.empty() || !gui)
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 52515ea5b..952e5fe19 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -42,8 +42,8 @@ ShopItems::~ShopItems()
std::string ShopItems::getElementAt(int i)
{
- if (i < 0 || static_cast<unsigned>(i)
- >= static_cast<unsigned int>(mShopItems.size()) || !mShopItems.at(i))
+ if (i < 0 || CAST_U32(i)
+ >= CAST_U32(mShopItems.size()) || !mShopItems.at(i))
{
return "";
}
@@ -105,7 +105,7 @@ ShopItem *ShopItems::addItem2(const int inventoryIndex,
ShopItem *ShopItems::at(unsigned int i) const
{
- if (i >= static_cast<unsigned int>(mShopItems.size()))
+ if (i >= CAST_U32(mShopItems.size()))
return nullptr;
return mShopItems.at(i);
@@ -125,7 +125,7 @@ bool ShopItems::findInAllItems(std::vector<ShopItem*>::iterator &it,
void ShopItems::erase(const unsigned int i)
{
- if (i >= static_cast<unsigned int>(mShopItems.size()))
+ if (i >= CAST_U32(mShopItems.size()))
return;
const ShopItem *const item = *(mShopItems.begin() + i);
@@ -137,7 +137,7 @@ void ShopItems::erase(const unsigned int i)
void ShopItems::del(const unsigned int i)
{
- if (i >= static_cast<unsigned int>(mShopItems.size()))
+ if (i >= CAST_U32(mShopItems.size()))
return;
ShopItem *item = *(mShopItems.begin() + i);
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index 5224566e5..c75fee7e1 100644
--- a/src/gui/models/shopitems.h
+++ b/src/gui/models/shopitems.h
@@ -92,7 +92,7 @@ class ShopItems final : public ListModel
* Returns the number of items in the shop.
*/
int getNumberOfElements() override final A_WARN_UNUSED
- { return static_cast<int>(mShopItems.size()); }
+ { return CAST_S32(mShopItems.size()); }
bool empty() const A_WARN_UNUSED
{ return mShopItems.empty(); }
diff --git a/src/gui/models/skillmodel.cpp b/src/gui/models/skillmodel.cpp
index d26283ef0..7e49de9a3 100644
--- a/src/gui/models/skillmodel.cpp
+++ b/src/gui/models/skillmodel.cpp
@@ -34,7 +34,7 @@ SkillModel::SkillModel() :
SkillInfo *SkillModel::getSkillAt(const int i) const
{
- if (i < 0 || i >= static_cast<int>(mVisibleSkills.size()))
+ if (i < 0 || i >= CAST_S32(mVisibleSkills.size()))
return nullptr;
return mVisibleSkills.at(i);
}
diff --git a/src/gui/models/skillmodel.h b/src/gui/models/skillmodel.h
index fd75c4ea7..d7695253d 100644
--- a/src/gui/models/skillmodel.h
+++ b/src/gui/models/skillmodel.h
@@ -38,7 +38,7 @@ class SkillModel final : public ListModel
std::string getElementAt(int i) override final;
int getNumberOfElements() override final
- { return static_cast<int>(mVisibleSkills.size()); }
+ { return CAST_S32(mVisibleSkills.size()); }
void addSkill(SkillInfo *const info)
{ mSkills.push_back(info); }
diff --git a/src/gui/models/updatelistmodel.h b/src/gui/models/updatelistmodel.h
index 194812958..67fffc34e 100644
--- a/src/gui/models/updatelistmodel.h
+++ b/src/gui/models/updatelistmodel.h
@@ -47,7 +47,7 @@ class UpdateListModel final : public ListModel
{
if (!mLoginData)
return 0;
- return static_cast<int>(mLoginData->updateHosts.size());
+ return CAST_S32(mLoginData->updateHosts.size());
}
std::string getElementAt(int i) override final
diff --git a/src/gui/models/worldlistmodel.h b/src/gui/models/worldlistmodel.h
index 1c78232cc..035824cb4 100644
--- a/src/gui/models/worldlistmodel.h
+++ b/src/gui/models/worldlistmodel.h
@@ -47,7 +47,7 @@ class WorldListModel final : public ListModel
int getNumberOfElements() override final
{
- return static_cast<int>(mWorlds.size());
+ return CAST_S32(mWorlds.size());
}
std::string getElementAt(int i) override final