diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
commit | 593cccb16074fe9269dd2f278bd79859769eb1fd (patch) | |
tree | d8b3d93001021c59622ea88140dbbef8aee05013 | |
parent | b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (diff) | |
download | manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.gz manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.bz2 manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.xz manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.zip |
Improve constructors in some classes.
61 files changed, 186 insertions, 122 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 87e89591f..9417f5214 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -189,6 +189,8 @@ ChatWindow::ChatWindow(): setMinWidth(150); setMinHeight(90); + setTitleBarHeight(getPadding() + getTitlePadding()); + mChatTabs->enableScrollButtons(true); mChatTabs->setFollowDownScroll(true); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index ccbbf2059..c7bc1b5f1 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -133,8 +133,8 @@ class SocialGuildTab : public SocialTab, public gcn::ActionListener { public: SocialGuildTab(Guild *const guild, const bool showBackground) : - ActionListener(), SocialTab(), + ActionListener(), mGuild(guild) { setCaption(_("Guild")); diff --git a/src/joystick.cpp b/src/joystick.cpp index 04fb9d254..81b61b85d 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -59,16 +59,12 @@ Joystick::Joystick(int no): mLeftTolerance(0), mRightTolerance(0), mCalibrating(false), + mNumber(no >= joystickCount ? joystickCount : no), mCalibrated(false), mButtonsNumber(MAX_BUTTONS), mUseInactive(false), mHaveHats(false) { - if (no >= joystickCount) - no = joystickCount; - - mNumber = no; - for (int i = 0; i < MAX_BUTTONS; i++) mActiveButtons[i] = false; } diff --git a/src/keyinput.cpp b/src/keyinput.cpp index 929b2da86..b2a45df39 100644 --- a/src/keyinput.cpp +++ b/src/keyinput.cpp @@ -23,6 +23,7 @@ #include "debug.h" KeyInput::KeyInput() : + gcn::KeyInput(), mActionId(-2) { } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 61764fc40..cba78a449 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -89,9 +89,29 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) : mUpdateName(true), mTargetTime(-1), mLastTarget(-1), + mGMLevel(0), + mInvertDirection(0), + mCrazyMoveType(config.getIntValue("crazyMoveType")), + mCrazyMoveState(0), + mAttackWeaponType(config.getIntValue("attackWeaponType")), + mQuickDropCounter(config.getIntValue("quickDropCounter")), + mMoveState(0), + mDisableCrazyMove(false), + mPickUpType(config.getIntValue("pickUpType")), + mMagicAttackType(config.getIntValue("magicAttackType")), + mPvpAttackType(config.getIntValue("pvpAttackType")), + mMoveToTargetType(config.getIntValue("moveToTargetType")), + mAttackType(config.getIntValue("attackType")), + mFollowMode(config.getIntValue("followMode")), + mImitationMode(config.getIntValue("imitationMode")), + mDisableGameModifiers(config.getBoolValue("disableGameModifiers")), + mLastTargetX(0), + mLastTargetY(0), mTarget(nullptr), mPlayerFollowed(""), mPlayerImitated(""), + mNextDestX(0), + mNextDestY(0), mPickUpTarget(nullptr), mGoingToTarget(false), mKeepAttacking(false), @@ -102,11 +122,19 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) : mMessageTime(0), mAwayListener(new AwayListener), mAwayDialog(nullptr), + mPingSendTick(0), + mWaitPing(false), + mPingTime(0), mAfkTime(0), mAwayMode(false), mPseudoAwayMode(false), mShowNavigePath(false), - mDrawPath(false), + mIsServerBuggy(serverConfig.getValueBool("enableBuggyServers", true)), + mSyncPlayerMove(config.getBoolValue("syncPlayerMove")), + mDrawPath(config.getBoolValue("drawPath")), + mAttackMoving(config.getBoolValue("attackMoving")), + mAttackNext(config.getBoolValue("attackNext")), + mShowJobExp(config.getBoolValue("showJobExp")), mActivityTime(0), mNavigateX(0), mNavigateY(0), @@ -117,61 +145,30 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) : mOldY(0), mOldTileX(0), mOldTileY(0), + mTargetDeadPlayers(config.getBoolValue("targetDeadPlayers")), + mServerAttack(config.getBoolValue("serverAttack")), mLastHitFrom(""), mWaitFor(""), mAdvertTime(0), mBlockAdvert(false), + mEnableAdvert(config.getBoolValue("enableAdvert")), + mTradebot(config.getBoolValue("tradebot")), + mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")), mNextStep(false) { logger->log1("LocalPlayer::LocalPlayer"); - mAttackRange = 0; - listen(CHANNEL_ATTRIBUTES); - mLevel = 1; + mAttackRange = 0; + mLevel = 1; mAdvanced = true; - mTextColor = &Theme::getThemeColor(Theme::PLAYER); if (userPalette) mNameColor = &userPalette->getColor(UserPalette::SELF); else mNameColor = nullptr; - mLastTargetX = 0; - mLastTargetY = 0; - - mInvertDirection = 0; - mCrazyMoveType = config.getIntValue("crazyMoveType"); - mCrazyMoveState = 0; - mAttackWeaponType = config.getIntValue("attackWeaponType"); - mQuickDropCounter = config.getIntValue("quickDropCounter"); - mMoveState = 0; - mDisableCrazyMove = false; - mPickUpType = config.getIntValue("pickUpType"); - mMagicAttackType = config.getIntValue("magicAttackType"); - mPvpAttackType = config.getIntValue("pvpAttackType"); - mMoveToTargetType = config.getIntValue("moveToTargetType"); - mDisableGameModifiers = config.getBoolValue("disableGameModifiers"); - mTargetDeadPlayers = config.getBoolValue("targetDeadPlayers"); - mAttackType = config.getIntValue("attackType"); - mFollowMode = config.getIntValue("followMode"); - mImitationMode = config.getIntValue("imitationMode"); - mIsServerBuggy = serverConfig.getValueBool("enableBuggyServers", true); - mSyncPlayerMove = config.getBoolValue("syncPlayerMove"); - mDrawPath = config.getBoolValue("drawPath"); - mServerAttack = config.getBoolValue("serverAttack"); - mAttackMoving = config.getBoolValue("attackMoving"); - mAttackNext = config.getBoolValue("attackNext"); - mShowJobExp = config.getBoolValue("showJobExp"); - mEnableAdvert = config.getBoolValue("enableAdvert"); - mTradebot = config.getBoolValue("tradebot"); - mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); - - mPingSendTick = 0; - mWaitPing = false; - mPingTime = 0; - PlayerInfo::setStatBase(PlayerInfo::WALK_SPEED, static_cast<int>(getWalkSpeed().x)); PlayerInfo::setStatMod(PlayerInfo::WALK_SPEED, 0); @@ -1746,7 +1743,6 @@ void LocalPlayer::moveToTarget(int dist) bool gotPos(false); Path debugPath; - Vector targetPos(-1, -1); const Vector &playerPos = getPosition(); unsigned int limit(0); diff --git a/src/map.cpp b/src/map.cpp index 16f284e95..faef89434 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -123,6 +123,7 @@ bool TileAnimation::update(const int ticks) Map::Map(const int width, const int height, const int tileWidth, const int tileHeight) : + Properties(), mWidth(width), mHeight(height), mTileWidth(tileWidth), mTileHeight(tileHeight), mMaxTileHeight(height), diff --git a/src/maplayer.cpp b/src/maplayer.cpp index f7db290b6..cf40cfae7 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -41,11 +41,15 @@ MapLayer::MapLayer(const int x, const int y, const int width, const int height, const bool fringeLayer): - mX(x), mY(y), - mWidth(width), mHeight(height), + mX(x), + mY(y), + mWidth(width), + mHeight(height), mIsFringeLayer(fringeLayer), mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), - mTiles(new Image*[mWidth * mHeight]) + mTiles(new Image*[mWidth * mHeight]), + mSpecialLayer(nullptr), + mTempLayer(nullptr) { std::fill_n(mTiles, mWidth * mHeight, static_cast<Image*>(nullptr)); diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 7e0a5106d..b4708b3f7 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -42,7 +42,8 @@ extern Net::CharHandler *charHandler; namespace Ea { -CharServerHandler::CharServerHandler() +CharServerHandler::CharServerHandler() : + Net::CharHandler() { } diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 09a4066e0..c00301c7a 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -36,8 +36,9 @@ namespace Ea { LoginHandler::LoginHandler() : - mVersionResponse(false), - mRegistrationEnabled(true) + Net::LoginHandler(), + mVersionResponse(false), + mRegistrationEnabled(true) { mToken.clear(); } diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp index 56b636b3b..0f9d373df 100644 --- a/src/net/eathena/adminhandler.cpp +++ b/src/net/eathena/adminhandler.cpp @@ -42,7 +42,8 @@ extern Net::AdminHandler *adminHandler; namespace EAthena { -AdminHandler::AdminHandler() +AdminHandler::AdminHandler() : + MessageHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index eb2ce5f74..857a0a8fb 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -58,6 +58,7 @@ namespace EAthena { BeingHandler::BeingHandler(bool enableSync): + MessageHandler(), Ea::BeingHandler(enableSync) { static const uint16_t _messages[] = diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp index 4dbc90e4b..3294bc1c8 100644 --- a/src/net/eathena/buysellhandler.cpp +++ b/src/net/eathena/buysellhandler.cpp @@ -52,7 +52,9 @@ extern Net::BuySellHandler *buySellHandler; namespace EAthena { -BuySellHandler::BuySellHandler() +BuySellHandler::BuySellHandler() : + MessageHandler(), + Ea::BuySellHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 69ccc59a4..fcec75364 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -50,7 +50,9 @@ namespace EAthena extern ServerInfo charServer; extern ServerInfo mapServer; -CharServerHandler::CharServerHandler() +CharServerHandler::CharServerHandler() : + MessageHandler(), + Ea::CharServerHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index 77cf50acd..bd516ef26 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -45,7 +45,9 @@ extern Net::ChatHandler *chatHandler; namespace EAthena { -ChatHandler::ChatHandler() +ChatHandler::ChatHandler() : + MessageHandler(), + Ea::ChatHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index 09e6e4121..2ea687a88 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -39,7 +39,9 @@ namespace EAthena extern ServerInfo mapServer; -GameHandler::GameHandler() +GameHandler::GameHandler() : + MessageHandler(), + Ea::GameHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 82c52e943..b95991f55 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -72,7 +72,8 @@ namespace EAthena ServerInfo charServer; ServerInfo mapServer; -GeneralHandler::GeneralHandler(): +GeneralHandler::GeneralHandler() : + MessageHandler(), mAdminHandler(new AdminHandler), mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), mBuySellHandler(new BuySellHandler), diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 4e22fe691..74a14f132 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -35,7 +35,9 @@ extern Net::GuildHandler *guildHandler; namespace EAthena { -GuildHandler::GuildHandler() +GuildHandler::GuildHandler() : + Ea::GuildHandler(), + MessageHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 9f4b18ab2..e655920c1 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -33,7 +33,9 @@ extern Net::InventoryHandler *inventoryHandler; namespace EAthena { -InventoryHandler::InventoryHandler() +InventoryHandler::InventoryHandler() : + MessageHandler(), + Ea::InventoryHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/itemhandler.cpp b/src/net/eathena/itemhandler.cpp index 8eedb8562..1aad83027 100644 --- a/src/net/eathena/itemhandler.cpp +++ b/src/net/eathena/itemhandler.cpp @@ -29,7 +29,9 @@ namespace EAthena { -ItemHandler::ItemHandler() +ItemHandler::ItemHandler() : + MessageHandler(), + Ea::ItemHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 1aeef1c09..21da4ba9f 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -41,7 +41,9 @@ namespace EAthena extern ServerInfo charServer; -LoginHandler::LoginHandler() +LoginHandler::LoginHandler() : + MessageHandler(), + Ea::LoginHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 6e35c50c4..bef5ff817 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -40,9 +40,9 @@ namespace EAthena { MessageOut::MessageOut(short id): - Net::MessageOut(id) + Net::MessageOut(id), + mNetwork(EAthena::Network::instance()) { - mNetwork = EAthena::Network::instance(); mNetwork->fixSendBuffer(); mData = mNetwork->mOutBuffer + mNetwork->mOutSize; diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 475aaa72e..8a9a010f8 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -110,7 +110,8 @@ short packet_lengths[] = Network *Network::mInstance = nullptr; -Network::Network() +Network::Network() : + Ea::Network() { mInstance = this; } diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index aa77a23e5..4eaa00191 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -40,7 +40,9 @@ extern Net::NpcHandler *npcHandler; namespace EAthena { -NpcHandler::NpcHandler() +NpcHandler::NpcHandler() : + MessageHandler(), + Ea::NpcHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index e1052d50d..c452d2ae0 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -38,6 +38,7 @@ namespace EAthena { PartyHandler::PartyHandler() : + MessageHandler(), Ea::PartyHandler() { static const uint16_t _messages[] = diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 633bb12e4..0d4a51bc9 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -38,7 +38,9 @@ extern Net::PlayerHandler *playerHandler; namespace EAthena { -PlayerHandler::PlayerHandler() +PlayerHandler::PlayerHandler() : + MessageHandler(), + Ea::PlayerHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/specialhandler.cpp b/src/net/eathena/specialhandler.cpp index 77bb5a1d2..668a67519 100644 --- a/src/net/eathena/specialhandler.cpp +++ b/src/net/eathena/specialhandler.cpp @@ -33,7 +33,9 @@ extern Net::SpecialHandler *specialHandler; namespace EAthena { -SpecialHandler::SpecialHandler() +SpecialHandler::SpecialHandler() : + MessageHandler(), + Ea::SpecialHandler() { static const uint16_t _messages[] = { diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index a9416f8cd..cf33aa3cd 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -36,7 +36,9 @@ extern Net::TradeHandler *tradeHandler; namespace EAthena { -TradeHandler::TradeHandler() +TradeHandler::TradeHandler() : + MessageHandler(), + Ea::TradeHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index ae45d44d6..d7fc78d1d 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -42,7 +42,8 @@ extern Net::AdminHandler *adminHandler; namespace TmwAthena { -AdminHandler::AdminHandler() +AdminHandler::AdminHandler() : + MessageHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 37ce67213..5bf0bc1d6 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -57,7 +57,8 @@ extern Net::BeingHandler *beingHandler; namespace TmwAthena { -BeingHandler::BeingHandler(bool enableSync): +BeingHandler::BeingHandler(bool enableSync) : + MessageHandler(), Ea::BeingHandler(enableSync) { static const uint16_t _messages[] = diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index f3021207b..6d94370c7 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -53,7 +53,9 @@ extern int serverVersion; namespace TmwAthena { -BuySellHandler::BuySellHandler() +BuySellHandler::BuySellHandler() : + MessageHandler(), + Ea::BuySellHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 4261887fb..4e3763042 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -50,7 +50,9 @@ namespace TmwAthena extern ServerInfo charServer; extern ServerInfo mapServer; -CharServerHandler::CharServerHandler() +CharServerHandler::CharServerHandler() : + MessageHandler(), + Ea::CharServerHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 6bf00aecc..3c9f335a9 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -45,7 +45,9 @@ extern Net::ChatHandler *chatHandler; namespace TmwAthena { -ChatHandler::ChatHandler() +ChatHandler::ChatHandler() : + MessageHandler(), + Ea::ChatHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 15a4477ff..2515a45d3 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -39,7 +39,9 @@ namespace TmwAthena extern ServerInfo mapServer; -GameHandler::GameHandler() +GameHandler::GameHandler() : + MessageHandler(), + Ea::GameHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 2a38fcefe..33ccfe819 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -73,7 +73,8 @@ namespace TmwAthena ServerInfo charServer; ServerInfo mapServer; -GeneralHandler::GeneralHandler(): +GeneralHandler::GeneralHandler() : + MessageHandler(), mAdminHandler(new AdminHandler), mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), mBuySellHandler(new BuySellHandler), diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index c8886283a..5ecd9096a 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -35,7 +35,9 @@ extern Net::GuildHandler *guildHandler; namespace TmwAthena { -GuildHandler::GuildHandler() +GuildHandler::GuildHandler() : + Ea::GuildHandler(), + MessageHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 5838bae1c..f5768f8c5 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -33,7 +33,9 @@ extern Net::InventoryHandler *inventoryHandler; namespace TmwAthena { -InventoryHandler::InventoryHandler() +InventoryHandler::InventoryHandler() : + MessageHandler(), + Ea::InventoryHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index 4e6a9bfa1..7612b638e 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -29,7 +29,9 @@ namespace TmwAthena { -ItemHandler::ItemHandler() +ItemHandler::ItemHandler() : + MessageHandler(), + Ea::ItemHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index d4741538d..f8daecf20 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -41,7 +41,9 @@ namespace TmwAthena extern ServerInfo charServer; -LoginHandler::LoginHandler() +LoginHandler::LoginHandler() : + MessageHandler(), + Ea::LoginHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 1a291a9b7..3c6a180c5 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -40,9 +40,9 @@ namespace TmwAthena { MessageOut::MessageOut(short id): - Net::MessageOut(id) + Net::MessageOut(id), + mNetwork(TmwAthena::Network::instance()) { - mNetwork = TmwAthena::Network::instance(); mNetwork->fixSendBuffer(); mData = mNetwork->mOutBuffer + mNetwork->mOutSize; diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 1a7a46e95..15200fa50 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -88,7 +88,8 @@ short packet_lengths[] = Network *Network::mInstance = nullptr; -Network::Network() +Network::Network() : + Ea::Network() { mInstance = this; } diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 7b74ad91f..856b67828 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -42,6 +42,8 @@ namespace TmwAthena { NpcHandler::NpcHandler() : + MessageHandler(), + Ea::NpcHandler(), mRequestLang(false) { static const uint16_t _messages[] = diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 77bfbb8fb..e23629bc2 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -38,6 +38,7 @@ namespace TmwAthena { PartyHandler::PartyHandler() : + MessageHandler(), Ea::PartyHandler() { static const uint16_t _messages[] = diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index dae4f8eeb..963f4839d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -38,7 +38,9 @@ extern Net::PlayerHandler *playerHandler; namespace TmwAthena { -PlayerHandler::PlayerHandler() +PlayerHandler::PlayerHandler() : + MessageHandler(), + Ea::PlayerHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index d3209cb9e..bd03dc7a2 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -37,7 +37,8 @@ namespace TmwAthena { -QuestHandler::QuestHandler() +QuestHandler::QuestHandler() : + MessageHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index 58424cadc..ab37aba97 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -33,7 +33,9 @@ extern Net::SpecialHandler *specialHandler; namespace TmwAthena { -SpecialHandler::SpecialHandler() +SpecialHandler::SpecialHandler() : + MessageHandler(), + Ea::SpecialHandler() { static const uint16_t _messages[] = { diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 14614e62d..4fc099f27 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -36,7 +36,9 @@ extern Net::TradeHandler *tradeHandler; namespace TmwAthena { -TradeHandler::TradeHandler() +TradeHandler::TradeHandler() : + MessageHandler(), + Ea::TradeHandler() { static const uint16_t _messages[] = { diff --git a/src/particle.cpp b/src/particle.cpp index 2b019ab3f..4a59810d4 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -58,6 +58,7 @@ bool Particle::enabled = true; const float Particle::PARTICLE_SKY = 800.0f; Particle::Particle(Map *const map) : + Actor(), mAlpha(1.0f), mLifetimeLeft(-1), mLifetimePast(0), diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 026255c9f..2a303d4d1 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -42,10 +42,12 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, Particle *const target, Map *const map, const int rotation, const std::string& dyePalettes) : + mParticleFollow(false), mParticleTarget(target), mMap(map), mOutputPauseLeft(0), - mParticleImage(nullptr) + mParticleImage(nullptr), + mDeathEffectConditions(0) { // Initializing default values mParticlePosX.set(0.0f); @@ -57,7 +59,6 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode, mParticleGravity.set(0.0f); mParticleRandomness.set(0); mParticleBounce.set(0.0f); - mParticleFollow = false; mParticleAcceleration.set(0.0f); mParticleDieDistance.set(-1.0f); mParticleMomentum.set(1.0f); diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index a18d82aaa..549c3ca2d 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -467,7 +467,8 @@ bool PlayerRelationsManager::checkBadRelation(std::string name) class PIS_nothing : public PlayerIgnoreStrategy { public: - PIS_nothing() + PIS_nothing() : + PlayerIgnoreStrategy() { mDescription = _("Completely ignore"); mShortName = PLAYER_IGNORE_STRATEGY_NOP; @@ -482,7 +483,8 @@ public: class PIS_dotdotdot : public PlayerIgnoreStrategy { public: - PIS_dotdotdot() + PIS_dotdotdot() : + PlayerIgnoreStrategy() { mDescription = _("Print '...'"); mShortName = "dotdotdot"; @@ -502,7 +504,8 @@ public: class PIS_blinkname : public PlayerIgnoreStrategy { public: - PIS_blinkname() + PIS_blinkname() : + PlayerIgnoreStrategy() { mDescription = _("Blink name"); mShortName = "blinkname"; @@ -523,6 +526,7 @@ class PIS_emote : public PlayerIgnoreStrategy public: PIS_emote(const uint8_t emote_nr, const std::string &description, const std::string &shortname) : + PlayerIgnoreStrategy(), mEmotion(emote_nr) { mDescription = description; diff --git a/src/resources/colordb.h b/src/resources/colordb.h index fd479d00a..4be6503fb 100644 --- a/src/resources/colordb.h +++ b/src/resources/colordb.h @@ -40,11 +40,11 @@ namespace ColorDB { } ItemColor(const int id0, const std::string &name0, - const std::string &color0) + const std::string &color0) : + id(id0), + name(name0), + color(color0) { - this->id = id0; - this->name = name0; - this->color = color0; } int id; diff --git a/src/resources/image.cpp b/src/resources/image.cpp index e70ee3de5..0e2423bf9 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -45,6 +45,8 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, uint8_t *const alphaChannel) : + Resource(), + mLoaded(false), mAlpha(1.0f), mHasAlphaChannel(hasAlphaChannel0), mSDLSurface(image), @@ -61,8 +63,6 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, mBounds.x = 0; mBounds.y = 0; - mLoaded = false; - if (mSDLSurface) { mBounds.w = static_cast<uint16_t>(mSDLSurface->w); @@ -82,6 +82,8 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, #ifdef USE_OPENGL Image::Image(const GLuint glimage, const int width, const int height, const int texWidth, const int texHeight) : + Resource(), + mLoaded(false), mAlpha(1.0f), mHasAlphaChannel(true), mSDLSurface(nullptr), @@ -104,9 +106,8 @@ Image::Image(const GLuint glimage, const int width, const int height, } else { - logger->log( - "Image::Image(GLuint*, ...): Couldn't load invalid Surface!"); - mLoaded = false; + logger->log("Image::Image(GLuint*, ...):" + " Couldn't load invalid Surface!"); } } #endif diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 538b27c84..2e10f74a2 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -32,6 +32,7 @@ ImageSet::ImageSet(Image *const img, const int width, const int height, const int margin, const int spacing) : + Resource(), mWidth(width), mHeight(height), mOffsetX(0), diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index e72893d12..7e106af80 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -82,7 +82,8 @@ ItemInfo::ItemInfo() : mColors(nullptr), mColorList(""), mHitEffectId(0), - mCriticalHitEffectId(0) + mCriticalHitEffectId(0), + maxFloorOffset(32) { for (int f = 0; f < 10; f ++) { diff --git a/src/resources/music.cpp b/src/resources/music.cpp index 1b66e6bad..d88b3ccac 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -27,6 +27,7 @@ #include "debug.h" Music::Music(Mix_Music *const music) : + Resource(), mMusic(music) { } diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h index 5f3676064..7d23dcca0 100644 --- a/src/resources/soundeffect.h +++ b/src/resources/soundeffect.h @@ -66,6 +66,7 @@ class SoundEffect : public Resource * Constructor. */ SoundEffect(Mix_Chunk *const soundEffect) : + Resource(), mChunk(soundEffect) { } diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 86f2d7f12..74960f64e 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -143,7 +143,8 @@ class SpriteDef : public Resource /** * Constructor. */ - SpriteDef() + SpriteDef() : + Resource() { } /** diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 595a7aaaf..f9966d83f 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -49,6 +49,7 @@ SimpleAnimation::SimpleAnimation(const XmlNodePtr animationNode, mAnimation(new Animation), mAnimationTime(0), mAnimationPhase(0), + mCurrentFrame(nullptr), mInitialized(false) { initializeAnimation(animationNode, dyePalettes); diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index f2c978b5b..5e94f09d5 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -35,13 +35,10 @@ std::string fileName = ""; extern char *selfName; -TestMain::TestMain() +TestMain::TestMain() : + log(new Logger) { fileName = getSelfName(); - - log = new Logger; -// log->setLogFile(Client::getLocalDataDirectory() -// + std::string("/test.log")); log->setLogFile(Client::getLocalDataDirectory() + std::string("/manaplustest.log")); } diff --git a/src/text.cpp b/src/text.cpp index 29bed5375..41b2b01ca 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -44,15 +44,14 @@ Text::Text(const std::string &text, const int x, const int y, const gcn::Graphics::Alignment alignment, const gcn::Color* color, const bool isSpeech, gcn::Font *const font) : + mFont(font ? font : gui->getFont()), + mY(y), + mWidth(mFont->getWidth(text)), + mHeight(mFont->getHeight()), mText(text), mColor(color), mIsSpeech(isSpeech) { - if (!font) - mFont = gui->getFont(); - else - mFont = font; - if (!textManager) { textManager = new TextManager; @@ -74,8 +73,6 @@ Text::Text(const std::string &text, const int x, const int y, } } ++mInstances; - mHeight = mFont->getHeight(); - mWidth = mFont->getWidth(text); switch (alignment) { @@ -92,7 +89,6 @@ Text::Text(const std::string &text, const int x, const int y, break; } mX = x - mXOffset; - mY = y; if (textManager) textManager->addText(this); } diff --git a/src/text.h b/src/text.h index e4ad4ab06..b1f1a3d9b 100644 --- a/src/text.h +++ b/src/text.h @@ -69,6 +69,7 @@ class Text const int xOff, const int yOff); private: + gcn::Font *mFont; /**< The font of the text */ int mX; /**< Actual x-value of left of text written. */ int mY; /**< Actual y-value of top of text written. */ int mWidth; /**< The width of the text. */ @@ -77,7 +78,6 @@ class Text static int mInstances; /**< Instances of text. */ std::string mText; /**< The text to display. */ const gcn::Color *mColor; /**< The color of the text. */ - gcn::Font *mFont; /**< The font of the text */ bool mIsSpeech; /**< Is this text a speech bubble? */ protected: diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 4d434f46a..f25d867a6 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -90,12 +90,9 @@ namespace XML } } - Document::Document(const char *const data, const int size) + Document::Document(const char *const data, const int size) : + mDoc(data ? xmlParseMemory(data, size) : nullptr) { - if (data) - mDoc = xmlParseMemory(data, size); - else - mDoc = nullptr; } Document::~Document() |