diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp index 04a83b9d..2d2e53b1 100644 --- a/src/client/localplayer.cpp +++ b/src/client/localplayer.cpp @@ -62,7 +62,7 @@ void LocalPlayer::lockWalk(int millis) m_walkLockExpiration = std::max(m_walkLockExpiration, (ticks_t) g_clock.millis() + millis); } -bool LocalPlayer::canWalk(Otc::Direction direction) +bool LocalPlayer::canWalk(Otc::Direction) { // cannot walk while locked if(m_walkLockExpiration != 0 && g_clock.millis() < m_walkLockExpiration) diff --git a/src/client/map.cpp b/src/client/map.cpp index ff2b797d..0a7e6cb6 100644 --- a/src/client/map.cpp +++ b/src/client/map.cpp @@ -362,12 +362,12 @@ void Map::cleanTile(const Position& pos) notificateTileUpdate(pos); } } - for(auto it = m_staticTexts.begin();it != m_staticTexts.end();) { - const StaticTextPtr& staticText = *it; + for(auto itt = m_staticTexts.begin();itt != m_staticTexts.end();) { + const StaticTextPtr& staticText = *itt; if(staticText->getPosition() == pos && staticText->getMessageMode() == Otc::MessageNone) - it = m_staticTexts.erase(it); + itt = m_staticTexts.erase(itt); else - ++it; + ++itt; } } diff --git a/src/client/mapview.cpp b/src/client/mapview.cpp index 905fc797..eb12a587 100644 --- a/src/client/mapview.cpp +++ b/src/client/mapview.cpp @@ -359,16 +359,16 @@ void MapView::updateVisibleTilesCache(int start) } } else { // cache tiles in spiral mode - static std::vector m_spiral; + static std::vector spiral; if(start == 0) { - m_spiral.resize(m_drawDimension.area()); + spiral.resize(m_drawDimension.area()); int width = m_drawDimension.width(); int height = m_drawDimension.height(); int tpx = width/2 - 2; int tpy = height/2 - 2; int count = 0; Rect area(0, 0, m_drawDimension); - m_spiral[count++] = Point(tpx+1,tpy+1); + spiral[count++] = Point(tpx+1,tpy+1); for(int step = 1; tpx >= 0 || tpy >= 0; ++step, --tpx, --tpy) { int qs = 2*step; Rect lines[4] = { @@ -385,19 +385,19 @@ void MapView::updateVisibleTilesCache(int start) int ey = std::min(line.bottom(), area.bottom()); for(int qx=sx;qx<=ex;++qx) for(int qy=sy;qy<=ey;++qy) - m_spiral[count++] = Point(qx, qy); + spiral[count++] = Point(qx, qy); } } } - for(m_updateTilesPos = start; m_updateTilesPos < (int)m_spiral.size(); ++m_updateTilesPos) { + for(m_updateTilesPos = start; m_updateTilesPos < (int)spiral.size(); ++m_updateTilesPos) { // avoid rendering too much tiles at once if((int)m_cachedVisibleTiles.size() > MAX_TILE_DRAWS) { stop = true; break; } - const Point& p = m_spiral[m_updateTilesPos]; + const Point& p = spiral[m_updateTilesPos]; Position tilePos = cameraPosition.translated(p.x - m_virtualCenterOffset.x, p.y - m_virtualCenterOffset.y); tilePos.coveredUp(cameraPosition.z - iz); if(const TilePtr& tile = g_map.getTile(tilePos)) { @@ -479,12 +479,12 @@ void MapView::updateGeometry(const Size& visibleDimension, const Size& optimized requestVisibleTilesCacheUpdate(); } -void MapView::onTileUpdate(const Position& pos) +void MapView::onTileUpdate(const Position&) { requestVisibleTilesCacheUpdate(); } -void MapView::onMapCenterChange(const Position& pos) +void MapView::onMapCenterChange(const Position&) { requestVisibleTilesCacheUpdate(); } diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 3e0ab451..48b49dc6 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -444,13 +444,13 @@ void ProtocolGame::parseLogin(const InputMessagePtr& msg) g_game.processLogin(); } -void ProtocolGame::parsePendingGame(const InputMessagePtr& msg) +void ProtocolGame::parsePendingGame(const InputMessagePtr&) { //set player to pending game state g_game.processPendingGame(); } -void ProtocolGame::parseEnterGame(const InputMessagePtr& msg) +void ProtocolGame::parseEnterGame(const InputMessagePtr&) { //set player to entered game state g_game.processEnterGame(); @@ -469,7 +469,7 @@ void ProtocolGame::parseStoreButtonIndicators(const InputMessagePtr& msg) void ProtocolGame::parseSetStoreDeepLink(const InputMessagePtr& msg) { - int currentlyFeaturedServiceType = msg->getU8(); + msg->getU8(); // currentlyFeaturedServiceType } void ProtocolGame::parseBlessings(const InputMessagePtr& msg) @@ -480,22 +480,21 @@ void ProtocolGame::parseBlessings(const InputMessagePtr& msg) void ProtocolGame::parsePreset(const InputMessagePtr& msg) { - uint32 preset = msg->getU32(); + msg->getU32(); // preset } void ProtocolGame::parseRequestPurchaseData(const InputMessagePtr& msg) { - int transactionId = msg->getU32(); - int productType = msg->getU8(); + msg->getU32(); // transactionId + msg->getU8(); // productType } void ProtocolGame::parseStore(const InputMessagePtr& msg) { parseCoinBalance(msg); - // Parse all categories - int count = msg->getU16(); - for(int i = 0; i < count; i++) { + int categories = msg->getU16(); + for(int i = 0; i < categories; i++) { std::string category = msg->getString(); std::string description = msg->getString(); @@ -505,14 +504,14 @@ void ProtocolGame::parseStore(const InputMessagePtr& msg) std::vector icons; int iconCount = msg->getU8(); - for(int i = 0; i < iconCount; i++) { + for(int j = 0; j < iconCount; j++) { std::string icon = msg->getString(); icons.push_back(icon); } // If this is a valid category name then // the category we just parsed is a child of that - std::string parentCategory = msg->getString(); + msg->getString(); } } @@ -547,7 +546,7 @@ void ProtocolGame::parseCompleteStorePurchase(const InputMessagePtr& msg) int coins = msg->getU32(); int transferableCoins = msg->getU32(); - g_logger.info(stdext::format("Purchase Complete: %s", message)); + g_logger.info(stdext::format("Purchase Complete: %s\nAvailable coins: %d (transferable: %d)", message, coins, transferableCoins)); } void ProtocolGame::parseStoreTransactionHistory(const InputMessagePtr &msg) @@ -555,10 +554,10 @@ void ProtocolGame::parseStoreTransactionHistory(const InputMessagePtr &msg) int currentPage; if(g_game.getClientVersion() <= 1096) { currentPage = msg->getU16(); - bool hasNextPage = msg->getU8() == 1; + msg->getU8(); // hasNextPage (bool) } else { currentPage = msg->getU32(); - int pageCount = msg->getU32(); + msg->getU32(); // pageCount } int entries = msg->getU8(); @@ -573,42 +572,43 @@ void ProtocolGame::parseStoreTransactionHistory(const InputMessagePtr &msg) void ProtocolGame::parseStoreOffers(const InputMessagePtr& msg) { - std::string categoryName = msg->getString(); + msg->getString(); // categoryName int offers = msg->getU16(); for(int i = 0; i < offers; i++) { - int offerId = msg->getU32(); - std::string offerName = msg->getString(); - std::string offerDescription = msg->getString(); + msg->getU32(); // offerId + msg->getString(); // offerName + msg->getString(); // offerDescription - int price = msg->getU32(); + msg->getU32(); // price int highlightState = msg->getU8(); if(highlightState == 2 && g_game.getFeature(Otc::GameIngameStoreHighlights) && g_game.getClientVersion() >= 1097) { - int saleValidUntilTimestamp = msg->getU32(); - int basePrice = msg->getU32(); + msg->getU32(); // saleValidUntilTimestamp + msg->getU32(); // basePrice } int disabledState = msg->getU8(); - std::string disabledReason = ""; if(g_game.getFeature(Otc::GameIngameStoreHighlights) && disabledState == 1) { - disabledReason = msg->getString(); + msg->getString(); // disabledReason } - int icons = msg->getU8(); - for(int j = 0; j < icons; j++) { + std::vector icons; + int iconCount = msg->getU8(); + for(int j = 0; j < iconCount; j++) { std::string icon = msg->getString(); + icons.push_back(icon); } int subOffers = msg->getU16(); for(int j = 0; j < subOffers; j++) { - std::string name = msg->getString(); - std::string description = msg->getString(); + msg->getString(); // name + msg->getString(); // description int subIcons = msg->getU8(); for(int k = 0; k < subIcons; k++) { - std::string icon = msg->getString(); + msg->getString(); // icon } - std::string serviceType = msg->getString(); + msg->getString(); // serviceType } } } @@ -1306,7 +1306,7 @@ void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg) { bool premium = msg->getU8(); // premium if(g_game.getFeature(Otc::GamePremiumExpiration)) - int premiumEx = msg->getU32(); // premium expiration used for premium advertisement + msg->getU32(); // premium expiration used for premium advertisement int vocation = msg->getU8(); // vocation int spellCount = msg->getU16(); @@ -1353,13 +1353,13 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg) if(g_game.getFeature(Otc::GameExperienceBonus)) { if(g_game.getClientVersion() <= 1096) { - double experienceBonus = msg->getDouble(); + msg->getDouble(); // experienceBonus } else { - int baseXpGain = msg->getU16(); - int voucherAddend = msg->getU16(); - int grindingAddend = msg->getU16(); - int storeBoostAddend = msg->getU16(); - int huntingBoostFactor = msg->getU16(); + msg->getU16(); // baseXpGain + msg->getU16(); // voucherAddend + msg->getU16(); // grindingAddend + msg->getU16(); // storeBoostAddend + msg->getU16(); // huntingBoostFactor } } @@ -1650,14 +1650,14 @@ void ProtocolGame::parseTextMessage(const InputMessagePtr& msg) switch(mode) { case Otc::MessageChannelManagement: { - int channel = msg->getU16(); + msg->getU16(); // channelId text = msg->getString(); break; } case Otc::MessageGuild: case Otc::MessagePartyManagement: case Otc::MessageParty: { - int channel = msg->getU16(); + msg->getU16(); // channelId text = msg->getString(); break; } @@ -1938,7 +1938,7 @@ void ProtocolGame::parsePlayerInventory(const InputMessagePtr& msg) void ProtocolGame::parseModalDialog(const InputMessagePtr& msg) { - uint32 id = msg->getU32(); + uint32 windowId = msg->getU32(); std::string title = msg->getString(); std::string message = msg->getString(); @@ -1946,16 +1946,16 @@ void ProtocolGame::parseModalDialog(const InputMessagePtr& msg) std::vector > buttonList; for(int i = 0; i < sizeButtons; ++i) { std::string value = msg->getString(); - int id = msg->getU8(); - buttonList.emplace_back(id, value); + int buttonId = msg->getU8(); + buttonList.push_back(std::make_tuple(buttonId, value)); } int sizeChoices = msg->getU8(); std::vector > choiceList; for(int i = 0; i < sizeChoices; ++i) { std::string value = msg->getString(); - int id = msg->getU8(); - choiceList.emplace_back(id, value); + int choideId = msg->getU8(); + choiceList.push_back(std::make_tuple(choideId, value)); } int enterButton, escapeButton; @@ -1970,7 +1970,7 @@ void ProtocolGame::parseModalDialog(const InputMessagePtr& msg) bool priority = msg->getU8() == 0x01; - g_game.processModalDialog(id, title, message, buttonList, enterButton, escapeButton, choiceList, priority); + g_game.processModalDialog(windowId, title, message, buttonList, enterButton, escapeButton, choiceList, priority); } void ProtocolGame::parseExtendedOpcode(const InputMessagePtr& msg) diff --git a/src/client/thing.h b/src/client/thing.h index c0554800..1df7e090 100644 --- a/src/client/thing.h +++ b/src/client/thing.h @@ -36,9 +36,9 @@ public: Thing(); virtual ~Thing() { } - virtual void draw(const Point& dest, float scaleFactor, bool animate, LightView *lightView = nullptr) { } + virtual void draw(const Point& /*dest*/, float /*scaleFactor*/, bool /*animate*/, LightView* /*lightView*/ = nullptr) { } - virtual void setId(uint32 id) { } + virtual void setId(uint32 /*id*/) { } void setPosition(const Position& position); virtual uint32 getId() { return 0; } @@ -123,7 +123,7 @@ public: bool isTopEffect() { return rawGetThingType()->isTopEffect(); } MarketData getMarketData() { return rawGetThingType()->getMarketData(); } - virtual void onPositionChange(const Position& newPos, const Position& oldPos) { } + virtual void onPositionChange(const Position& /*newPos*/, const Position& /*oldPos*/) { } virtual void onAppear() { } virtual void onDisappear() { } diff --git a/src/client/thingtype.cpp b/src/client/thingtype.cpp index bd51b6b6..64ef4b48 100644 --- a/src/client/thingtype.cpp +++ b/src/client/thingtype.cpp @@ -311,8 +311,8 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS stdext::throw_exception("a thing type has more than 4096 sprites"); m_spritesIndex.resize((totalSpritesCount+totalSprites)); - for(int i = totalSpritesCount; i < (totalSpritesCount+totalSprites); i++) - m_spritesIndex[i] = g_game.getFeature(Otc::GameSpritesU32) ? fin->getU32() : fin->getU16(); + for(int j = totalSpritesCount; j < (totalSpritesCount+totalSprites); j++) + m_spritesIndex[j] = g_game.getFeature(Otc::GameSpritesU32) ? fin->getU32() : fin->getU16(); totalSpritesCount += totalSprites; } @@ -476,14 +476,14 @@ const TexturePtr& ThingType::getTexture(int animationPhase) } Rect drawRect(framePos + Point(m_size.width(), m_size.height()) * Otc::TILE_PIXELS - Point(1,1), framePos); - for(int x = framePos.x; x < framePos.x + m_size.width() * Otc::TILE_PIXELS; ++x) { - for(int y = framePos.y; y < framePos.y + m_size.height() * Otc::TILE_PIXELS; ++y) { - uint8 *p = fullImage->getPixel(x,y); + for(int fx = framePos.x; fx < framePos.x + m_size.width() * Otc::TILE_PIXELS; ++fx) { + for(int fy = framePos.y; fy < framePos.y + m_size.height() * Otc::TILE_PIXELS; ++fy) { + uint8 *p = fullImage->getPixel(fx,fy); if(p[3] != 0x00) { - drawRect.setTop (std::min(y, (int)drawRect.top())); - drawRect.setLeft (std::min(x, (int)drawRect.left())); - drawRect.setBottom(std::max(y, (int)drawRect.bottom())); - drawRect.setRight (std::max(x, (int)drawRect.right())); + drawRect.setTop (std::min(fy, (int)drawRect.top())); + drawRect.setLeft (std::min(fx, (int)drawRect.left())); + drawRect.setBottom(std::max(fy, (int)drawRect.bottom())); + drawRect.setRight (std::max(fx, (int)drawRect.right())); } } } diff --git a/src/client/tile.h b/src/client/tile.h index ad1a695a..736fb888 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -30,7 +30,7 @@ #include "item.h" #include -enum tileflags_t +enum tileflags_t : uint32 { TILESTATE_NONE = 0, TILESTATE_PROTECTIONZONE = 1 << 0, diff --git a/src/framework/luaengine/luainterface.h b/src/framework/luaengine/luainterface.h index e55e6f4c..6ec0a32c 100644 --- a/src/framework/luaengine/luainterface.h +++ b/src/framework/luaengine/luainterface.h @@ -306,7 +306,7 @@ public: bool isTable(int index = -1); bool isFunction(int index = -1); bool isCFunction(int index = -1); - bool isLuaFunction(int index = -1) { return (isFunction() && !isCFunction()); } + bool isLuaFunction(int index = -1) { return (isFunction(index) && !isCFunction(index)); } bool isUserdata(int index = -1); bool toBoolean(int index = -1); diff --git a/src/framework/luaengine/luaobject.h b/src/framework/luaengine/luaobject.h index a35849e7..d5038b3c 100644 --- a/src/framework/luaengine/luaobject.h +++ b/src/framework/luaengine/luaobject.h @@ -82,7 +82,7 @@ public: LuaObjectPtr asLuaObject() { return static_self_cast(); } - void operator=(const LuaObject& other) { } + void operator=(const LuaObject&) { } private: int m_fieldsTableRef; diff --git a/src/framework/ui/uilayout.h b/src/framework/ui/uilayout.h index a8eafeec..221f091f 100644 --- a/src/framework/ui/uilayout.h +++ b/src/framework/ui/uilayout.h @@ -36,9 +36,9 @@ public: void update(); void updateLater(); - virtual void applyStyle(const OTMLNodePtr& styleNode) { } - virtual void addWidget(const UIWidgetPtr& widget) { } - virtual void removeWidget(const UIWidgetPtr& widget) { } + virtual void applyStyle(const OTMLNodePtr& /*styleNode*/) { } + virtual void addWidget(const UIWidgetPtr& /*widget*/) { } + virtual void removeWidget(const UIWidgetPtr& /*widget*/) { } void disableUpdates() { m_updateDisabled++; } void enableUpdates() { m_updateDisabled = std::max(m_updateDisabled-1,0); }