summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:02 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-08 22:47:02 +0300
commit8daa939a45794c26a33e109c13c4d6f58a46e00e (patch)
treefa0c2f40eec569816cfa2565f1070ddd90f57bf3
parent6d4da51f0fdcecc2d4398f60dbca43f499fdbe16 (diff)
downloadmanaverse-8daa939a45794c26a33e109c13c4d6f58a46e00e.tar.gz
manaverse-8daa939a45794c26a33e109c13c4d6f58a46e00e.tar.bz2
manaverse-8daa939a45794c26a33e109c13c4d6f58a46e00e.tar.xz
manaverse-8daa939a45794c26a33e109c13c4d6f58a46e00e.zip
Fix code style in being
-rw-r--r--src/being/actorsprite.cpp6
-rw-r--r--src/being/being.cpp24
-rw-r--r--src/being/being.h11
-rw-r--r--src/being/compoundsprite.cpp4
-rw-r--r--src/being/localplayer.cpp6
-rw-r--r--src/being/playerinfo.cpp4
-rw-r--r--src/being/playerinfo.h4
-rw-r--r--src/being/playerrelations.cpp4
8 files changed, 29 insertions, 34 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 75d337bd5..936885ed2 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -149,11 +149,11 @@ void ActorSprite::setTargetType(const TargetCursorType type)
else
{
const TargetCursorSize sz = getTargetCursorSize();
- mUsedTargetCursor = targetCursor[type][sz];
+ mUsedTargetCursor = targetCursor[static_cast<int>(type)][sz];
if (mUsedTargetCursor)
{
- mCursorPaddingX = targetWidths[sz];
- mCursorPaddingY = targetHeights[sz];
+ mCursorPaddingX = static_cast<int>(targetWidths[sz]);
+ mCursorPaddingY = static_cast<int>(targetHeights[sz]);
}
}
}
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 182bf3947..8b1c8a7ba 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1948,7 +1948,7 @@ void Being::updateSprite(const unsigned int slot, const int id,
if (slot >= Net::getCharServerHandler()->maxSprite())
return;
- if (slot >= mSpriteIDs.size())
+ if (slot >= static_cast<unsigned int>(mSpriteIDs.size()))
mSpriteIDs.resize(slot + 1, 0);
if (slot && mSpriteIDs[slot] == id)
@@ -1963,16 +1963,16 @@ void Being::setSprite(const unsigned int slot, const int id,
if (slot >= Net::getCharServerHandler()->maxSprite())
return;
- if (slot >= size())
+ if (slot >= static_cast<unsigned int>(size()))
ensureSize(slot + 1);
- if (slot >= mSpriteIDs.size())
+ if (slot >= static_cast<unsigned int>(mSpriteIDs.size()))
mSpriteIDs.resize(slot + 1, 0);
- if (slot >= mSpriteColors.size())
+ if (slot >= static_cast<unsigned int>(mSpriteColors.size()))
mSpriteColors.resize(slot + 1, "");
- if (slot >= mSpriteColorsIds.size())
+ if (slot >= static_cast<unsigned int>(mSpriteColorsIds.size()))
mSpriteColorsIds.resize(slot + 1, 1);
// disabled for now, because it may broke replace/reorder sprites logic
@@ -2258,7 +2258,9 @@ void Being::setGender(const Gender gender)
mGender = gender;
// Reload all subsprites
- for (unsigned int i = 0; i < mSpriteIDs.size(); i++)
+ for (unsigned int i = 0;
+ i < static_cast<unsigned int>(mSpriteIDs.size());
+ i++)
{
if (mSpriteIDs.at(i) != 0)
setSprite(i, mSpriteIDs.at(i), mSpriteColors.at(i));
@@ -2317,8 +2319,8 @@ void Being::drawSprites(Graphics *const graphics,
void Being::drawSpritesSDL(Graphics *const graphics,
int posX, int posY) const
{
- const size_t sz = size();
- for (unsigned f = 0; f < sz; f ++)
+ const unsigned int sz = static_cast<unsigned int>(size());
+ for (unsigned int f = 0; f < sz; f ++)
{
const int rSprite = mSpriteHide[mSpriteRemap[f]];
if (rSprite == 1)
@@ -2503,7 +2505,7 @@ void Being::recalcSpritesOrder()
return;
// logger->log("recalcSpritesOrder");
- const unsigned sz = static_cast<unsigned>(size());
+ const size_t sz = size();
if (sz < 1)
return;
@@ -2522,7 +2524,7 @@ void Being::recalcSpritesOrder()
const unsigned int hairSlot = Net::getCharServerHandler()->hairSprite();
- for (unsigned slot = 0; slot < sz; slot ++)
+ for (size_t slot = 0; slot < sz; slot ++)
{
oldHide[slot] = mSpriteHide[slot];
mSpriteHide[slot] = 0;
@@ -2531,7 +2533,7 @@ void Being::recalcSpritesOrder()
const size_t spriteIdSize = mSpriteIDs.size();
- for (unsigned slot = 0; slot < sz; slot ++)
+ for (size_t slot = 0; slot < sz; slot ++)
{
slotRemap.push_back(slot);
diff --git a/src/being/being.h b/src/being/being.h
index 2a6ec9195..208b2b56b 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -25,6 +25,8 @@
#include "resources/beinginfo.h"
+#include "being/gender.h"
+
#include <map>
#include "localconsts.h"
@@ -55,15 +57,6 @@ struct ParticleInfo;
extern volatile int cur_time;
-enum Gender
-{
- GENDER_MALE = 0,
- GENDER_FEMALE = 1,
- GENDER_UNSPECIFIED = 2,
- GENDER_OTHER = 3
-};
-
-
struct NextSoundInfo
{
NextSoundInfo() :
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index 26a2268f3..91da283a4 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -288,7 +288,7 @@ void CompoundSprite::ensureSize(size_t layerCount)
*/
unsigned int CompoundSprite::getCurrentFrame(unsigned int layer) const
{
- if (layer >= mSprites.size())
+ if (layer >= static_cast<unsigned int>(mSprites.size()))
return 0;
const Sprite *const s = getSprite(layer);
@@ -303,7 +303,7 @@ unsigned int CompoundSprite::getCurrentFrame(unsigned int layer) const
*/
unsigned int CompoundSprite::getFrameCount(unsigned int layer)
{
- if (layer >= mSprites.size())
+ if (layer >= static_cast<unsigned int>(mSprites.size()))
return 0;
const Sprite *const s = getSprite(layer);
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index f8efd716e..7a364072c 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -948,7 +948,7 @@ void LocalPlayer::handleStatusEffect(const StatusEffect *const effect,
if (!sprite)
{
// delete sprite, if necessary
- for (unsigned int i = 0; i < mStatusEffectIcons.size(); )
+ for (size_t i = 0; i < mStatusEffectIcons.size(); )
{
if (mStatusEffectIcons[i] == effectId)
{
@@ -1168,7 +1168,7 @@ void LocalPlayer::moveToTarget(int dist)
}
const size_t sz = debugPath.size();
- if (sz < static_cast<unsigned int>(dist))
+ if (sz < static_cast<size_t>(dist))
return;
limit = static_cast<int>(sz) - dist;
gotPos = true;
@@ -3766,7 +3766,7 @@ void LocalPlayer::setTestParticle(const std::string &fileName,
}
if (!fileName.empty())
{
- mTestParticle = particleEngine->addEffect(fileName, 0, 0, false);
+ mTestParticle = particleEngine->addEffect(fileName, 0, 0, 0);
controlParticle(mTestParticle);
if (updateHash)
mTestParticleHash = UpdaterWindow::getFileHash(mTestParticleName);
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 8f91c16db..fdbad89a5 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -200,7 +200,7 @@ void setInventoryItem(const int index, const int id,
const int amount, const int refine)
{
bool equipment = false;
- const int itemType = ItemDB::get(id).getType();
+ const ItemType itemType = ItemDB::get(id).getType();
if (itemType != ITEM_UNUSABLE && itemType != ITEM_USABLE)
equipment = true;
if (mInventory)
@@ -411,7 +411,7 @@ void gameDestroyed()
delete2(mEquipment);
}
-void stateChange(const int state)
+void stateChange(const State state)
{
if (state == STATE_GAME)
{
diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h
index bb7b89141..02dc4897c 100644
--- a/src/being/playerinfo.h
+++ b/src/being/playerinfo.h
@@ -23,11 +23,11 @@
#define BEING_PLAYERINFO_H
#include "equipment.h"
+#include "state.h"
#include <map>
#include <string>
-
/**
* Stat information storage structure.
*/
@@ -243,7 +243,7 @@ namespace PlayerInfo
void gameDestroyed();
- void stateChange(const int state);
+ void stateChange(const State state);
void triggerAttr(const int id, const int old);
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index f1804e2b0..41d14c2ea 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -268,8 +268,8 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
else
{
const PlayerRelation *const r = (*it).second;
- unsigned int permissions =
- PlayerRelation::RELATION_PERMISSIONS[r->mRelation];
+ unsigned int permissions = PlayerRelation::RELATION_PERMISSIONS[
+ static_cast<int>(r->mRelation)];
switch (r->mRelation)
{