fixing some unused variables and hiding previous/class members warnings

This commit is contained in:
slavidodo 2020-05-07 19:05:16 +02:00
parent e3caaacc55
commit d95bde1c77
No known key found for this signature in database
GPG Key ID: 928CF529F1B314DA
10 changed files with 75 additions and 75 deletions

View File

@ -62,7 +62,7 @@ void LocalPlayer::lockWalk(int millis)
m_walkLockExpiration = std::max<int>(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)

View File

@ -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;
}
}

View File

@ -359,16 +359,16 @@ void MapView::updateVisibleTilesCache(int start)
}
} else {
// cache tiles in spiral mode
static std::vector<Point> m_spiral;
static std::vector<Point> 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<int>(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();
}

View File

@ -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<std::string> 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<std::string> 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<std::tuple<int, std::string> > 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<std::tuple<int, std::string> > 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)

View File

@ -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() { }

View File

@ -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<int>(y, (int)drawRect.top()));
drawRect.setLeft (std::min<int>(x, (int)drawRect.left()));
drawRect.setBottom(std::max<int>(y, (int)drawRect.bottom()));
drawRect.setRight (std::max<int>(x, (int)drawRect.right()));
drawRect.setTop (std::min<int>(fy, (int)drawRect.top()));
drawRect.setLeft (std::min<int>(fx, (int)drawRect.left()));
drawRect.setBottom(std::max<int>(fy, (int)drawRect.bottom()));
drawRect.setRight (std::max<int>(fx, (int)drawRect.right()));
}
}
}

View File

@ -30,7 +30,7 @@
#include "item.h"
#include <framework/luaengine/luaobject.h>
enum tileflags_t
enum tileflags_t : uint32
{
TILESTATE_NONE = 0,
TILESTATE_PROTECTIONZONE = 1 << 0,

View File

@ -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);

View File

@ -82,7 +82,7 @@ public:
LuaObjectPtr asLuaObject() { return static_self_cast<LuaObject>(); }
void operator=(const LuaObject& other) { }
void operator=(const LuaObject&) { }
private:
int m_fieldsTableRef;

View File

@ -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<int>(m_updateDisabled-1,0); }