summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Bradshaw <daniel+commits@the-cell.co.uk>2010-01-26 21:02:20 +0000
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-01-28 10:19:12 +0100
commitca2950fb8bffa9924aa49ab1d4729dbc2a391752 (patch)
treed95f92db525f415a4107ed8704b75368b70da967
parent8d299d86c1209be6084e0d78c0454c946874e00f (diff)
downloadmana-client-ca2950fb8bffa9924aa49ab1d4729dbc2a391752.tar.gz
mana-client-ca2950fb8bffa9924aa49ab1d4729dbc2a391752.tar.bz2
mana-client-ca2950fb8bffa9924aa49ab1d4729dbc2a391752.tar.xz
mana-client-ca2950fb8bffa9924aa49ab1d4729dbc2a391752.zip
Added virtual destructors, some implicit casts, and a couple of type changes.
Many warnings removed. Reviewed-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
-rw-r--r--src/animatedsprite.h2
-rw-r--r--src/being.cpp8
-rw-r--r--src/being.h4
-rw-r--r--src/beingmanager.cpp2
-rw-r--r--src/configuration.h2
-rw-r--r--src/equipment.h1
-rw-r--r--src/gui/statuswindow.cpp2
-rw-r--r--src/gui/widgets/slider.cpp3
-rw-r--r--src/gui/widgets/tablemodel.h2
-rw-r--r--src/localplayer.cpp6
-rw-r--r--src/localplayer.h2
-rw-r--r--src/monster.cpp2
-rw-r--r--src/net/adminhandler.h2
-rw-r--r--src/net/charhandler.h2
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/download.cpp6
-rw-r--r--src/net/gamehandler.h2
-rw-r--r--src/net/generalhandler.h2
-rw-r--r--src/net/guildhandler.h2
-rw-r--r--src/net/inventoryhandler.h2
-rw-r--r--src/net/loginhandler.h2
-rw-r--r--src/net/messagehandler.h2
-rw-r--r--src/net/messagein.h2
-rw-r--r--src/net/messageout.h2
-rw-r--r--src/net/net.cpp3
-rw-r--r--src/net/npchandler.h2
-rw-r--r--src/net/partyhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/specialhandler.h2
-rw-r--r--src/net/tradehandler.h2
-rw-r--r--src/player.cpp2
-rw-r--r--src/units.cpp2
32 files changed, 60 insertions, 21 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index cdf88ceb..b1d2ef36 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -56,7 +56,7 @@ class AnimatedSprite
/**
* Destructor.
*/
- ~AnimatedSprite();
+ virtual ~AnimatedSprite();
/**
* Resets the animated sprite.
diff --git a/src/being.cpp b/src/being.cpp
index de334291..b30194e4 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -127,8 +127,8 @@ void Being::setPosition(const Vector &pos)
updateCoords();
if (mText)
- mText->adviseXY(pos.x,
- pos.y - getHeight() - mText->getHeight() - 6);
+ mText->adviseXY((int)pos.x,
+ (int)pos.y - getHeight() - mText->getHeight() - 6);
}
#ifdef EATHENA_SUPPORT
@@ -507,7 +507,7 @@ void Being::nextStep()
mX = pos.x;
mY = pos.y;
setAction(WALK);
- mWalkTime += mWalkSpeed / 10;
+ mWalkTime += (int)(mWalkSpeed / 10);
}
#endif
@@ -808,7 +808,7 @@ int Being::getOffset(char pos, char neg) const
if (mAction != WALK || !(mDirection & (pos | neg)))
return 0;
- int offset = (get_elapsed_time(mWalkTime) * 32) / mWalkSpeed;
+ int offset = (int)((get_elapsed_time(mWalkTime) * 32) / mWalkSpeed);
// We calculate the offset _from_ the _target_ location
offset -= 32;
diff --git a/src/being.h b/src/being.h
index c564482a..d7e9063f 100644
--- a/src/being.h
+++ b/src/being.h
@@ -392,7 +392,7 @@ class Being : public Sprite, public ConfigListener
* Returns the X coordinate in pixels.
*/
int getPixelX() const
- { return mPos.x; }
+ { return (int) mPos.x; }
/**
* Returns the Y coordinate in pixels.
@@ -400,7 +400,7 @@ class Being : public Sprite, public ConfigListener
* @see Sprite::getPixelY()
*/
int getPixelY() const
- { return mPos.y; }
+ { return (int) mPos.y; }
/**
* Sets the position of this being.
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 7c2ddc44..a14c2452 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -243,7 +243,7 @@ Being *BeingManager::findNearestLivingBeing(Being *aroundBeing, int maxDist,
Being::Type type) const
{
const Vector &pos = aroundBeing->getPosition();
- return findNearestLivingBeing(pos.x, pos.y, maxDist, type);
+ return findNearestLivingBeing((int)pos.x, (int)pos.y, maxDist, type);
}
bool BeingManager::hasBeing(Being *being) const
diff --git a/src/configuration.h b/src/configuration.h
index b9720b94..152352c6 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -64,6 +64,8 @@ class ConfigurationListManager
*/
virtual CONT readConfigItem(ConfigurationObject *obj,
CONT container) = 0;
+
+ virtual ~ConfigurationListManager() {}
};
/**
diff --git a/src/equipment.h b/src/equipment.h
index d8f12551..3363d2e8 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -59,6 +59,7 @@ class Equipment
public:
virtual Item *getEquipment(int index) const = 0;
virtual void clear() = 0;
+ virtual ~Backend() { }
};
/**
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 5d464c6b..f8613e80 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -376,7 +376,7 @@ void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax)
if (g1 > 255) g1 = 255;
if (b1 > 255) b1 = 255;
- bar->setColor(r1, g1, b1);
+ bar->setColor((int)r1,(int)g1, (int)b1);
}
bar->setProgress((float) player_node->getHp() / (float) player_node->getMaxHp());
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 693ac0f7..e78055dd 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -209,4 +209,5 @@ void Slider::mouseEntered(gcn::MouseEvent& event)
void Slider::mouseExited(gcn::MouseEvent& event)
{
mHasMouse = false;
-} \ No newline at end of file
+}
+
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index 129d2089..c2943cf2 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -40,6 +40,8 @@ public:
* \param completed whether we are signalling the end of the update
*/
virtual void modelUpdated(bool completed) = 0;
+
+ virtual ~TableModelListener() {}
};
/**
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 8ea6af61..8846d385 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -636,10 +636,10 @@ void LocalPlayer::stopWalking(bool sendToServer)
#ifdef MANASERV_SUPPORT
mLocalWalkTime = 0;
#endif
- setDestination(getPosition().x, getPosition().y);
+ setDestination((int) getPosition().x, (int) getPosition().y);
if (sendToServer)
- Net::getPlayerHandler()->setDestination(getPosition().x,
- getPosition().y);
+ Net::getPlayerHandler()->setDestination((int) getPosition().x,
+ (int) getPosition().y);
setAction(STAND);
}
diff --git a/src/localplayer.h b/src/localplayer.h
index 75de274c..ac97b35f 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -404,7 +404,7 @@ class LocalPlayer : public Player
bool mInStorage; /**< Whether storage is currently accessible */
- Uint16 mAttackRange;
+ int mAttackRange;
int mTargetTime; /** How long the being has been targeted **/
int mLastTarget; /** Time stamp of last targeting action, -1 if none. */
diff --git a/src/monster.cpp b/src/monster.cpp
index fd3c220e..57a6f229 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -74,7 +74,7 @@ void Monster::logic()
#ifdef EATHENA_SUPPORT
if (mAction != STAND)
{
- mFrame = (get_elapsed_time(mWalkTime) * 4) / getWalkSpeed();
+ mFrame = (int) ((get_elapsed_time(mWalkTime) * 4) / getWalkSpeed());
if (mFrame >= 4 && mAction != DEAD)
nextStep();
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 26ef59ba..1a19088d 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -49,6 +49,8 @@ class AdminHandler
virtual void mute(int playerId, int type, int limit) = 0;
+ virtual ~AdminHandler() {}
+
// TODO
};
diff --git a/src/net/charhandler.h b/src/net/charhandler.h
index 52ae2b51..c3ebff79 100644
--- a/src/net/charhandler.h
+++ b/src/net/charhandler.h
@@ -61,6 +61,8 @@ class CharHandler
virtual unsigned int hairSprite() const = 0;
virtual unsigned int maxSprite() const = 0;
+
+ virtual ~CharHandler() {}
};
} // namespace Net
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index d7e36c8a..f62c1899 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -53,6 +53,8 @@ class ChatHandler
virtual void kickUser(int channelId, const std::string &name) = 0;
virtual void who() = 0;
+
+ virtual ~ChatHandler() {}
};
}
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 9a1dcdd1..3c9d8e0f 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -158,12 +158,12 @@ int Download::downloadProgress(void *clientp, double dltotal, double dlnow,
if (d->mOptions.cancel)
{
- return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_CANCELLED, dltotal,
- dlnow);
+ return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_CANCELLED, (size_t) dltotal,
+ (size_t) dlnow);
return -5;
}
- return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_IDLE, dltotal, dlnow);
+ return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_IDLE, (size_t) dltotal, (size_t) dlnow);
}
int Download::downloadThread(void *ptr)
diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h
index 113da6b1..d7190c63 100644
--- a/src/net/gamehandler.h
+++ b/src/net/gamehandler.h
@@ -48,6 +48,8 @@ class GameHandler
virtual void ping(int tick) = 0;
virtual bool removeDeadBeings() const = 0;
+
+ virtual ~GameHandler() {}
};
} // namespace Net
diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h
index 1da1fddf..4b799f40 100644
--- a/src/net/generalhandler.h
+++ b/src/net/generalhandler.h
@@ -42,6 +42,8 @@ class GeneralHandler
virtual void guiWindowsUnloaded() = 0;
virtual void clearHandlers() = 0;
+
+ virtual ~GeneralHandler() {}
};
} // namespace Net
diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h
index da44e6cd..b1d9d027 100644
--- a/src/net/guildhandler.h
+++ b/src/net/guildhandler.h
@@ -56,6 +56,8 @@ class GuildHandler
bool response) = 0;
virtual void endAlliance(int guildId, int otherGuildId) = 0;
+
+ virtual ~GuildHandler() {}
};
}
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index 520e390e..a5a3204c 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -62,6 +62,8 @@ class InventoryHandler
StorageType destination) = 0;
virtual size_t getSize(StorageType type) const = 0;
+
+ virtual ~InventoryHandler() {}
};
} // namespace Net
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index 7fedae57..51fdc81a 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -92,6 +92,8 @@ class LoginHandler
virtual Worlds getWorlds() const = 0;
+ virtual ~LoginHandler () {}
+
protected:
ServerInfo mServer;
};
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index bf022afd..80f84b99 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -39,6 +39,8 @@ class MessageHandler
const Uint16 *handledMessages;
virtual void handleMessage(MessageIn &msg) = 0;
+
+ virtual ~MessageHandler() {}
};
}
diff --git a/src/net/messagein.h b/src/net/messagein.h
index fe48a455..cf0cc9e1 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -86,6 +86,8 @@ class MessageIn
*/
virtual std::string readString(int length = -1);
+ virtual ~MessageIn() {}
+
protected:
/**
* Constructor.
diff --git a/src/net/messageout.h b/src/net/messageout.h
index d4769335..de74dc43 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -56,6 +56,8 @@ class MessageOut
*/
virtual unsigned int getDataSize() const;
+ virtual ~MessageOut() {}
+
protected:
/**
* Constructor.
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 9c05595d..593d9cb7 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -199,4 +199,5 @@ void unload()
}
}
-} // namespace Net \ No newline at end of file
+} // namespace Net
+
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index e0199ebc..db7bdd7f 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -55,6 +55,8 @@ class NpcHandler
virtual void sellItem(int beingId, int itemId, int amount) = 0;
virtual void endShopping(int beingId) = 0;
+
+ virtual ~NpcHandler() {}
};
} // namespace Net
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 8f3489eb..3add4ad9 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -69,6 +69,8 @@ class PartyHandler
// virtual void options() = 0;
// virtual void message() = 0;
+
+ virtual ~PartyHandler() {}
};
} // namespace Net
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 895e3164..d190be01 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -60,6 +60,8 @@ class PlayerHandler
virtual bool canCorrectAttributes() = 0;
virtual int getJobLocation() = 0;
+
+ virtual ~PlayerHandler() {}
};
} // namespace Net
diff --git a/src/net/specialhandler.h b/src/net/specialhandler.h
index 602003aa..57381cf5 100644
--- a/src/net/specialhandler.h
+++ b/src/net/specialhandler.h
@@ -35,6 +35,8 @@ class SpecialHandler
virtual void use(int id, int level, int x, int y) = 0;
virtual void use(int id, const std::string &map) = 0;
+
+ virtual ~SpecialHandler () {}
};
}
diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h
index 5bad1b11..866d365d 100644
--- a/src/net/tradehandler.h
+++ b/src/net/tradehandler.h
@@ -45,6 +45,8 @@ class TradeHandler
virtual void finish() {}
virtual void cancel() {}
+
+ virtual ~TradeHandler() {}
};
}
diff --git a/src/player.cpp b/src/player.cpp
index 152e2919..007a398c 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -83,7 +83,7 @@ void Player::logic()
break;
case WALK:
- mFrame = (get_elapsed_time(mWalkTime) * 6) / getWalkSpeed();
+ mFrame = (int) ((get_elapsed_time(mWalkTime) * 6) / getWalkSpeed());
if (mFrame >= 6)
nextStep();
break;
diff --git a/src/units.cpp b/src/units.cpp
index ac252fcd..57be9a59 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -107,7 +107,7 @@ void Units::loadUnits()
struct UnitDescription ud;
int level = 1;
const std::string type = XML::getProperty(node, "type", "");
- ud.conversion = XML::getProperty(node, "conversion", 1.0);
+ ud.conversion = XML::getProperty(node, "conversion", 1);
ud.mix = XML::getProperty(node, "mix", "no") == "yes";
struct UnitLevel bu;