diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-02 21:38:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-02 21:40:43 +0300 |
commit | 4cffca0da71771d0d51ba4cd4842d2d93aa2946e (patch) | |
tree | 99b974a5bab64174ebd29ef7a4761caef01acec8 /src | |
parent | 1dab21b236d76900f3ddd2be32f9590aef394c2d (diff) | |
download | plus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.gz plus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.bz2 plus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.xz plus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.zip |
Fix some conversions.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 8 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/npcdialog.h | 2 | ||||
-rw-r--r-- | src/gui/questswindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/whoisonline.cpp | 4 | ||||
-rw-r--r-- | src/guichan/color.cpp | 6 | ||||
-rw-r--r-- | src/guichan/sdl/sdlgraphics.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 6 | ||||
-rw-r--r-- | src/utils/mathutils.h | 2 |
10 files changed, 22 insertions, 19 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 37839c7ee..d029b7083 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -96,7 +96,8 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mCreateButton(new Button(_("Create"), "create", this)), mCancelButton(new Button(_("Cancel"), "cancel", this)), mRace(0), - mPlayer(new Being(0, ActorSprite::PLAYER, mRace, nullptr)), + mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace), + nullptr)), mPlayerBox(new PlayerBox(mPlayer, "charcreate_playerbox.xml")), mSlot(slot), mAction(0), diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 5ed18f84e..1289fcd40 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -228,11 +228,11 @@ void Minimap::draw(gcn::Graphics *graphics) mMapImage->mBounds.h > a.height) { const Vector &p = player_node->getPosition(); - mMapOriginX = (a.width / 2) - (static_cast<float>(p.x - + viewport->getCameraRelativeX()) * mWidthProportion) / 32; + mMapOriginX = (a.width / 2) - (p.x + static_cast<float>( + viewport->getCameraRelativeX()) * mWidthProportion) / 32; - mMapOriginY = (a.height / 2) - (static_cast<float>(p.y - + viewport->getCameraRelativeY()) * mHeightProportion) / 32; + mMapOriginY = (a.height / 2) - (p.y + static_cast<float>( + viewport->getCameraRelativeY()) * mHeightProportion) / 32; const int minOriginX = a.width - mMapImage->mBounds.w; const int minOriginY = a.height - mMapImage->mBounds.h; diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 35c219846..57501a35f 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -690,7 +690,7 @@ void NpcDialog::restoreCamera() mCameraMode = -1; } -void NpcDialog::showAvatar(const int avatarId) +void NpcDialog::showAvatar(const uint16_t avatarId) { const bool needShow = (avatarId != 0); if (needShow) diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 86b6bdabd..be021d50f 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -192,7 +192,7 @@ class NpcDialog final : public Window, public gcn::ActionListener, void refocus(); - void showAvatar(const int avatarId); + void showAvatar(const uint16_t avatarId); void setAvatarDirection(const uint8_t direction); diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index 66a7d50cf..c9e05cd14 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -331,9 +331,9 @@ void QuestsWindow::rebuild(const bool playSound) } if (updatedQuest == -1) - updatedQuest = mQuestLinks.size() - 1; + updatedQuest = static_cast<int>(mQuestLinks.size() - 1); else if (updatedQuest >= static_cast<int>(mQuestLinks.size())) - updatedQuest = mQuestLinks.size() - 1; + updatedQuest = static_cast<int>(mQuestLinks.size() - 1); if (updatedQuest >= 0) { mQuestsListBox->setSelected(updatedQuest); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index d3fcfa451..b522b8157 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -409,8 +409,8 @@ void WhoIsOnline::loadWebList() if (!mShowLevel) level = 0; - OnlinePlayer *player = new OnlinePlayer(nick, 255, level, - GENDER_UNSPECIFIED, -1); + OnlinePlayer *player = new OnlinePlayer(nick, + static_cast<char>(255), level, GENDER_UNSPECIFIED, -1); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); diff --git a/src/guichan/color.cpp b/src/guichan/color.cpp index 7cc3b887a..87d110b63 100644 --- a/src/guichan/color.cpp +++ b/src/guichan/color.cpp @@ -106,9 +106,9 @@ namespace gcn Color Color::operator*(const float value) const { - Color result(static_cast<int>(r * value), - static_cast<int>(g * value), - static_cast<int>(b * value), + Color result(static_cast<int>(static_cast<float>(r) * value), + static_cast<int>(static_cast<float>(g) * value), + static_cast<int>(static_cast<float>(b) * value), a); result.r = (result.r > 255 ? 255 : (result.r < 0 ? 0 : result.r)); diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 952be9093..482642e30 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -596,8 +596,8 @@ namespace gcn const ClipRectangle& top = mClipStack.top(); - destination.x += top.xOffset; - destination.y += top.yOffset; + destination.x += static_cast<int16_t>(top.xOffset); + destination.y += static_cast<int16_t>(top.yOffset); SDL_BlitSurface(surface, &source, mTarget, &destination); } diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 4e3763042..e8c9dfaff 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -217,10 +217,12 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); - const int hairColor = msg.readInt16(); + int hairColor = msg.readInt16(); + if (hairColor > 255) + hairColor = 255; tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); - tempPlayer->setHairColor(hairColor); + tempPlayer->setHairColor(static_cast<unsigned char>(hairColor)); const int misc2 = msg.readInt16(); tempPlayer->setName(msg.readString(24)); diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index caed0d2f8..aa6dcecea 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -116,7 +116,7 @@ inline float weightedAverage(const float n1, const float n2, const float w) inline int roundDouble(const double v) { - return (v > 0.0) ? (v + 0.5) : (v - 0.5); + return (v > 0.0) ? static_cast<int>(v + 0.5) : static_cast<int>(v - 0.5); } inline int powerOfTwo(const int input) |