From dd4d44a07d3a63ced0eec51c30b75887792c4a36 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Apr 2013 14:57:27 +0300 Subject: some more style and cast fixes. --- src/flooritem.cpp | 1 - src/flooritem.h | 1 - src/gui/buyselldialog.cpp | 8 ++++---- src/gui/buyselldialog.h | 4 ++-- src/gui/inventorywindow.cpp | 22 +++++++++++----------- src/gui/inventorywindow.h | 6 +++--- src/gui/widgets/avatarlistbox.cpp | 8 ++------ src/gui/widgets/avatarlistbox.h | 1 - src/net/tmwa/beinghandler.cpp | 12 ++++-------- src/utils/base64.cpp | 1 + 10 files changed, 27 insertions(+), 37 deletions(-) diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 821a10d20..10a3f3c94 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -42,7 +42,6 @@ FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, mItemId(itemId), mX(x), mY(y), - mMap(map), mDropTime(cur_time), mAmount(amount), mPickupCount(0), diff --git a/src/flooritem.h b/src/flooritem.h index aaf870cf3..af9d2f4aa 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -104,7 +104,6 @@ class FloorItem final : public ActorSprite private: int mItemId; int mX, mY; - Map *mMap; int mDropTime; int mAmount; unsigned mPickupCount; diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index e84982737..7db437c4f 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -32,7 +32,7 @@ #include "debug.h" -BuySellDialog::DialogList BuySellDialog::instances; +BuySellDialog::DialogList BuySellDialog::dialogInstances; BuySellDialog::BuySellDialog(const int npcId) : Window(_("Shop"), false, nullptr, "buysell.xml"), @@ -86,13 +86,13 @@ void BuySellDialog::init() loadWindowState(); enableVisibleSound(true); - instances.push_back(this); + dialogInstances.push_back(this); setVisible(true); } BuySellDialog::~BuySellDialog() { - instances.remove(this); + dialogInstances.remove(this); } void BuySellDialog::setVisible(bool visible) @@ -133,7 +133,7 @@ void BuySellDialog::action(const gcn::ActionEvent &event) void BuySellDialog::closeAll() { - FOR_EACH (DialogList::const_iterator, it, instances) + FOR_EACH (DialogList::const_iterator, it, dialogInstances) { if (*it) (*it)->close(); diff --git a/src/gui/buyselldialog.h b/src/gui/buyselldialog.h index 371e8bdd9..ef3a98f18 100644 --- a/src/gui/buyselldialog.h +++ b/src/gui/buyselldialog.h @@ -64,7 +64,7 @@ class BuySellDialog final : public Window, public gcn::ActionListener * Returns true if any instances exist. */ static bool isActive() A_WARN_UNUSED - { return !instances.empty(); } + { return !dialogInstances.empty(); } /** * Closes all instances. @@ -73,7 +73,7 @@ class BuySellDialog final : public Window, public gcn::ActionListener private: typedef std::list DialogList; - static DialogList instances; + static DialogList dialogInstances; int mNpcId; std::string mNick; diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index fe51018bf..22fea71c7 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -86,7 +86,7 @@ public: } }; -InventoryWindow::WindowList InventoryWindow::instances; +InventoryWindow::WindowList InventoryWindow::invInstances; InventoryWindow::InventoryWindow(Inventory *const inventory): Window("Inventory", false, nullptr, "inventory.xml"), @@ -103,7 +103,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mEquipmentButton(nullptr), mStoreButton(nullptr), mRetrieveButton(nullptr), - mCloseButton(nullptr), + mInvCloseButton(nullptr), mWeightBar(nullptr), mSlotsBar(new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_INVY_SLOTS)), mFilter(nullptr), @@ -205,7 +205,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): { mStoreButton = new Button(this, _("Store"), "store", this); mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); - mCloseButton = new Button(this, _("Close"), "close", this); + mInvCloseButton = new Button(this, _("Close"), "close", this); mSlotsBarCell = &place(0, 0, mSlotsBar, 6); mSortDropDownCell = &place(6, 0, mSortDropDown, 1); @@ -216,7 +216,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): place(0, 2, invenScroll, 7, 4); place(0, 6, mStoreButton); place(1, 6, mRetrieveButton); - place(6, 6, mCloseButton); + place(6, 6, mInvCloseButton); } Layout &layout = getLayout(); @@ -224,7 +224,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mInventory->addInventoyListener(this); - instances.push_back(this); + invInstances.push_back(this); if (inventory && inventory->isMainInventory()) { @@ -232,8 +232,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): } else { - if (!instances.empty()) - instances.front()->updateDropButton(); + if (!invInstances.empty()) + invInstances.front()->updateDropButton(); } loadWindowState(); @@ -247,10 +247,10 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): InventoryWindow::~InventoryWindow() { - instances.remove(this); + invInstances.remove(this); mInventory->removeInventoyListener(this); - if (!instances.empty()) - instances.front()->updateDropButton(); + if (!invInstances.empty()) + invInstances.front()->updateDropButton(); delete mSortModel; mSortModel = nullptr; } @@ -707,7 +707,7 @@ bool InventoryWindow::isInputFocused() const bool InventoryWindow::isAnyInputFocused() { - FOR_EACH (WindowList::const_iterator, it, instances) + FOR_EACH (WindowList::const_iterator, it, invInstances) { if ((*it) && (*it)->isInputFocused()) return true; diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 83e26948b..903f15254 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -131,7 +131,7 @@ class InventoryWindow final : public Window, * Returns true if any instances exist. */ static bool isStorageActive() A_WARN_UNUSED - { return instances.size() > 1; } + { return invInstances.size() > 1; } void updateDropButton(); @@ -154,7 +154,7 @@ class InventoryWindow final : public Window, typedef std::list WindowList; - static WindowList instances; + static WindowList invInstances; Inventory *mInventory; ItemContainer *mItems; @@ -169,7 +169,7 @@ class InventoryWindow final : public Window, Button *mEquipmentButton; Button *mStoreButton; Button *mRetrieveButton; - Button *mCloseButton; + Button *mInvCloseButton; ProgressBar *mWeightBar; ProgressBar *mSlotsBar; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 372218fe6..fe46feba2 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -48,8 +48,7 @@ AvatarListBox::AvatarListBox(const Widget2 *const widget, ListBox(widget, model, "avatarlistbox.xml"), mShowGender(config.getBoolValue("showgender")), mShowLevel(config.getBoolValue("showlevel")), - mImagePadding(mSkin ? mSkin->getOption("imagePadding") : 0), - mHighlightColor(getThemeColor(Theme::HIGHLIGHT)) + mImagePadding(mSkin ? mSkin->getOption("imagePadding") : 0) { instances++; @@ -99,13 +98,10 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) AvatarListModel *const model = static_cast( mListModel); -// Guild *guild = dynamic_cast(model); - updateAlpha(); - Graphics *const graphics = static_cast(gcnGraphics); - mHighlightColor.a = static_cast(mAlpha * 255.0f); +// mHighlightColor.a = static_cast(mAlpha * 255.0f); gcn::Font *const font = getFont(); const int fontHeight = getFont()->getHeight(); diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 7d283abea..579651d29 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -65,7 +65,6 @@ private: bool mShowGender; bool mShowLevel; int mImagePadding; - gcn::Color mHighlightColor; static int instances; static Image *onlineIcon; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 28f7fc999..2d8cc8b7a 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -608,15 +608,11 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, //need set stay state? logger->log("QQQ2 SMSG_PLAYER_UPDATE_1:" + toString(id) + " " + toString(type)); - if (dstBeing) - { - logger->log("dstBeing id:" - + toString(dstBeing->getId())); - logger->log("dstBeing name:" - + dstBeing->getName()); - } + logger->log("dstBeing id:" + + toString(dstBeing->getId())); + logger->log("dstBeing name:" + + dstBeing->getName()); break; - } } else if (msgType == 3) diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 7cd22f732..ebdfcb7c3 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -160,6 +160,7 @@ unsigned char *php3_base64_decode(const unsigned char *const string, k++; case 3: result[k++] = 0; + break; default: break; } -- cgit v1.2.3-70-g09d2