From 261ff1fa32cb75254d68d214f13f8a5aaec33962 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 5 Feb 2012 17:30:36 +0300 Subject: Move language functions to langs.cpp and langs.h files. --- src/net/tmwa/npchandler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index d86c64a96..837b83337 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -35,6 +35,8 @@ #include "net/ea/eaprotocol.h" +#include "utils/langs.h" + #include "debug.h" extern Net::NpcHandler *npcHandler; -- cgit v1.2.3-70-g09d2 From ff5e17ff14a78af31d9d23cd1dfdb5404f9a8fa9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Feb 2012 00:49:41 +0300 Subject: Fix code style with new tool. --- src/avatar.cpp | 2 +- src/being.cpp | 7 ++-- src/client.cpp | 2 +- src/configuration.cpp | 2 +- src/debug/debug_new.cpp | 16 ++++----- src/defaults.h | 20 +++++------ src/graphics.cpp | 6 ++-- src/gui/botcheckerwindow.cpp | 3 +- src/gui/chatwindow.cpp | 4 +-- src/gui/confirmdialog.cpp | 1 - src/gui/debugwindow.cpp | 2 +- src/gui/itempopup.cpp | 2 +- src/gui/npcpostdialog.cpp | 2 +- src/gui/palette.cpp | 4 ++- src/gui/setup_relations.cpp | 3 +- src/gui/setup_video.cpp | 2 +- src/gui/statuswindow.cpp | 2 +- src/gui/textdialog.cpp | 2 +- src/gui/viewport.h | 4 ++- src/gui/whoisonline.cpp | 2 +- src/gui/widgets/avatarlistbox.cpp | 2 +- src/gui/widgets/battletab.h | 3 -- src/gui/widgets/chattab.cpp | 2 +- src/gui/widgets/container.cpp | 2 +- src/gui/widgets/dropdown.h | 1 - src/gui/widgets/inventoryfilter.cpp | 2 +- src/gui/widgets/layout.h | 4 +-- src/gui/widgets/setupitem.cpp | 1 - src/gui/widgets/setuptab.cpp | 2 +- src/gui/widgets/shoplistbox.cpp | 2 +- src/gui/widgets/slider.cpp | 1 - src/gui/widgets/tablemodel.cpp | 1 - src/gui/widgets/textfield.cpp | 22 ++++++------ src/gui/widgets/tradetab.h | 3 -- src/guichan/actionevent.cpp | 1 - src/guichan/event.cpp | 1 - src/guichan/include/guichan/actionevent.hpp | 1 - src/guichan/include/guichan/color.hpp | 2 +- src/guichan/include/guichan/gui.hpp | 9 +++-- src/guichan/include/guichan/sdl/sdlpixel.hpp | 6 ++-- src/guichan/keyinput.cpp | 1 - src/guichan/sdl/sdlgraphics.cpp | 4 +-- src/guichan/selectionevent.cpp | 1 - src/guichan/widgets/checkbox.cpp | 1 - src/guichan/widgets/dropdown.cpp | 1 - src/guichan/widgets/icon.cpp | 18 +++++----- src/guichan/widgets/tab.cpp | 1 - src/localconsts.h | 2 +- src/localplayer.cpp | 16 ++++----- src/logger.cpp | 2 +- src/map.cpp | 6 ++-- src/maplayer.cpp | 6 ++-- src/mumblemanager.cpp | 4 +-- src/net/ea/beinghandler.cpp | 6 ++++ src/net/ea/gui/partytab.cpp | 1 - src/net/ea/inventoryhandler.cpp | 2 +- src/net/manaserv/chathandler.cpp | 2 +- src/net/manaserv/guildhandler.cpp | 2 +- src/net/manaserv/playerhandler.cpp | 3 +- src/net/net.cpp | 1 - src/net/tmwa/gui/guildtab.cpp | 1 - src/net/tmwa/gui/partytab.cpp | 1 - src/net/tmwa/network.cpp | 4 +-- src/openglgraphics.cpp | 6 ++-- src/playerrelations.cpp | 5 ++- src/resources/image.cpp | 10 +++--- src/resources/mapreader.cpp | 4 +-- src/resources/resourcemanager.cpp | 54 ++++++++++++++-------------- src/resources/specialdb.cpp | 3 +- src/spellmanager.cpp | 3 +- src/textcommand.h | 2 +- src/units.cpp | 10 +++--- src/utils/base64.cpp | 4 +-- src/utils/physfsrwops.h | 1 - src/utils/stringutils.cpp | 8 ++--- src/vector.h | 4 +-- 76 files changed, 172 insertions(+), 184 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/avatar.cpp b/src/avatar.cpp index 9a4831f18..54d7c6e79 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -61,4 +61,4 @@ std::string Avatar::getAdditionString() const return " - " + getIp(); else return ""; -} \ No newline at end of file +} diff --git a/src/being.cpp b/src/being.cpp index 9edfaad7b..92d01097b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -295,9 +295,9 @@ Being::~Being() { config.removeListener("visiblenames", this); - delete[] mSpriteRemap; + delete [] mSpriteRemap; mSpriteRemap = nullptr; - delete[] mSpriteHide; + delete [] mSpriteHide; mSpriteHide = nullptr; delete mSpeechBubble; @@ -993,7 +993,6 @@ void Being::setAction(Action action, int attackType A_UNUSED) case DIRECTION_RIGHT: rotation = 270; break; default: break; } - ; if (particleEngine) { Particle *p = particleEngine->addEffect( @@ -2404,7 +2403,7 @@ void Being::searchSlotValueItr(std::vector::iterator &it, int &idx, // logger->log("searching %d", val); it = slotRemap.begin(); idx = 0; - while(it != slotRemap.end()) + while (it != slotRemap.end()) { // logger->log("testing %d", *it); if (*it == val) diff --git a/src/client.cpp b/src/client.cpp index 3e8eef6ed..54a0b6224 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -502,7 +502,7 @@ void Client::gameInit() GraphicsVertexes::setLoadAsOpenGL(useOpenGL); // Create the graphics context - switch(useOpenGL) + switch (useOpenGL) { case 0: mainGraphics = new Graphics; diff --git a/src/configuration.cpp b/src/configuration.cpp index 39e0c75d4..254a3fea8 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -161,7 +161,7 @@ void Configuration::cleanDefaults() for (DefaultsData::const_iterator iter = mDefaultsData->begin(); iter != mDefaultsData->end(); ++iter) { - delete(iter->second); + delete (iter->second); } mDefaultsData->clear(); delete mDefaultsData; diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp index 3bc02b3e5..9e30d30d9 100644 --- a/src/debug/debug_new.cpp +++ b/src/debug/debug_new.cpp @@ -533,7 +533,7 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array) * @param pointer pointer to delete * @param addr pointer to the caller * @param is_array flag indicating whether it is invoked by a - * delete[] call + * delete [] call */ static void free_pointer(void* pointer, void* addr, bool is_array) { @@ -558,9 +558,9 @@ static void free_pointer(void* pointer, void* addr, bool is_array) { const char* msg; if (is_array) - msg = "delete[] after new"; + msg = "delete [] after new"; else - msg = "delete after new[]"; + msg = "delete after new []"; fast_mutex_autolock lock(new_output_lock); fprintf(new_output_fp, "%s: pointer %p (size %u)\n\tat ", @@ -800,7 +800,7 @@ void operator delete(void* pointer) throw() free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, false); } -void operator delete[](void* pointer) throw() +void operator delete [](void* pointer) throw() { free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, true); } @@ -820,7 +820,7 @@ void operator delete(void* pointer, const char* file, int line) throw() operator delete(pointer); } -void operator delete[](void* pointer, const char* file, int line) throw() +void operator delete [](void* pointer, const char* file, int line) throw() { if (new_verbose_flag) { @@ -831,7 +831,7 @@ void operator delete[](void* pointer, const char* file, int line) throw() print_position(file, line); fprintf(new_output_fp, ")\n"); } - operator delete[](pointer); + operator delete [](pointer); } void operator delete(void* pointer, const std::nothrow_t&) throw() @@ -839,9 +839,9 @@ void operator delete(void* pointer, const std::nothrow_t&) throw() operator delete(pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); } -void operator delete[](void* pointer, const std::nothrow_t&) throw() +void operator delete [](void* pointer, const std::nothrow_t&) throw() { - operator delete[](pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + operator delete [](pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); } #endif // HAVE_PLACEMENT_DELETE diff --git a/src/defaults.h b/src/defaults.h index 1d979e928..850e15d37 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -26,18 +26,16 @@ #include #include "variabledata.h" -using namespace Mana; - typedef std::map DefaultsData; -VariableData* createData(int defData); -VariableData* createData(double defData); -VariableData* createData(float defData); -VariableData* createData(const std::string &defData); -VariableData* createData(const char* defData); -VariableData* createData(bool defData); -DefaultsData* getConfigDefaults(); -DefaultsData* getBrandingDefaults(); -DefaultsData* getPathsDefaults(); +Mana::VariableData* createData(int defData); +Mana::VariableData* createData(double defData); +Mana::VariableData* createData(float defData); +Mana::VariableData* createData(const std::string &defData); +Mana::VariableData* createData(const char* defData); +Mana::VariableData* createData(bool defData); +Mana::DefaultsData* getConfigDefaults(); +Mana::DefaultsData* getBrandingDefaults(); +Mana::DefaultsData* getPathsDefaults(); #endif diff --git a/src/graphics.cpp b/src/graphics.cpp index 5848d8c14..635cc6ab9 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -719,10 +719,10 @@ int Graphics::SDL_FakeUpperBlit(SDL_Surface *src, SDL_Rect *srcrect, /* Make sure the surfaces aren't locked */ if (!src || !dst) - return(-1); + return -1; if (src->locked || dst->locked) - return(-1); + return -1; /* If the destination rectangle is nullptr, use the entire dest surface */ if (!dstrect) @@ -841,7 +841,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); - switch(bpp) + switch (bpp) { case 1: for (y = y1; y < y2; y++) diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 2043b4fe3..4a092ab55 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -53,7 +53,8 @@ #define TIME_COLUMN 1 #define ROW_HEIGHT 12 -// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... excep +// The following column widths really shouldn't be hardcoded but should +// scale with the size of the widget... excep // that, right now, the widget doesn't exactly scale either. #define NAME_COLUMN_WIDTH 185 #define TIME_COLUMN_WIDTH 70 diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 6831ad5b6..452d2420e 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -594,7 +594,7 @@ void ChatWindow::ignoreAllWhispers() PlayerRelation::IGNORED); } - delete(iter->second); + delete (iter->second); iter->second = nullptr; } } @@ -1122,7 +1122,7 @@ std::string ChatWindow::addColors(std::string &msg) int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8}; // rainbow - switch(mChatColor) + switch (mChatColor) { case 11: msg = removeColors(msg); diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index cf9d541ad..22acf5116 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -112,4 +112,3 @@ void ConfirmDialog::action(const gcn::ActionEvent &event) scheduleDelete(); } } - diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index d13545bea..19db5540a 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -396,4 +396,4 @@ void NetDebugTab::logic() PacketCounters::getInBytes())); mOutPackets1Label->setCaption(strprintf(_("Out: %d bytes/s"), PacketCounters::getOutBytes())); -} \ No newline at end of file +} diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 9a9e5f50d..d96aa564f 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -282,4 +282,4 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event) setVisible(false); mLastName = ""; mLastColor = 1; -} \ No newline at end of file +} diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 6bcb62baf..b2ffb312c 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -128,4 +128,4 @@ void NpcPostDialog::closeAll() for (; it != it_end; ++it) (*it)->close(); -} \ No newline at end of file +} diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index fe14cd2d4..3b36fa6ce 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -39,7 +39,8 @@ const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0); Palette::Palettes Palette::mInstances; -const gcn::Color Palette::RAINBOW_COLORS[7] = { +const gcn::Color Palette::RAINBOW_COLORS[7] = +{ gcn::Color(255, 0, 0), gcn::Color(255, 153, 0), gcn::Color(255, 255, 0), @@ -48,6 +49,7 @@ const gcn::Color Palette::RAINBOW_COLORS[7] = { gcn::Color(51, 0, 153), gcn::Color(153, 0, 153) }; + /** Number of Elemets of RAINBOW_COLORS */ const int Palette::RAINBOW_COLOR_COUNT = 7; diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 571856a14..47d53620c 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -50,7 +50,8 @@ #define RELATION_CHOICE_COLUMN 1 #define ROW_HEIGHT 12 -// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... except +// The following column widths really shouldn't be hardcoded +// but should scale with the size of the widget... except // that, right now, the widget doesn't exactly scale either. #define NAME_COLUMN_WIDTH 230 #define RELATION_CHOICE_COLUMN_WIDTH 80 diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 9a5b30ea7..6b3d6d4d3 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -743,4 +743,4 @@ void Setup_Video::action(const gcn::ActionEvent &event) void Setup_Video::externalUpdated() { -} \ No newline at end of file +} diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 86964383a..3fbec4f35 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -286,7 +286,7 @@ void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) { - switch(event.getInt("id")) + switch (event.getInt("id")) { case HP: case MAX_HP: updateHPBar(mHpBar, true); diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index b30c9eb82..d7d3d5eeb 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -126,4 +126,4 @@ void TextDialog::close() { keyboard.setEnabled(mEnabledKeyboard); scheduleDelete(); -} \ No newline at end of file +} diff --git a/src/gui/viewport.h b/src/gui/viewport.h index f3035b5df..ccb8124ba 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -90,7 +90,9 @@ class Viewport : public WindowContainer, public gcn::MouseListener, void logic(); /** - * Toggles whether the path debug graphics are shown. normal, debug with all images and grid, debug with out big images and with out grid. + * Toggles whether the path debug graphics are shown. normal, + * debug with all images and grid, debug with out big images + * and with out grid. */ void toggleDebugPath(); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 205a1aae1..104e4d7f1 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -138,7 +138,7 @@ WhoIsOnline::~WhoIsOnline() mMemoryBuffer = nullptr; // Remove possibly leftover temporary download - delete[] mCurlError; + delete []mCurlError; std::set::iterator itd = mOnlinePlayers.begin(); std::set::iterator itd_end = mOnlinePlayers.end(); diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 2e3472515..822e71805 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -403,4 +403,4 @@ void AvatarListBox::optionChanged(const std::string &value) mShowGender = config.getBoolValue("showgender"); else if (value == "showlevel") mShowLevel = config.getBoolValue("showlevel"); -} \ No newline at end of file +} diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h index 8d85e739e..2a034a166 100644 --- a/src/gui/widgets/battletab.h +++ b/src/gui/widgets/battletab.h @@ -43,6 +43,3 @@ class BattleTab : public ChatTab extern BattleTab *battleChatTab; #endif - - - diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 6d5dfc9dd..018e35030 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -467,4 +467,4 @@ void ChatTab::addNewRow(std::string &line) addRow(line); } mScrollArea->logic(); -} \ No newline at end of file +} diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 80028a62f..106112956 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -47,4 +47,4 @@ bool Container::safeRemove(gcn::Widget* widget) } } return false; -} \ No newline at end of file +} diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index a769678ca..5896042fa 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -102,4 +102,3 @@ class DropDown : public gcn::DropDown }; #endif // end DROPDOWN_H - diff --git a/src/gui/widgets/inventoryfilter.cpp b/src/gui/widgets/inventoryfilter.cpp index 216c2bea0..515682cb6 100644 --- a/src/gui/widgets/inventoryfilter.cpp +++ b/src/gui/widgets/inventoryfilter.cpp @@ -58,4 +58,4 @@ void InventoryFilter::action(const gcn::ActionEvent &event) { (*iter)->action(event); } -} \ No newline at end of file +} diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 046d09b59..3c42554b6 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -37,8 +37,8 @@ class LayoutCell; class ContainerPlacer { public: - ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr): - mContainer(c), mCell(l) + ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *lc = nullptr): + mContainer(c), mCell(lc) {} /** diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 059b05ba2..56ce0a25a 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -455,7 +455,6 @@ void SetupItemIntTextField::apply(std::string eventName) } - SetupItemLabel::SetupItemLabel(std::string text, std::string description, SetupTabScroll *parent, bool separator) : SetupItem(text, description, "", parent, "", "", true), diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp index b3863c134..d4ae46eb8 100644 --- a/src/gui/widgets/setuptab.cpp +++ b/src/gui/widgets/setuptab.cpp @@ -31,4 +31,4 @@ SetupTab::SetupTab() void SetupTab::externalUpdated() { -} \ No newline at end of file +} diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 71e373d70..ab6400149 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -191,4 +191,4 @@ void ShopListBox::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) return; mItemPopup->hide(); -} \ No newline at end of file +} diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index ed667e194..c6b57858c 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -298,4 +298,3 @@ void Slider::mouseExited(gcn::MouseEvent& event A_UNUSED) { mHasMouse = false; } - diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 5216fb89c..bc5d2ead6 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -173,4 +173,3 @@ int StaticTableModel::getHeight() const { return mColumns * mHeight; } - diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 4dba2eb57..e207b0613 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -208,29 +208,29 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) } else if (!mMaximum || mText.size() < mMaximum) { - int l; + int len; if (val < 128) - l = 1; // 0xxxxxxx + len = 1; // 0xxxxxxx else if (val < 0x800) - l = 2; // 110xxxxx 10xxxxxx + len = 2; // 110xxxxx 10xxxxxx else if (val < 0x10000) - l = 3; // 1110xxxx 10xxxxxx 10xxxxxx + len = 3; // 1110xxxx 10xxxxxx 10xxxxxx else - l = 4; // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + len = 4; // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx char buf[4]; - for (int i = 0; i < l; ++i) + for (int i = 0; i < len; ++ i) { - buf[i] = static_cast(val >> (6 * (l - i - 1))); + buf[i] = static_cast(val >> (6 * (len - i - 1))); if (i > 0) buf[i] = static_cast((buf[i] & 63) | 128); } - if (l > 1) - buf[0] |= static_cast(255 << (8 - l)); + if (len > 1) + buf[0] |= static_cast(255 << (8 - len)); - mText.insert(mCaretPosition, std::string(buf, buf + l)); - mCaretPosition += l; + mText.insert(mCaretPosition, std::string(buf, buf + len)); + mCaretPosition += len; } } diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h index 06add3ee0..44922c31a 100644 --- a/src/gui/widgets/tradetab.h +++ b/src/gui/widgets/tradetab.h @@ -46,6 +46,3 @@ class TradeTab : public ChatTab extern TradeTab *tradeChatTab; #endif - - - diff --git a/src/guichan/actionevent.cpp b/src/guichan/actionevent.cpp index a91c6dec0..7348587d7 100644 --- a/src/guichan/actionevent.cpp +++ b/src/guichan/actionevent.cpp @@ -69,4 +69,3 @@ namespace gcn return mId; } } - diff --git a/src/guichan/event.cpp b/src/guichan/event.cpp index 691240d11..5983af7e7 100644 --- a/src/guichan/event.cpp +++ b/src/guichan/event.cpp @@ -68,4 +68,3 @@ namespace gcn return mSource; } } - diff --git a/src/guichan/include/guichan/actionevent.hpp b/src/guichan/include/guichan/actionevent.hpp index 96a2d1364..a6c54f516 100644 --- a/src/guichan/include/guichan/actionevent.hpp +++ b/src/guichan/include/guichan/actionevent.hpp @@ -112,4 +112,3 @@ namespace gcn } #endif // GCN_ACTIONEVENT_HPP - diff --git a/src/guichan/include/guichan/color.hpp b/src/guichan/include/guichan/color.hpp index a051c3569..6f0cfc1ff 100644 --- a/src/guichan/include/guichan/color.hpp +++ b/src/guichan/include/guichan/color.hpp @@ -139,7 +139,7 @@ namespace gcn */ bool operator!=(const Color& color) const; - /** + /** * Output operator for output. * * @param out The stream to output to. diff --git a/src/guichan/include/guichan/gui.hpp b/src/guichan/include/guichan/gui.hpp index d8c9c7555..b2be75141 100644 --- a/src/guichan/include/guichan/gui.hpp +++ b/src/guichan/include/guichan/gui.hpp @@ -65,10 +65,15 @@ namespace gcn /** * @mainpage * @section Introduction - * This documentation is mostly intended as a reference to the API. If you want to get started with Guichan, we suggest you check out the programs in the examples directory of the Guichan release. + * This documentation is mostly intended as a reference to the API. + * If you want to get started with Guichan, we suggest you check out + * the programs in the examples directory of the Guichan release. * @n * @n - * This documentation is, and will always be, work in progress. If you find any errors, typos or inconsistencies, or if you feel something needs to be explained in more detail - don't hesitate to tell us. + * This documentation is, and will always be, work in progress. + * If you find any errors, typos or inconsistencies, or if you feel + * something needs to be explained in more detail - don't hesitate to + * tell us. */ /** diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp index 663c2059d..a0221ca7c 100644 --- a/src/guichan/include/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp @@ -72,7 +72,7 @@ namespace gcn unsigned int color = 0; - switch(bpp) + switch (bpp) { case 1: color = *p; @@ -127,7 +127,7 @@ namespace gcn Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b); - switch(bpp) + switch (bpp) { case 1: *p = pixel; @@ -234,7 +234,7 @@ namespace gcn Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b); - switch(bpp) + switch (bpp) { case 1: *p = pixel; diff --git a/src/guichan/keyinput.cpp b/src/guichan/keyinput.cpp index 3f5ebc124..35e8b6168 100644 --- a/src/guichan/keyinput.cpp +++ b/src/guichan/keyinput.cpp @@ -134,4 +134,3 @@ namespace gcn mNumericPad = numpad; } } - diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 79c65da9f..c8cec6370 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -289,7 +289,7 @@ namespace gcn mColor.r, mColor.g, mColor.b); - switch(bpp) + switch (bpp) { case 1: for (; x1 <= x2; ++x1) @@ -400,7 +400,7 @@ namespace gcn Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); - switch(bpp) + switch (bpp) { case 1: for (; y1 <= y2; ++y1) diff --git a/src/guichan/selectionevent.cpp b/src/guichan/selectionevent.cpp index 784252230..8c8a3f28f 100644 --- a/src/guichan/selectionevent.cpp +++ b/src/guichan/selectionevent.cpp @@ -63,4 +63,3 @@ namespace gcn } } - diff --git a/src/guichan/widgets/checkbox.cpp b/src/guichan/widgets/checkbox.cpp index ab0b19e00..c7ec3e1e0 100644 --- a/src/guichan/widgets/checkbox.cpp +++ b/src/guichan/widgets/checkbox.cpp @@ -138,4 +138,3 @@ namespace gcn distributeActionEvent(); } } - diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp index 40abaf41f..ead4e7815 100644 --- a/src/guichan/widgets/dropdown.cpp +++ b/src/guichan/widgets/dropdown.cpp @@ -422,4 +422,3 @@ namespace gcn } } } - diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp index c85ada7c3..dca3400ba 100644 --- a/src/guichan/widgets/icon.cpp +++ b/src/guichan/widgets/icon.cpp @@ -56,16 +56,16 @@ namespace gcn { - Icon::Icon() - : mImage(nullptr) - , mInternalImage(false) + Icon::Icon() : + mImage(nullptr), + mInternalImage(false) { setSize(0, 0); } - Icon::Icon(const std::string& filename) - : mImage(nullptr), - mInternalImage(false) + Icon::Icon(const std::string& filename) : + mImage(nullptr), + mInternalImage(false) { mImage = Image::load(filename); mInternalImage = true; @@ -73,9 +73,9 @@ namespace gcn mImage->getHeight()); } - Icon::Icon(const Image* image) - : mImage(image), - mInternalImage(false) + Icon::Icon(const Image* image) : + mImage(image), + mInternalImage(false) { setSize(mImage->getWidth(), mImage->getHeight()); diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp index 96a347607..8afc248c5 100644 --- a/src/guichan/widgets/tab.cpp +++ b/src/guichan/widgets/tab.cpp @@ -116,4 +116,3 @@ namespace gcn mHasMouse = false; } } - diff --git a/src/localconsts.h b/src/localconsts.h index 2d0eb5dea..de67c3850 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -30,4 +30,4 @@ #define A_UNUSED __attribute__ ((unused)) #else #define A_UNUSED -#endif \ No newline at end of file +#endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 81c988d53..bb0c087d5 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2338,7 +2338,7 @@ void LocalPlayer::crazyMove() { bool oldDisableCrazyMove = mDisableCrazyMove; mDisableCrazyMove = true; - switch(mCrazyMoveType) + switch (mCrazyMoveType) { case 1: crazyMove1(); @@ -2449,7 +2449,7 @@ void LocalPlayer::crazyMove3() if (mAction == MOVE) return; - switch(mCrazyMoveState) + switch (mCrazyMoveState) { case 0: move(1, 1); @@ -2483,7 +2483,7 @@ void LocalPlayer::crazyMove4() if (mAction == MOVE) return; - switch(mCrazyMoveState) + switch (mCrazyMoveState) { case 0: move(7, 0); @@ -2503,7 +2503,7 @@ void LocalPlayer::crazyMove5() if (mAction == MOVE) return; - switch(mCrazyMoveState) + switch (mCrazyMoveState) { case 0: move(0, 7); @@ -2523,7 +2523,7 @@ void LocalPlayer::crazyMove6() if (mAction == MOVE) return; - switch(mCrazyMoveState) + switch (mCrazyMoveState) { case 0: move(3, 0); @@ -2567,7 +2567,7 @@ void LocalPlayer::crazyMove7() if (mAction == MOVE) return; - switch(mCrazyMoveState) + switch (mCrazyMoveState) { case 0: move(1, 1); @@ -3045,7 +3045,7 @@ bool LocalPlayer::pickUpItems(int pickUpType) return status; int x1, y1, x2, y2; - switch(pickUpType) + switch (pickUpType) { case 1: switch (mDirection) @@ -3206,7 +3206,7 @@ void LocalPlayer::magicAttack() if (!Client::limitPackets(PACKET_CHAT)) return; - switch(mMagicAttackType) + switch (mMagicAttackType) { //flar W00 case 0: diff --git a/src/logger.cpp b/src/logger.cpp index a2df9a911..1541616f2 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -186,7 +186,7 @@ void Logger::log(const char *log_text, ...) debugChatTab->chatLog(buf, BY_LOGGER); // Delete temporary buffer - delete[] buf; + delete [] buf; } void Logger::error(const std::string &error_text) diff --git a/src/map.cpp b/src/map.cpp index a9aed4531..3ea9989a4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -181,9 +181,9 @@ Map::~Map() config.removeListener("beingopacity", this); // delete metadata, layers, tilesets and overlays - delete[] mMetaTiles; + delete [] mMetaTiles; for (int i = 0; i < NB_BLOCKTYPES; i++) - delete[] mOccupation[i]; + delete [] mOccupation[i]; mFringeLayer = nullptr; delete_all(mLayers); @@ -1435,7 +1435,7 @@ void Map::clearIndexedTilesets() return; mTilesetsIndexed = false; - delete[] mIndexedTilesets; + delete [] mIndexedTilesets; mIndexedTilesetsSize = 0; } diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 3e9c47968..514a35858 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -56,7 +56,7 @@ MapLayer::MapLayer(int x, int y, int width, int height, bool fringeLayer): MapLayer::~MapLayer() { config.removeListener("highlightAttackRange", this); - delete[] mTiles; + delete [] mTiles; delete_all(mTempRows); mTempRows.clear(); } @@ -534,7 +534,7 @@ SpecialLayer::~SpecialLayer() delete mTiles[f]; mTiles[f] = nullptr; } - delete[] mTiles; + delete [] mTiles; } MapItem* SpecialLayer::getTile(int x, int y) const @@ -722,7 +722,7 @@ void MapItem::draw(Graphics *graphics, int x, int y, int dx, int dy) if (mImage) graphics->drawImage(mImage, x, y); - switch(mType) + switch (mType) { case ROAD: case CROSS: diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index 100b600b4..7e857a52b 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -182,7 +182,7 @@ void MumbleManager::setAction(int action) if (!mLinkedMem) return; - switch(action) + switch (action) { case 0: /* STAND */ case 1: /* WALK */ @@ -228,7 +228,7 @@ void MumbleManager::setPos(int tileX, int tileY, int direction) // Unit vector pointing out of the avatars eyes // (here Front looks into scene). - switch(direction) + switch (direction) { case 4: /* UP */ mLinkedMemCache.fAvatarFront[0] = 0.0f; diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 84bd03bb1..d9e7e7506 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -511,6 +511,12 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) } break; + case 0x01: // dead + break; + // tmw server can send here garbage? +// if (srcBeing) +// srcBeing->setAction(Being::DEAD); + case 0x02: // Sit if (srcBeing) { diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index cf62af459..d5e344ac2 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -242,4 +242,3 @@ void PartyTab::saveToLogFile(std::string &msg) } } // namespace Ea - diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 4c4fb760c..d870eff38 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -330,7 +330,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) { Item *item = inventory->getItem(index); - if (item && item->getId() == itemId) + if (item && item->getId() == itemId) amount += item->getQuantity(); if (serverVersion < 1 && identified > 1) diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index f0a23127c..12451e6f6 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -293,7 +293,7 @@ void ChatHandler::handleChannelEvent(Net::MessageIn &msg) if (channel) { - switch(eventId) + switch (eventId) { case CHAT_EVENT_NEW_PLAYER: channel->getTab()->chatLog(strprintf(_("%s entered the " diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index dfd2ed3cf..aa82d6dcd 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -153,7 +153,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) Guild *guild = player_node->getGuild(guildId); if (guild) { - switch(eventId) + switch (eventId) { case GUILD_EVENT_NEW_PLAYER: member = guild->addMember(name); diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index aa79d4d41..b2609cf02 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -151,8 +151,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) PlayerInfo::setAttribute(CORR_POINTS, msg.readInt16()); Particle* effect = particleEngine->addEffect( paths.getStringValue("particles") - + paths.getStringValue("levelUpEffectFile") - , 0, 0); + + paths.getStringValue("levelUpEffectFile"), 0, 0); player_node->controlParticle(effect); } break; diff --git a/src/net/net.cpp b/src/net/net.cpp index 713b6aa7e..75bc35b72 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -202,4 +202,3 @@ ServerInfo::Type getNetworkType() } } // namespace Net - diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp index af90f5c6b..496ba64f5 100644 --- a/src/net/tmwa/gui/guildtab.cpp +++ b/src/net/tmwa/gui/guildtab.cpp @@ -53,4 +53,3 @@ GuildTab::~GuildTab() } } // namespace TmwAthena - diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp index d0738e79c..02bcfd54f 100644 --- a/src/net/tmwa/gui/partytab.cpp +++ b/src/net/tmwa/gui/partytab.cpp @@ -56,4 +56,3 @@ PartyTab::~PartyTab() } } // namespace TmwAthena - diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 31329eafb..6e9e367c0 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -133,8 +133,8 @@ Network::~Network() mMutex = nullptr; mInstance = nullptr; - delete[] mInBuffer; - delete[] mOutBuffer; + delete []mInBuffer; + delete []mOutBuffer; SDLNet_Quit(); } diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 2c3d914b0..bcf46e18b 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -61,9 +61,9 @@ OpenGLGraphics::OpenGLGraphics(): OpenGLGraphics::~OpenGLGraphics() { - delete[] mFloatTexArray; - delete[] mIntTexArray; - delete[] mIntVertArray; + delete [] mFloatTexArray; + delete [] mIntTexArray; + delete [] mIntVertArray; } void OpenGLGraphics::setSync(bool sync) diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 6b5cb0199..38062c352 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -103,7 +103,8 @@ class PlayerConfSerialiser : static PlayerConfSerialiser player_conf_serialiser; // stateless singleton -const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = { +const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = +{ /* NEUTRAL */ 0, // we always fall back to the defaults anyway /* FRIEND */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE, /* DISREGARDED*/ EMOTE | SPEECH_FLOAT, @@ -531,8 +532,6 @@ public: Uint8 mEmotion; }; - - std::vector * PlayerRelationsManager::getPlayerIgnoreStrategies() { diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 6f9042029..0ac11f114 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -250,14 +250,14 @@ Image *Image::createTextSurface(SDL_Surface *tmpImage, float alpha) // We also delete the alpha channel since // it's not used. - delete[] alphaChannel; + delete [] alphaChannel; alphaChannel = nullptr; } if (!image) { logger->log1("Error: Image convert failed."); - delete[] alphaChannel; + delete [] alphaChannel; return nullptr; } @@ -295,7 +295,7 @@ void Image::unload() SDL_FreeSurface(mSDLSurface); mSDLSurface = nullptr; - delete[] mAlphaChannel; + delete [] mAlphaChannel; mAlphaChannel = nullptr; } @@ -689,14 +689,14 @@ Image *Image::_SDLload(SDL_Surface *tmpImage) // We also delete the alpha channel since // it's not used. - delete[] alphaChannel; + delete [] alphaChannel; alphaChannel = nullptr; } if (!image) { logger->log1("Error: Image convert failed."); - delete[] alphaChannel; + delete [] alphaChannel; return nullptr; } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 1ddb74f20..eec14685d 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -503,7 +503,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map) const char *charStart = reinterpret_cast(xmlChars); if (!charStart) { - delete[] charData; + delete [] charData; return; } @@ -526,7 +526,7 @@ void MapReader::readLayer(XmlNodePtr node, Map *map) static_cast(strlen(reinterpret_cast( charData))), &binLen); - delete[] charData; + delete [] charData; xmlFree(xmlChars); if (binData) diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index c26526b97..7adeaa268 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -404,19 +404,19 @@ struct ResourceLoader { if (!v) return nullptr; - ResourceLoader *l = static_cast< ResourceLoader * >(v); - SDL_RWops *rw = PHYSFSRWOPS_openRead(l->path.c_str()); + ResourceLoader *rl = static_cast< ResourceLoader * >(v); + SDL_RWops *rw = PHYSFSRWOPS_openRead(rl->path.c_str()); if (!rw) return nullptr; - Resource *res = l->fun(rw); + Resource *res = rl->fun(rw); return res; } }; Resource *ResourceManager::load(const std::string &path, loader fun) { - ResourceLoader l = { this, path, fun }; - return get(path, ResourceLoader::load, &l); + ResourceLoader rl = { this, path, fun }; + return get(path, ResourceLoader::load, &rl); } Music *ResourceManager::getMusic(const std::string &idPath) @@ -438,11 +438,11 @@ struct DyedImageLoader if (!v) return nullptr; - DyedImageLoader *l = static_cast< DyedImageLoader * >(v); - if (!l->manager) + DyedImageLoader *rl = static_cast< DyedImageLoader * >(v); + if (!rl->manager) return nullptr; - std::string path = l->path; + std::string path = rl->path; std::string::size_type p = path.find('|'); Dye *d = nullptr; if (p != std::string::npos) @@ -465,8 +465,8 @@ struct DyedImageLoader Image *ResourceManager::getImage(const std::string &idPath) { - DyedImageLoader l = { this, idPath }; - return static_cast(get(idPath, DyedImageLoader::load, &l)); + DyedImageLoader rl = { this, idPath }; + return static_cast(get(idPath, DyedImageLoader::load, &rl)); } /* @@ -475,8 +475,8 @@ Image *ResourceManager::getSkinImage(const std::string &idPath) if (mSelectedSkin.empty()) return getImage(idPath); - DyedImageLoader l = { this, mSelectedSkin + idPath }; - void *ptr = get(idPath, DyedImageLoader::load, &l); + DyedImageLoader rl = { this, mSelectedSkin + idPath }; + void *ptr = get(idPath, DyedImageLoader::load, &rl); if (ptr) return static_cast(ptr); else @@ -494,14 +494,14 @@ struct ImageSetLoader if (!v) return nullptr; - ImageSetLoader *l = static_cast< ImageSetLoader * >(v); - if (!l->manager) + ImageSetLoader *rl = static_cast< ImageSetLoader * >(v); + if (!rl->manager) return nullptr; - Image *img = l->manager->getImage(l->path); + Image *img = rl->manager->getImage(rl->path); if (!img) return nullptr; - ImageSet *res = new ImageSet(img, l->w, l->h); + ImageSet *res = new ImageSet(img, rl->w, rl->h); img->decRef(); return res; } @@ -510,10 +510,10 @@ struct ImageSetLoader ImageSet *ResourceManager::getImageSet(const std::string &imagePath, int w, int h) { - ImageSetLoader l = { this, imagePath, w, h }; + ImageSetLoader rl = { this, imagePath, w, h }; std::stringstream ss; ss << imagePath << "[" << w << "x" << h << "]"; - return static_cast(get(ss.str(), ImageSetLoader::load, &l)); + return static_cast(get(ss.str(), ImageSetLoader::load, &rl)); } struct SpriteDefLoader @@ -525,17 +525,17 @@ struct SpriteDefLoader if (!v) return nullptr; - SpriteDefLoader *l = static_cast< SpriteDefLoader * >(v); - return SpriteDef::load(l->path, l->variant); + SpriteDefLoader *rl = static_cast< SpriteDefLoader * >(v); + return SpriteDef::load(rl->path, rl->variant); } }; SpriteDef *ResourceManager::getSprite(const std::string &path, int variant) { - SpriteDefLoader l = { path, variant }; + SpriteDefLoader rl = { path, variant }; std::stringstream ss; ss << path << "[" << variant << "]"; - return static_cast(get(ss.str(), SpriteDefLoader::load, &l)); + return static_cast(get(ss.str(), SpriteDefLoader::load, &rl)); } void ResourceManager::release(Resource *res) @@ -723,10 +723,10 @@ struct RescaledLoader { if (!v) return nullptr; - RescaledLoader *l = static_cast< RescaledLoader * >(v); - if (!l->manager) + RescaledLoader *rl = static_cast< RescaledLoader * >(v); + if (!rl->manager || !rl->image) return nullptr; - Image *rescaled = l->image->SDLgetScaledImage(l->width, l->height); + Image *rescaled = rl->image->SDLgetScaledImage(rl->width, rl->height); if (!rescaled) return nullptr; return rescaled; @@ -740,7 +740,7 @@ Image *ResourceManager::getRescaled(Image *image, int width, int height) std::string idPath = image->getIdPath() + strprintf( "_rescaled%dx%d", width, height); - RescaledLoader l = { this, image, width, height }; - Image *img = static_cast(get(idPath, RescaledLoader::load, &l)); + RescaledLoader rl = { this, image, width, height }; + Image *img = static_cast(get(idPath, RescaledLoader::load, &rl)); return img; } diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index b1a3a9c4d..664d2c73d 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -36,7 +36,7 @@ namespace SpecialInfo::TargetMode SpecialDB::targetModeFromString(const std::string& str) { - if (str == "self") return SpecialInfo::TARGET_SELF; + if (str == "self") return SpecialInfo::TARGET_SELF; else if (str == "friend") return SpecialInfo::TARGET_FRIEND; else if (str == "enemy") return SpecialInfo::TARGET_ENEMY; else if (str == "being") return SpecialInfo::TARGET_BEING; @@ -131,4 +131,3 @@ SpecialInfo *SpecialDB::get(int id) return i->second; return nullptr; } - diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 7c4c444f0..ebdff6382 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -66,7 +66,8 @@ TextCommand* SpellManager::getSpellByItem(int itemId) void SpellManager::fillSpells() { -//id, std::string name, std::string symbol, ST type, int basicLvl, MagicSchool school, int schoolLvl, int mana) +//id, std::string name, std::string symbol, ST type, int basicLvl, +// MagicSchool school, int schoolLvl, int mana) addSpell(new TextCommand(0, "lum", "#lum", "heal with lifestones", ALLOWTARGET, "", 1, SKILL_MAGIC_LIFE, 0, 6)); diff --git a/src/textcommand.h b/src/textcommand.h index 27b44cc7a..6677b97e9 100644 --- a/src/textcommand.h +++ b/src/textcommand.h @@ -153,7 +153,7 @@ class TextCommand { mCommandType = commandType; } bool isEmpty() const - { return mCommand == "" && mSymbol == "" ; } + { return mCommand == "" && mSymbol == ""; } Image *getImage() const { return mImage; } diff --git a/src/units.cpp b/src/units.cpp index 804512dbd..1440cff9f 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -150,12 +150,12 @@ void Units::loadUnits() } // Add one more level for saftey - struct UnitLevel ll; - ll.symbol = ""; - ll.count = INT_MAX; - ll.round = 0; + struct UnitLevel lev; + lev.symbol = ""; + lev.count = INT_MAX; + lev.round = 0; - ud.levels.push_back(ll); + ud.levels.push_back(lev); if (type == "weight") units[UNIT_WEIGHT] = ud; diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 24a3a58e3..cd7d59cdb 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -125,7 +125,7 @@ unsigned char *php3_base64_decode(const unsigned char *string, continue; ch = static_cast(chp - base64_table); - switch(i % 4) + switch (i % 4) { case 0: result[j] = ch << 2; @@ -151,7 +151,7 @@ unsigned char *php3_base64_decode(const unsigned char *string, /* mop things up if we ended on a boundary */ if (ch == base64_pad) { - switch(i % 4) + switch (i % 4) { case 0: case 1: diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h index efa004ac6..1f52f40aa 100644 --- a/src/utils/physfsrwops.h +++ b/src/utils/physfsrwops.h @@ -79,4 +79,3 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle); #endif /* include-once blocker */ /* end of physfsrwops.h ... */ - diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index becb2124d..5e7bf19a0 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -405,7 +405,7 @@ std::set splitToIntSet(const std::string &text, char separator) std::set tokens; std::stringstream ss(text); std::string item; - while(std::getline(ss, item, separator)) + while (std::getline(ss, item, separator)) tokens.insert(atoi(item.c_str())); return tokens; @@ -416,7 +416,7 @@ std::list splitToIntList(const std::string &text, char separator) std::list tokens; std::stringstream ss(text); std::string item; - while(std::getline(ss, item, separator)) + while (std::getline(ss, item, separator)) tokens.push_back(atoi(item.c_str())); return tokens; @@ -429,7 +429,7 @@ std::list splitToStringList(const std::string &text, std::list tokens; std::stringstream ss(text); std::string item; - while(std::getline(ss, item, separator)) + while (std::getline(ss, item, separator)) tokens.push_back(item); return tokens; @@ -440,7 +440,7 @@ void splitToStringVector(std::vector &tokens, { std::stringstream ss(text); std::string item; - while(std::getline(ss, item, separator)) + while (std::getline(ss, item, separator)) { item = trim(item); if (!item.empty()) diff --git a/src/vector.h b/src/vector.h index 744b235c0..2caf48418 100644 --- a/src/vector.h +++ b/src/vector.h @@ -185,8 +185,8 @@ class Vector */ Vector normalized() const { - const float l = length(); - return Vector(x / l, y / l, z / l); + const float len = length(); + return Vector(x / len, y / len, z / len); } float x, y, z; -- cgit v1.2.3-70-g09d2 From 178f4811e8602ba7dacb1a0513baa546088d517d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Feb 2012 02:13:16 +0300 Subject: Fix compilation errors and more style. --- src/client.cpp | 8 +- src/configuration.cpp | 48 +++++----- src/debug/debug_new.cpp | 182 ++++++++++++++++++------------------ src/debug/debug_new.h | 12 +-- src/defaults.cpp | 2 - src/defaults.h | 20 ++-- src/event.cpp | 5 - src/event.h | 10 +- src/game.cpp | 20 ++-- src/gui/chatwindow.cpp | 14 +-- src/gui/chatwindow.h | 4 +- src/gui/inventorywindow.cpp | 8 +- src/gui/inventorywindow.h | 4 +- src/gui/killstats.cpp | 8 +- src/gui/killstats.h | 6 +- src/gui/ministatuswindow.cpp | 10 +- src/gui/ministatuswindow.h | 4 +- src/gui/statuswindow.cpp | 10 +- src/gui/statuswindow.h | 4 +- src/listener.cpp | 5 - src/listener.h | 5 - src/localplayer.cpp | 12 +-- src/localplayer.h | 4 +- src/net/ea/gamehandler.cpp | 12 +-- src/net/ea/gamehandler.h | 6 +- src/net/manaserv/generalhandler.cpp | 14 +-- src/net/manaserv/generalhandler.h | 4 +- src/net/tmwa/generalhandler.cpp | 10 +- src/net/tmwa/generalhandler.h | 4 +- src/playerinfo.cpp | 28 +++--- src/resources/emotedb.cpp | 6 +- src/variabledata.h | 5 - 32 files changed, 234 insertions(+), 260 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/client.cpp b/src/client.cpp index 54a0b6224..023eb5353 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -988,10 +988,10 @@ int Client::gameExec() if (mState != mOldState) { - Mana::Event evt(EVENT_STATECHANGE); + Event evt(EVENT_STATECHANGE); evt.setInt("oldState", mOldState); evt.setInt("newState", mState); - Mana::Event::trigger(CHANNEL_CLIENT, evt); + Event::trigger(CHANNEL_CLIENT, evt); if (mOldState == STATE_GAME) { @@ -1191,10 +1191,10 @@ int Client::gameExec() if (!BeingInfo::unknown) BeingInfo::unknown = new BeingInfo; - Mana::Event evt2(EVENT_STATECHANGE); + Event evt2(EVENT_STATECHANGE); evt2.setInt("newState", STATE_LOAD_DATA); evt2.setInt("oldState", mOldState); - Mana::Event::trigger(CHANNEL_CLIENT, evt2); + Event::trigger(CHANNEL_CLIENT, evt2); // Load XML databases CharDB::load(); diff --git a/src/configuration.cpp b/src/configuration.cpp index 254a3fea8..c4f1cc360 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -193,21 +193,21 @@ int Configuration::getIntValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - if (itdef->second->getType() == Mana::VariableData::DATA_INT) + if (itdef->second->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast( + defaultValue = (static_cast( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - defaultValue = atoi((static_cast( + defaultValue = atoi((static_cast( itdef->second))->getData().c_str()); } else if (itdef->second->getType() - == Mana::VariableData::DATA_BOOL) + == VariableData::DATA_BOOL) { - if ((static_cast( + if ((static_cast( itdef->second))->getData()) { defaultValue = 1; @@ -241,9 +241,9 @@ int Configuration::resetIntValue(const std::string &key) DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_INT) + && itdef->second->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast( + defaultValue = (static_cast( itdef->second))->getData(); } else @@ -270,15 +270,15 @@ std::string Configuration::getStringValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - defaultValue = (static_cast( + defaultValue = (static_cast( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_BOOL) + == VariableData::DATA_BOOL) { - if ((static_cast( + if ((static_cast( itdef->second))->getData()) { defaultValue = "1"; @@ -289,9 +289,9 @@ std::string Configuration::getStringValue(const std::string &key) const } } else if (itdef->second->getType() - == Mana::VariableData::DATA_INT) + == VariableData::DATA_INT) { - defaultValue = toString((static_cast( + defaultValue = toString((static_cast( itdef->second))->getData()); } } @@ -322,10 +322,10 @@ float Configuration::getFloatValue(const std::string &key) const DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_FLOAT) + && itdef->second->getType() == VariableData::DATA_FLOAT) { defaultValue = static_cast( - (static_cast(itdef->second))->getData()); + (static_cast(itdef->second))->getData()); } else { @@ -354,15 +354,15 @@ bool Configuration::getBoolValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - if (itdef->second->getType() == Mana::VariableData::DATA_BOOL) + if (itdef->second->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast( + defaultValue = (static_cast( itdef->second))->getData(); } else if (itdef->second->getType() - == Mana::VariableData::DATA_INT) + == VariableData::DATA_INT) { - if ((static_cast( + if ((static_cast( itdef->second))->getData() != 0) { defaultValue = true; @@ -373,9 +373,9 @@ bool Configuration::getBoolValue(const std::string &key) const } } else if (itdef->second->getType() - == Mana::VariableData::DATA_STRING) + == VariableData::DATA_STRING) { - if ((static_cast( + if ((static_cast( itdef->second))->getData() != "0") { defaultValue = true; @@ -410,9 +410,9 @@ bool Configuration::resetBoolValue(const std::string &key) DefaultsData::const_iterator itdef = mDefaultsData->find(key); if (itdef != mDefaultsData->end() && itdef->second - && itdef->second->getType() == Mana::VariableData::DATA_BOOL) + && itdef->second->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast( + defaultValue = (static_cast( itdef->second))->getData(); } else diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp index 9e30d30d9..fb83cab4a 100644 --- a/src/debug/debug_new.cpp +++ b/src/debug/debug_new.cpp @@ -62,49 +62,49 @@ #endif /** - * @def _DEBUG_NEW_ALIGNMENT + * @def M_DEBUG_NEW_ALIGNMENT * * The alignment requirement of allocated memory blocks. It must be a * power of two. */ -#ifndef _DEBUG_NEW_ALIGNMENT -#define _DEBUG_NEW_ALIGNMENT 16 +#ifndef M_DEBUG_NEW_ALIGNMENT +#define M_DEBUG_NEW_ALIGNMENT 16 #endif /** - * @def _DEBUG_NEW_CALLER_ADDRESS + * @def M_DEBUG_NEW_CALLER_ADDRESS * * The expression to return the caller address. #print_position will * later on use this address to print the position information of memory * operation points. */ -#ifndef _DEBUG_NEW_CALLER_ADDRESS +#ifndef M_DEBUG_NEW_CALLER_ADDRESS #ifdef __GNUC__ -#define _DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) +#define M_DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) #else -#define _DEBUG_NEW_CALLER_ADDRESS NULL +#define M_DEBUG_NEW_CALLER_ADDRESS NULL #endif #endif /** - * @def _DEBUG_NEW_ERROR_ACTION + * @def M_DEBUG_NEW_ERROR_ACTION * * The action to take when an error occurs. The default behaviour is to - * call \e abort, unless \c _DEBUG_NEW_ERROR_CRASH is defined, in which + * call \e abort, unless \c M_DEBUG_NEW_ERROR_CRASH is defined, in which * case a segmentation fault will be triggered instead (which can be * useful on platforms like Windows that do not generate a core dump * when \e abort is called). */ -#ifndef _DEBUG_NEW_ERROR_ACTION -#ifndef _DEBUG_NEW_ERROR_CRASH -#define _DEBUG_NEW_ERROR_ACTION abort() +#ifndef M_DEBUG_NEW_ERROR_ACTION +#ifndef M_DEBUG_NEW_ERROR_CRASH +#define M_DEBUG_NEW_ERROR_ACTION abort() #else -#define _DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) +#define M_DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) #endif #endif /** - * @def _DEBUG_NEW_FILENAME_LEN + * @def M_DEBUG_NEW_FILENAME_LEN * * The length of file name stored if greater than zero. If it is zero, * only a const char pointer will be stored. Currently the default @@ -114,70 +114,70 @@ * name in a shared library after a \c SIGINT). The current default * value makes the size of new_ptr_list_t 64 on 32-bit platforms. */ -#ifndef _DEBUG_NEW_FILENAME_LEN -#define _DEBUG_NEW_FILENAME_LEN 100 +#ifndef M_DEBUG_NEW_FILENAME_LEN +#define M_DEBUG_NEW_FILENAME_LEN 100 #endif /** - * @def _DEBUG_NEW_PROGNAME + * @def M_DEBUG_NEW_PROGNAME * * The program (executable) name to be set at compile time. It is * better to assign the full program path to #new_progname in \e main * (at run time) than to use this (compile-time) macro, but this macro * serves well as a quick hack. Note also that double quotation marks * need to be used around the program name, i.e., one should specify a - * command-line option like -D_DEBUG_NEW_PROGNAME=\"a.out\" - * in \e bash, or -D_DEBUG_NEW_PROGNAME=\"a.exe\" in the + * command-line option like -DM_DEBUG_NEW_PROGNAME=\"a.out\" + * in \e bash, or -DM_DEBUG_NEW_PROGNAME=\"a.exe\" in the * Windows command prompt. */ -#ifndef _DEBUG_NEW_PROGNAME -#define _DEBUG_NEW_PROGNAME NULL +#ifndef M_DEBUG_NEW_PROGNAME +#define M_DEBUG_NEW_PROGNAME NULL #endif /** - * @def _DEBUG_NEW_STD_OPER_NEW + * @def M_DEBUG_NEW_STD_OPER_NEW * * Macro to indicate whether the standard-conformant behaviour of * operator new is wanted. It is on by default now, but * the user may set it to \c 0 to revert to the old behaviour. */ -#ifndef _DEBUG_NEW_STD_OPER_NEW -#define _DEBUG_NEW_STD_OPER_NEW 1 +#ifndef M_DEBUG_NEW_STD_OPER_NEW +#define M_DEBUG_NEW_STD_OPER_NEW 1 #endif /** - * @def _DEBUG_NEW_TAILCHECK + * @def M_DEBUG_NEW_TAILCHECK * * Macro to indicate whether a writing-past-end check will be performed. * Define it to a positive integer as the number of padding bytes at the * end of a memory block for checking. */ -#ifndef _DEBUG_NEW_TAILCHECK -#define _DEBUG_NEW_TAILCHECK 0 +#ifndef M_DEBUG_NEW_TAILCHECK +#define M_DEBUG_NEW_TAILCHECK 0 #endif /** - * @def _DEBUG_NEW_TAILCHECK_CHAR + * @def M_DEBUG_NEW_TAILCHECK_CHAR * * Value of the padding bytes at the end of a memory block. */ -#ifndef _DEBUG_NEW_TAILCHECK_CHAR -#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC +#ifndef M_DEBUG_NEW_TAILCHECK_CHAR +#define M_DEBUG_NEW_TAILCHECK_CHAR 0xCC #endif /** - * @def _DEBUG_NEW_USE_ADDR2LINE + * @def M_DEBUG_NEW_USE_ADDR2LINE * * Whether to use \e addr2line to convert a caller address to file/line * information. Defining it to a non-zero value will enable the * conversion (automatically done if GCC is detected). Defining it to * zero will disable the conversion. */ -#ifndef _DEBUG_NEW_USE_ADDR2LINE +#ifndef M_DEBUG_NEW_USE_ADDR2LINE #ifdef __GNUC__ -#define _DEBUG_NEW_USE_ADDR2LINE 1 +#define M_DEBUG_NEW_USE_ADDR2LINE 1 #else -#define _DEBUG_NEW_USE_ADDR2LINE 0 +#define M_DEBUG_NEW_USE_ADDR2LINE 0 #endif #endif @@ -187,20 +187,20 @@ #pragma init_seg(lib) #endif -#undef _DEBUG_NEW_EMULATE_MALLOC -#undef _DEBUG_NEW_REDEFINE_NEW +#undef M_DEBUG_NEW_EMULATE_MALLOC +#undef M_DEBUG_NEW_REDEFINE_NEW /** * Macro to indicate whether redefinition of \c new is wanted. Here it * is defined to \c 0 to disable the redefinition of \c new. */ -#define _DEBUG_NEW_REDEFINE_NEW 0 +#define M_DEBUG_NEW_REDEFINE_NEW 0 #include "debug_new.h" /** * Gets the aligned value of memory block size. */ #define align(s) \ - (((s) + _DEBUG_NEW_ALIGNMENT - 1) & ~(_DEBUG_NEW_ALIGNMENT - 1)) + (((s) + M_DEBUG_NEW_ALIGNMENT - 1) & ~(M_DEBUG_NEW_ALIGNMENT - 1)) /** * Structure to store the position information where \c new occurs. @@ -212,10 +212,10 @@ struct new_ptr_list_t size_t size; union { -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 const char* file; #else - char file[_DEBUG_NEW_FILENAME_LEN]; + char file[M_DEBUG_NEW_FILENAME_LEN]; #endif void* addr; }; @@ -244,7 +244,7 @@ static new_ptr_list_t new_ptr_list = &new_ptr_list, 0, { -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 NULL #else "" @@ -291,15 +291,15 @@ FILE* new_output_fp = stderr; /** * Pointer to the program name. Its initial value is the macro - * #_DEBUG_NEW_PROGNAME. You should try to assign the program path to + * #M_DEBUG_NEW_PROGNAME. You should try to assign the program path to * it early in your application. Assigning argv[0] to it * in \e main is one way. If you use \e bash or \e ksh (or similar), * the following statement is probably what you want: * `new_progname = getenv("_");'. */ -const char* new_progname = _DEBUG_NEW_PROGNAME; +const char* new_progname = M_DEBUG_NEW_PROGNAME; -#if _DEBUG_NEW_USE_ADDR2LINE +#if M_DEBUG_NEW_USE_ADDR2LINE /** * Tries printing the position information from an instruction address. * This is the version that uses \e addr2line. @@ -397,11 +397,11 @@ static bool print_position_from_addr(const void*) { return false; } -#endif // _DEBUG_NEW_USE_ADDR2LINE +#endif // M_DEBUG_NEW_USE_ADDR2LINE /** * Prints the position information of a memory operation point. When \c - * _DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this + * M_DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this * function will try to convert a given caller address to file/line * information with \e addr2line. * @@ -427,7 +427,7 @@ static void print_position(const void* ptr, int line) } } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK /** * Checks whether the padding bytes at the end of a memory block is * tampered with. @@ -440,9 +440,9 @@ static bool check_tail(new_ptr_list_t* ptr) { const unsigned char* const pointer = (unsigned char*)ptr + ALIGNED_LIST_ITEM_SIZE + ptr->size; - for (int i = 0; i < _DEBUG_NEW_TAILCHECK; ++i) + for (int i = 0; i < M_DEBUG_NEW_TAILCHECK; ++i) { - if (pointer[i] != _DEBUG_NEW_TAILCHECK_CHAR) + if (pointer[i] != M_DEBUG_NEW_TAILCHECK_CHAR) return false; } return true; @@ -462,14 +462,14 @@ static bool check_tail(new_ptr_list_t* ptr) static void* alloc_mem(size_t size, const char* file, int line, bool is_array) { assert(line >= 0); - STATIC_ASSERT((_DEBUG_NEW_ALIGNMENT & (_DEBUG_NEW_ALIGNMENT - 1)) == 0, + STATIC_ASSERT((M_DEBUG_NEW_ALIGNMENT & (M_DEBUG_NEW_ALIGNMENT - 1)) == 0, Alignment_must_be_power_of_two); - STATIC_ASSERT(_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); - size_t s = size + ALIGNED_LIST_ITEM_SIZE + _DEBUG_NEW_TAILCHECK; + STATIC_ASSERT(M_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); + size_t s = size + ALIGNED_LIST_ITEM_SIZE + M_DEBUG_NEW_TAILCHECK; new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s); if (ptr == NULL) { -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW return NULL; #else fast_mutex_autolock lock(new_output_lock); @@ -477,17 +477,17 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array) "Out of memory when allocating %u bytes\n", size); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; #endif } void* pointer = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 ptr->file = file; #else if (line) { - strncpy(ptr->file, file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; + strncpy(ptr->file, file, M_DEBUG_NEW_FILENAME_LEN - 1) + [M_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; } else { @@ -506,9 +506,9 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array) new_ptr_list.prev = ptr; } ptr->dumped = 0; -#if _DEBUG_NEW_TAILCHECK - memset((char*)pointer + size, _DEBUG_NEW_TAILCHECK_CHAR, - _DEBUG_NEW_TAILCHECK); +#if M_DEBUG_NEW_TAILCHECK + memset((char*)pointer + size, M_DEBUG_NEW_TAILCHECK_CHAR, + M_DEBUG_NEW_TAILCHECK); #endif if (new_verbose_flag) { @@ -552,7 +552,7 @@ static void free_pointer(void* pointer, void* addr, bool is_array) } check_mem_corruption(); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } if (is_array != ptr->is_array) { @@ -575,14 +575,14 @@ static void free_pointer(void* pointer, void* addr, bool is_array) print_position(ptr->addr, ptr->line); fprintf(new_output_fp, "\n"); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (!check_tail(ptr)) { check_mem_corruption(); fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; + M_DEBUG_NEW_ERROR_ACTION; } #endif { @@ -630,7 +630,7 @@ int check_leaks() "warning: heap data corrupt near %p\n", pointer); } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (!check_tail(ptr)) { fprintf(new_output_fp, @@ -687,14 +687,14 @@ int check_mem_corruption() { const char* const pointer = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; if (ptr->magic == MAGIC -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK && check_tail(ptr) #endif ) { continue; } -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK if (ptr->magic != MAGIC) { #endif @@ -702,7 +702,7 @@ int check_mem_corruption() "Heap data corrupt near %p (size %u, ", pointer, (unsigned)ptr->size); -#if _DEBUG_NEW_TAILCHECK +#if M_DEBUG_NEW_TAILCHECK } else { @@ -738,19 +738,19 @@ void __debug_new_recorder::_M_process(void* pointer) _M_file, _M_line); return; } -#if _DEBUG_NEW_FILENAME_LEN == 0 +#if M_DEBUG_NEW_FILENAME_LEN == 0 ptr->file = _M_file; #else - strncpy(ptr->file, _M_file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; + strncpy(ptr->file, _M_file, M_DEBUG_NEW_FILENAME_LEN - 1) + [M_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; #endif ptr->line = _M_line; } -void* operator new(size_t size, const char* file, int line) +void* operator new (size_t size, const char* file, int line) { void* ptr = alloc_mem(size, file, line, false); -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW if (ptr) return ptr; else @@ -760,10 +760,10 @@ void* operator new(size_t size, const char* file, int line) #endif } -void* operator new[](size_t size, const char* file, int line) +void* operator new [](size_t size, const char* file, int line) { void* ptr = alloc_mem(size, file, line, true); -#if _DEBUG_NEW_STD_OPER_NEW +#if M_DEBUG_NEW_STD_OPER_NEW if (ptr) return ptr; else @@ -773,40 +773,40 @@ void* operator new[](size_t size, const char* file, int line) #endif } -void* operator new(size_t size) throw(std::bad_alloc) +void* operator new (size_t size) throw(std::bad_alloc) { - return operator new(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + return operator new (size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } -void* operator new[](size_t size) throw(std::bad_alloc) +void* operator new [](size_t size) throw(std::bad_alloc) { - return operator new[](size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + return operator new [](size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } #if !defined(__BORLANDC__) || __BORLANDC__ > 0x551 -void* operator new(size_t size, const std::nothrow_t&) throw() +void* operator new (size_t size, const std::nothrow_t&) throw() { - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, false); + return alloc_mem(size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0, false); } -void* operator new[](size_t size, const std::nothrow_t&) throw() +void* operator new [](size_t size, const std::nothrow_t&) throw() { - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, true); + return alloc_mem(size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0, true); } #endif -void operator delete(void* pointer) throw() +void operator delete (void* pointer) throw() { - free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, false); + free_pointer(pointer, M_DEBUG_NEW_CALLER_ADDRESS, false); } void operator delete [](void* pointer) throw() { - free_pointer(pointer, _DEBUG_NEW_CALLER_ADDRESS, true); + free_pointer(pointer, M_DEBUG_NEW_CALLER_ADDRESS, true); } #if HAVE_PLACEMENT_DELETE -void operator delete(void* pointer, const char* file, int line) throw() +void operator delete (void* pointer, const char* file, int line) throw() { if (new_verbose_flag) { @@ -817,7 +817,7 @@ void operator delete(void* pointer, const char* file, int line) throw() print_position(file, line); fprintf(new_output_fp, ")\n"); } - operator delete(pointer); + operator delete (pointer); } void operator delete [](void* pointer, const char* file, int line) throw() @@ -834,14 +834,14 @@ void operator delete [](void* pointer, const char* file, int line) throw() operator delete [](pointer); } -void operator delete(void* pointer, const std::nothrow_t&) throw() +void operator delete (void* pointer, const std::nothrow_t&) throw() { - operator delete(pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + operator delete (pointer, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } void operator delete [](void* pointer, const std::nothrow_t&) throw() { - operator delete [](pointer, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); + operator delete [](pointer, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0); } #endif // HAVE_PLACEMENT_DELETE diff --git a/src/debug/debug_new.h b/src/debug/debug_new.h index 0e99b96a7..157f2648a 100644 --- a/src/debug/debug_new.h +++ b/src/debug/debug_new.h @@ -61,7 +61,7 @@ #endif /** - * @def _DEBUG_NEW_REDEFINE_NEW + * @def M_DEBUG_NEW_REDEFINE_NEW * * Macro to indicate whether redefinition of \c new is wanted. If one * wants to define one's own operator new, to call @@ -84,8 +84,8 @@ * # endif * @endcode */ -#ifndef _DEBUG_NEW_REDEFINE_NEW -#define _DEBUG_NEW_REDEFINE_NEW 1 +#ifndef M_DEBUG_NEW_REDEFINE_NEW +#define M_DEBUG_NEW_REDEFINE_NEW 1 #endif /* Prototypes */ @@ -114,16 +114,16 @@ extern const char* new_progname; // default to NULL; should be assigned argv[0] * @def DEBUG_NEW * * Macro to catch file/line information on allocation. If - * #_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; + * #M_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; * otherwise \c new will be defined to it, and one must use \c new * instead. */ #define DEBUG_NEW __debug_new_recorder(__FILE__, __LINE__) ->* new -# if _DEBUG_NEW_REDEFINE_NEW +# if M_DEBUG_NEW_REDEFINE_NEW # define new DEBUG_NEW # endif -# ifdef _DEBUG_NEW_EMULATE_MALLOC +# ifdef M_DEBUG_NEW_EMULATE_MALLOC # include # ifdef new # define malloc(s) ((void*)(new char[s])) diff --git a/src/defaults.cpp b/src/defaults.cpp index 1bce806ff..18b00dfb7 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -31,8 +31,6 @@ #include "debug.h" -using namespace Mana; - VariableData* createData(int defData) { return new IntData(defData); diff --git a/src/defaults.h b/src/defaults.h index 850e15d37..fc74f76c8 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -26,16 +26,16 @@ #include #include "variabledata.h" -typedef std::map DefaultsData; +typedef std::map DefaultsData; -Mana::VariableData* createData(int defData); -Mana::VariableData* createData(double defData); -Mana::VariableData* createData(float defData); -Mana::VariableData* createData(const std::string &defData); -Mana::VariableData* createData(const char* defData); -Mana::VariableData* createData(bool defData); -Mana::DefaultsData* getConfigDefaults(); -Mana::DefaultsData* getBrandingDefaults(); -Mana::DefaultsData* getPathsDefaults(); +VariableData* createData(int defData); +VariableData* createData(double defData); +VariableData* createData(float defData); +VariableData* createData(const std::string &defData); +VariableData* createData(const char* defData); +VariableData* createData(bool defData); +DefaultsData* getConfigDefaults(); +DefaultsData* getBrandingDefaults(); +DefaultsData* getPathsDefaults(); #endif diff --git a/src/event.cpp b/src/event.cpp index 4f77967bc..a536bcaea 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -26,9 +26,6 @@ #include "debug.h" -namespace Mana -{ - ListenMap Event::mBindings; Event::~Event() @@ -142,5 +139,3 @@ void Event::unbind(Listener *listener, Channels channel) { mBindings[channel].erase(listener); } - -} diff --git a/src/event.h b/src/event.h index 61bf31e14..7dffaad21 100644 --- a/src/event.h +++ b/src/event.h @@ -26,10 +26,6 @@ #include #include - -namespace Mana -{ - enum Channels { CHANNEL_ACTORSPRITE = 0, @@ -115,9 +111,9 @@ typedef std::set ListenerSet; typedef std::map ListenMap; #define SERVER_NOTICE(message) { \ -Mana::Event event(Mana::EVENT_SERVERNOTICE); \ +Event event(EVENT_SERVERNOTICE); \ event.setString("message", message); \ -Mana::Event::trigger(Mana::CHANNEL_NOTICES, event); } +Event::trigger(CHANNEL_NOTICES, event); } class Event { @@ -172,6 +168,4 @@ class Event VariableMap mData; }; -} // namespace Mana - #endif diff --git a/src/game.cpp b/src/game.cpp index cd54f9c98..6adf62f12 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -175,7 +175,7 @@ const unsigned adjustDelay = 10; */ static void initEngines() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_ENGINESINITALIZING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZING)); actorSpriteManager = new ActorSpriteManager; commandHandler = new CommandHandler; @@ -187,7 +187,7 @@ static void initEngines() particleEngine = new Particle(nullptr); particleEngine->setupEngine(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_ENGINESINITALIZED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZED)); } /** @@ -195,7 +195,7 @@ static void initEngines() */ static void createGuiWindows() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADING)); if (setupWindow) setupWindow->clearWindowsForReset(); @@ -292,7 +292,7 @@ static void createGuiWindows() if (player_node) player_node->updateStatus(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSLOADED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADED)); } #define del_0(X) { delete X; X = nullptr; } @@ -302,7 +302,7 @@ static void createGuiWindows() */ static void destroyGuiWindows() { - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADING)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADING)); logger->setChatWindow(nullptr); if (whoIsOnline) @@ -345,7 +345,7 @@ static void destroyGuiWindows() del_0(killStats); del_0(didYouKnowWindow); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_GUIWINDOWSUNLOADED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADED)); if (auctionManager && AuctionManager::getEnableAuctionBot()) auctionManager->reload(); @@ -416,7 +416,7 @@ Game::Game(): if (guildManager && GuildManager::getEnableGuildBot()) guildManager->requestGuildInfo(); - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_CONSTRUCTED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_CONSTRUCTED)); } Game::~Game() @@ -450,7 +450,7 @@ Game::~Game() mInstance = nullptr; - Mana::Event::trigger(CHANNEL_GAME, Mana::Event(EVENT_DESTRUCTED)); + Event::trigger(CHANNEL_GAME, Event(EVENT_DESTRUCTED)); } static bool saveScreenshot() @@ -1843,9 +1843,9 @@ void Game::changeMap(const std::string &mapPath) if (mumbleManager) mumbleManager->setMap(mapPath); - Mana::Event event(EVENT_MAPLOADED); + Event event(EVENT_MAPLOADED); event.setString("mapPath", mapPath); - Mana::Event::trigger(CHANNEL_GAME, event); + Event::trigger(CHANNEL_GAME, event); } void Game::updateHistory(SDL_Event &event) diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 452d2420e..4fa608f35 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -159,7 +159,7 @@ ChatWindow::ChatWindow(): mGMLoaded(false) { listen(CHANNEL_NOTICES); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Chat"); @@ -866,19 +866,19 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) +void ChatWindow::processEvent(Channels channel, const Event &event) { - if (channel == Mana::CHANNEL_NOTICES) + if (channel == CHANNEL_NOTICES) { - if (event.getName() == Mana::EVENT_SERVERNOTICE && localChatTab) + if (event.getName() == EVENT_SERVERNOTICE && localChatTab) localChatTab->chatLog(event.getString("message"), BY_SERVER); } - else if (channel == Mana::CHANNEL_ATTRIBUTES) + else if (channel == CHANNEL_ATTRIBUTES) { if (!config.getBoolValue("showBattleEvents")) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -902,7 +902,7 @@ void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) break; }; } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { if (!config.getBoolValue("showJobExp")) return; diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 82e3d31f2..b3dce33fc 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -80,7 +80,7 @@ struct CHATLOG class ChatWindow : public Window, public gcn::ActionListener, public gcn::KeyListener, - public Mana::Listener + public Listener { public: /** @@ -190,7 +190,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); /** * Scrolls the chat window diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 23f1e6fcf..8c59d10eb 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -113,7 +113,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): setWindowName("Inventory"); } - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); @@ -585,10 +585,10 @@ void InventoryWindow::close() } } -void InventoryWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void InventoryWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 9d4be5afc..08456ba29 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -54,7 +54,7 @@ class InventoryWindow : public Window, public gcn::KeyListener, public gcn::SelectionListener, public InventoryListener, - public Mana::Listener + public Listener { public: /** @@ -126,7 +126,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateButtons(Item *item = nullptr); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 972c660ec..357a016f2 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -60,7 +60,7 @@ KillStats::KillStats(): setStickyButtonLock(true); setDefaultSize(250, 250, 350, 300); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); int xp(PlayerInfo::getAttribute(EXP)); int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED)); @@ -438,10 +438,10 @@ void KillStats::validateJacko() } } -void KillStats::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void KillStats::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == EXP || id == EXP_NEEDED) diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 8562e67a4..9773190de 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -33,7 +33,7 @@ class Label; class Button; -class KillStats : public Window, gcn::ActionListener, public Mana::Listener +class KillStats : public Window, gcn::ActionListener, public Listener { public: /** @@ -78,8 +78,8 @@ class KillStats : public Window, gcn::ActionListener, public Mana::Listener void addLog(std::string str); - void processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event); + void processEvent(Channels channel A_UNUSED, + const Event &event); private: void validateJacko(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index 00df97813..aaccd36c8 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -54,7 +54,7 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus", "ministatus.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); StatusWindow::updateHPBar(mHpBar); @@ -218,10 +218,10 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } } -void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void MiniStatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == HP || id == MAX_HP) @@ -235,7 +235,7 @@ void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, else if (id == MONEY) StatusWindow::updateMoneyBar(mMoneyBar); } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { StatusWindow::updateMPBar(mMpBar); StatusWindow::updateJobBar(mJobBar); diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index ca18e1b92..ba2cf7b2d 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -44,7 +44,7 @@ class TextPopup; */ class MiniStatusWindow : public Popup, public InventoryListener, - public Mana::Listener + public Listener { public: MiniStatusWindow(); @@ -60,7 +60,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 3fbec4f35..25403e544 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -126,7 +126,7 @@ StatusWindow::StatusWindow(): Window(player_node ? player_node->getName() : "?", false, nullptr, "status.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Status"); setupWindow->registerWindowForReset(this); @@ -277,14 +277,14 @@ StatusWindow::StatusWindow(): mLvlLabel->adjustSize(); } -void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void StatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { static bool blocked = false; if (blocked) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -343,7 +343,7 @@ void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, break; } } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { int id = event.getInt("id"); if (id == Net::getPlayerHandler()->getJobLocation()) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 8e110a354..7f6bd2d18 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -44,7 +44,7 @@ class VertContainer; */ class StatusWindow : public Window, public gcn::ActionListener, - public Mana::Listener + public Listener { public: /** @@ -52,7 +52,7 @@ class StatusWindow : public Window, */ StatusWindow(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void setPointsNeeded(int id, int needed); diff --git a/src/listener.cpp b/src/listener.cpp index ea125013f..fd04c9f00 100644 --- a/src/listener.cpp +++ b/src/listener.cpp @@ -25,9 +25,6 @@ #include "debug.h" -namespace Mana -{ - Listener::~Listener() { Event::remove(this); @@ -42,5 +39,3 @@ void Listener::ignore(Channels channel) { Event::unbind(this, channel); } - -} // namespace Mana diff --git a/src/listener.h b/src/listener.h index dc968672a..bb6e3d4b4 100644 --- a/src/listener.h +++ b/src/listener.h @@ -26,9 +26,6 @@ #include -namespace Mana -{ - class Listener { public: @@ -41,6 +38,4 @@ class Listener virtual void processEvent(Channels channel, const Event &event) = 0; }; -} // namespace Mana - #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index bb0c087d5..3225bac8d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -139,7 +139,7 @@ LocalPlayer::LocalPlayer(int id, int subtype): mAttackRange = 0; - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); mLevel = 1; mAdvanced = true; @@ -1664,12 +1664,12 @@ void LocalPlayer::optionChanged(const std::string &value) mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); } -void LocalPlayer::processEvent(Mana::Channels channel, - const Mana::Event &event) +void LocalPlayer::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_ATTRIBUTES) + if (channel == CHANNEL_ATTRIBUTES) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -1692,7 +1692,7 @@ void LocalPlayer::processEvent(Mana::Channels channel, break; }; } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { if (!mShowJobExp) return; diff --git a/src/localplayer.h b/src/localplayer.h index a7ce3dd7f..bf65096b5 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -69,7 +69,7 @@ enum * The local player character. */ class LocalPlayer : public Being, public ActorSpriteListener, - public Mana::Listener + public Listener { public: /** @@ -387,7 +387,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, */ void optionChanged(const std::string &value); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); /** * set a following player. diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index b7566e271..6d021d6a9 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -43,20 +43,20 @@ GameHandler::GameHandler() { mCharID = 0; - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_GAME); } -void GameHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GameHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_GAME) + if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_ENGINESINITALIZED) + if (event.getName() == EVENT_ENGINESINITALIZED) { if (mMap != "") Game::instance()->changeMap(mMap); } - else if (event.getName() == Mana::EVENT_MAPLOADED) + else if (event.getName() == EVENT_MAPLOADED) { mapLoadedEvent(); } diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 248175617..59cb148c4 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -32,13 +32,13 @@ namespace Ea { -class GameHandler : public Net::GameHandler, public Mana::Listener +class GameHandler : public Net::GameHandler, public Listener { public: GameHandler(); - virtual void processEvent(Mana::Channels channel, - const Mana::Event &event); + virtual void processEvent(Channels channel, + const Event &event); virtual void who(); diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index 584faa368..d95c98d23 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -93,8 +93,8 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - listen(Mana::CHANNEL_CLIENT); - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_CLIENT); + listen(CHANNEL_GAME); } void GeneralHandler::load() @@ -176,10 +176,10 @@ void GeneralHandler::clearHandlers() clearNetworkHandlers(); } -void GeneralHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_CLIENT) + if (channel == CHANNEL_CLIENT) { int newState = event.getInt("newState"); @@ -195,9 +195,9 @@ void GeneralHandler::processEvent(Mana::Channels channel, Attributes::informItemDB(); } } - else if (channel == Mana::CHANNEL_GAME) + else if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) + if (event.getName() == EVENT_GUIWINDOWSLOADED) { inventoryWindow->setSplitAllowed(true); skillDialog->loadSkills("mana-skills.xml"); diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index fcb28c846..6ea5c7845 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -33,7 +33,7 @@ namespace ManaServ { -class GeneralHandler : public Net::GeneralHandler, public Mana::Listener +class GeneralHandler : public Net::GeneralHandler, public Listener { public: GeneralHandler(); @@ -50,7 +50,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener void clearHandlers(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index a666fa5f4..77c91e1dd 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -244,12 +244,12 @@ void GeneralHandler::clearHandlers() mNetwork->clearHandlers(); } -void GeneralHandler::processEvent(Mana::Channels channel, - const Mana::Event &event) +void GeneralHandler::processEvent(Channels channel, + const Event &event) { - if (channel == Mana::CHANNEL_GAME) + if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED) + if (event.getName() == EVENT_GUIWINDOWSLOADED) { if (inventoryWindow) inventoryWindow->setSplitAllowed(false); @@ -288,7 +288,7 @@ void GeneralHandler::processEvent(Mana::Channels channel, statusWindow->addAttribute(ATTACK_SPEED, _("Damage per sec."), false, ""); } - else if (event.getName() == Mana::EVENT_GUIWINDOWSUNLOADING) + else if (event.getName() == EVENT_GUIWINDOWSUNLOADING) { if (socialWindow) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index b250ddfd4..73f7a0e1b 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -34,7 +34,7 @@ namespace TmwAthena { class GeneralHandler : public MessageHandler, public Net::GeneralHandler, - public Mana::Listener + public Listener { public: GeneralHandler(); @@ -53,7 +53,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void reloadPartially(); diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 0b9d16de2..6dd7bdc06 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -59,11 +59,11 @@ int mLevelProgress = 0; void triggerAttr(int id, int old) { - Mana::Event event(Mana::EVENT_UPDATEATTRIBUTE); + Event event(EVENT_UPDATEATTRIBUTE); event.setInt("id", id); event.setInt("oldValue", old); event.setInt("newValue", mData.mAttributes.find(id)->second); - Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); + Event::trigger(CHANNEL_ATTRIBUTES, event); } void triggerStat(int id, const std::string &changed, int old1, int old2) @@ -72,7 +72,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) if (it == mData.mStats.end()) return; - Mana::Event event(Mana::EVENT_UPDATESTAT); + Event event(EVENT_UPDATESTAT); event.setInt("id", id); event.setInt("base", it->second.base); event.setInt("mod", it->second.mod); @@ -81,7 +81,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) event.setString("changed", changed); event.setInt("oldValue1", old1); event.setInt("oldValue2", old2); - Mana::Event::trigger(Mana::CHANNEL_ATTRIBUTES, event); + Event::trigger(CHANNEL_ATTRIBUTES, event); } // --- Attributes ------------------------------------------------------------- @@ -280,9 +280,9 @@ void setTrading(bool trading) if (notify) { - Mana::Event event(Mana::EVENT_TRADING); + Event event(EVENT_TRADING); event.setInt("trading", trading); - Mana::Event::trigger(Mana::CHANNEL_STATUS, event); + Event::trigger(CHANNEL_STATUS, event); } } @@ -303,20 +303,20 @@ void updateAttrs() } } -class PlayerInfoListener : Mana::Listener +class PlayerInfoListener : Listener { public: PlayerInfoListener() { - listen(Mana::CHANNEL_CLIENT); - listen(Mana::CHANNEL_GAME); + listen(CHANNEL_CLIENT); + listen(CHANNEL_GAME); } - void processEvent(Mana::Channels channel, const Mana::Event &event) + void processEvent(Channels channel, const Event &event) { - if (channel == Mana::CHANNEL_CLIENT) + if (channel == CHANNEL_CLIENT) { - if (event.getName() == Mana::EVENT_STATECHANGE) + if (event.getName() == EVENT_STATECHANGE) { int newState = event.getInt("newState"); @@ -330,9 +330,9 @@ public: } } } - else if (channel == Mana::CHANNEL_GAME) + else if (channel == CHANNEL_GAME) { - if (event.getName() == Mana::EVENT_DESTRUCTED) + if (event.getName() == EVENT_DESTRUCTED) { delete mInventory; mInventory = nullptr; diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index aba020261..d6c01af6d 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -93,7 +93,8 @@ void EmoteDB::load() spriteNode->xmlChildrenNode->content); currentSprite->sprite = AnimatedSprite::load(file, XML::getProperty(spriteNode, "variant", 0)); - currentSprite->name = XML::langProperty(spriteNode, "name", ""); + currentSprite->name = XML::langProperty( + spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) @@ -147,7 +148,8 @@ void EmoteDB::load() spriteNode->xmlChildrenNode->content); currentSprite->sprite = AnimatedSprite::load(file, XML::getProperty(spriteNode, "variant", 0)); - currentSprite->name = XML::langProperty(spriteNode, "name", ""); + currentSprite->name = XML::langProperty( + spriteNode, "name", ""); currentInfo->sprites.push_back(currentSprite); } else if (xmlNameEqual(spriteNode, "particlefx")) diff --git a/src/variabledata.h b/src/variabledata.h index e5516bd9f..c306d43ed 100644 --- a/src/variabledata.h +++ b/src/variabledata.h @@ -24,9 +24,6 @@ #include -namespace Mana -{ - class VariableData { public: @@ -109,6 +106,4 @@ class BoolData : public VariableData bool mData; }; -} // namespace Mana - #endif -- cgit v1.2.3-70-g09d2 From c14086d6a08fb2ea644eec9fafa0374604c98991 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 11 Feb 2012 14:58:14 +0300 Subject: Add relative pixel based position to item drops (floor items). --- src/actorspritemanager.cpp | 5 +++-- src/actorspritemanager.h | 3 ++- src/flooritem.cpp | 21 ++++----------------- src/flooritem.h | 12 +++++------- src/net/ea/itemhandler.cpp | 37 ++++++++++++++++++++++++------------- src/net/ea/itemhandler.h | 4 +++- src/net/tmwa/itemhandler.cpp | 7 +++++-- 7 files changed, 46 insertions(+), 43 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index fa6d49d38..89a592005 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -240,10 +240,11 @@ Being *ActorSpriteManager::createBeing(int id, ActorSprite::Type type, } FloorItem *ActorSpriteManager::createItem(int id, int itemId, int x, int y, - int amount, unsigned char color) + int amount, unsigned char color, + int subX, int subY) { FloorItem *floorItem = new FloorItem(id, itemId, x, y, - mMap, amount, color); + mMap, amount, color, subX, subY); mActors.insert(floorItem); return floorItem; diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h index a78e3ad49..d30bad426 100644 --- a/src/actorspritemanager.h +++ b/src/actorspritemanager.h @@ -63,7 +63,8 @@ class ActorSpriteManager: public ConfigListener * Create a FloorItem and add it to the list of ActorSprites. */ FloorItem *createItem(int id, int itemId, int x, int y, - int amount, unsigned char color); + int amount, unsigned char color, + int subX, int subY); /** * Destroys the given ActorSprite at the end of diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 6e4926f2e..111019546 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -38,13 +38,8 @@ #include "debug.h" -FloorItem::FloorItem(int id, - int itemId, - int x, - int y, - Map *map, - int amount, - unsigned char color): +FloorItem::FloorItem(int id, int itemId, int x, int y, Map *map, int amount, + unsigned char color, int subX, int subY): ActorSprite(id), mItemId(itemId), mX(x), @@ -60,16 +55,8 @@ FloorItem::FloorItem(int id, setMap(map); if (map) { - // TODO: Eventually, we probably should fix all sprite offsets so that - // these translations aren't necessary anymore. The sprites know - // best where their base point should be. - mPos.x = static_cast(x * map->getTileWidth() + 16); -#ifdef MANASERV_SUPPORT - mPos.y = static_cast(y * map->getTileHeight() + - ((Net::getNetworkType() == ServerInfo::MANASERV) ? 15 : 32)); -#else - mPos.y = static_cast(y * map->getTileHeight() + 32); -#endif + mPos.x = static_cast(x * map->getTileWidth() + subX); + mPos.y = static_cast(y * map->getTileHeight() + subY); } else { diff --git a/src/flooritem.h b/src/flooritem.h index 95427c252..1f3126078 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -42,14 +42,12 @@ class FloorItem : public ActorSprite * @param y the y position in tiles * @param map the map this item is on * @param amount the item amount + * @param color the item color + * @param subX the x pixel relative position + * @param subY the y pixel relative position */ - FloorItem(int id, - int itemId, - int x, - int y, - Map *map, - int amount, - unsigned char color); + FloorItem(int id, int itemId, int x, int y, Map *map, int amount, + unsigned char color, int subX, int subY); Type getType() const { return FLOOR_ITEM; } diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp index e08fe2cd1..7a6ee2743 100644 --- a/src/net/ea/itemhandler.cpp +++ b/src/net/ea/itemhandler.cpp @@ -35,28 +35,39 @@ ItemHandler::ItemHandler() { } -void ItemHandler::processItemVisible(Net::MessageIn &msg, bool isDrop) +void ItemHandler::processItemVisible(Net::MessageIn &msg) { int id = msg.readInt32(); int itemId = msg.readInt16(); unsigned char identify = msg.readInt8(); // identify flag int x = msg.readInt16(); int y = msg.readInt16(); - int amount1 = msg.readInt16(); - int amount2 = msg.readInt16(); + int amount = msg.readInt16(); + int subX = msg.readInt8() + 16 - 8; + int subY = msg.readInt8() + 32 - 8; if (actorSpriteManager) { - if (!isDrop) - { - actorSpriteManager->createItem(id, itemId, - x, y, amount1, identify); - } - else - { - actorSpriteManager->createItem(id, itemId, - x, y, amount2, identify); - } + actorSpriteManager->createItem(id, itemId, + x, y, amount, identify, subX, subY); + } +} + +void ItemHandler::processItemDropped(Net::MessageIn &msg) +{ + int id = msg.readInt32(); + int itemId = msg.readInt16(); + unsigned char identify = msg.readInt8(); // identify flag + int x = msg.readInt16(); + int y = msg.readInt16(); + int subX = msg.readInt8() + 16 - 8; + int subY = msg.readInt8() + 32 - 8; + int amount = msg.readInt16(); + + if (actorSpriteManager) + { + actorSpriteManager->createItem(id, itemId, + x, y, amount, identify, subX, subY); } } diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h index 1d0747c61..d5c268d2e 100644 --- a/src/net/ea/itemhandler.h +++ b/src/net/ea/itemhandler.h @@ -34,9 +34,11 @@ class ItemHandler public: ItemHandler(); - void processItemVisible(Net::MessageIn &msg, bool isDrop); + void processItemVisible(Net::MessageIn &msg); void processItemRemove(Net::MessageIn &msg); + + void processItemDropped(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index ce03044c7..d84d2f38d 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -48,9 +48,12 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_ITEM_VISIBLE: + processItemVisible(msg); + break; + case SMSG_ITEM_DROPPED: - processItemVisible(msg, msg.getId() == SMSG_ITEM_DROPPED); - break; + processItemDropped(msg); + break; case SMSG_ITEM_REMOVE: processItemRemove(msg); -- cgit v1.2.3-70-g09d2 From bb156df11431e3eb286ddd3311adf1ac710945e0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 11 Feb 2012 19:39:06 +0300 Subject: Remove some unneeded includes. --- build/makecheck4 | 2 +- src/actorspritemanager.cpp | 2 -- src/being.cpp | 1 - src/being.h | 1 - src/client.cpp | 2 -- src/compoundsprite.cpp | 3 ++- src/flooritem.cpp | 2 +- src/graphics.cpp | 1 - src/gui/ministatuswindow.h | 1 - src/guichanfwd.h | 6 ------ src/itemshortcut.cpp | 1 - src/localplayer.cpp | 5 ----- src/net/charhandler.h | 2 -- src/net/ea/playerhandler.cpp | 1 + src/net/playerhandler.h | 1 - src/net/tmwa/playerhandler.cpp | 1 + src/utils/stringutils.cpp | 2 -- 17 files changed, 6 insertions(+), 28 deletions(-) (limited to 'src/net/tmwa') diff --git a/build/makecheck4 b/build/makecheck4 index 852986459..5c77d7f3a 100755 --- a/build/makecheck4 +++ b/build/makecheck4 @@ -1,5 +1,5 @@ #!/bin/bash -../../checkheaders/checkheaders ../src 2>tmp.txt +../../checkheaders/checkheaders --skip debug.h ../src 2>tmp.txt sed '/(style): Header not found/d' tmp.txt >makecheck4.txt rm tmp.txt diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 89a592005..803a30e7e 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -31,8 +31,6 @@ #include "gui/chatwindow.h" #include "gui/equipmentwindow.h" -#include "gui/killstats.h" -#include "gui/skilldialog.h" #include "gui/socialwindow.h" #include "gui/viewport.h" diff --git a/src/being.cpp b/src/being.cpp index 92d01097b..47a74c7b2 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -40,7 +40,6 @@ #include "sound.h" #include "sprite.h" #include "text.h" -#include "statuseffect.h" #include "gui/buydialog.h" #include "gui/buyselldialog.h" diff --git a/src/being.h b/src/being.h index a52963746..0b9257e83 100644 --- a/src/being.h +++ b/src/being.h @@ -27,7 +27,6 @@ #include "configlistener.h" #include "equipment.h" #include "map.h" -#include "particlecontainer.h" #include "position.h" #include "vector.h" diff --git a/src/client.cpp b/src/client.cpp index 023eb5353..a7825a835 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -69,7 +69,6 @@ #include "gui/worldselectdialog.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/desktop.h" #include "net/charhandler.h" @@ -80,7 +79,6 @@ #include "net/loginhandler.h" #include "net/net.h" #include "net/npchandler.h" -#include "net/packetcounters.h" #include "net/partyhandler.h" #include "net/worldinfo.h" diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 61fb3d4e0..62ef2d01c 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -24,11 +24,12 @@ #include "configuration.h" #include "game.h" #include "graphics.h" + #ifdef USE_OPENGL #include "openglgraphics.h" #include "opengl1graphics.h" #endif -#include "localplayer.h" + #include "map.h" #include "resources/image.h" diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 111019546..f126f336b 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -31,7 +31,7 @@ #include "gui/gui.h" #include "gui/sdlfont.h" -#include "net/net.h" +//#include "net/net.h" #include "resources/itemdb.h" #include "resources/iteminfo.h" diff --git a/src/graphics.cpp b/src/graphics.cpp index 635cc6ab9..e98b1a283 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -24,7 +24,6 @@ #include "graphicsvertexes.h" #include "logger.h" -#include "map.h" #include "resources/image.h" #include "resources/imageloader.h" diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index ba2cf7b2d..eb6ded7dd 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -27,7 +27,6 @@ #include "listener.h" #include "gui/widgets/popup.h" -#include "gui/widgets/window.h" #include diff --git a/src/guichanfwd.h b/src/guichanfwd.h index b3808d8ba..7ccc221b4 100644 --- a/src/guichanfwd.h +++ b/src/guichanfwd.h @@ -27,11 +27,6 @@ namespace gcn { class ActionEvent; class ActionListener; - class AllegroFont; - class AllegroGraphics; - class AllegroImage; - class AllegroImageLoader; - class AllegroInput; class BasicContainer; class Button; class CheckBox; @@ -70,7 +65,6 @@ namespace gcn class MouseEvent; class MouseInput; class MouseListener; - class OpenGLAllegroImageLoader; class OpenGLGraphics; class OpenGLImage; class OpenGLSDLImageLoader; diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index f267dd755..fedb92257 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -24,7 +24,6 @@ #include "inventory.h" #include "item.h" #include "itemshortcut.h" -#include "localplayer.h" #include "playerinfo.h" #include "spellmanager.h" diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 01e8c1ae8..99108bd3a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -41,21 +41,16 @@ #include "simpleanimation.h" #include "sound.h" #include "statuseffect.h" -#include "text.h" #include "dropshortcut.h" #include "gui/chatwindow.h" #include "gui/gui.h" -#include "gui/inventorywindow.h" -#include "gui/killstats.h" #include "gui/ministatuswindow.h" #include "gui/okdialog.h" #include "gui/outfitwindow.h" -#include "gui/palette.h" #include "gui/shopwindow.h" #include "gui/skilldialog.h" #include "gui/socialwindow.h" -#include "gui/statuswindow.h" #include "gui/theme.h" #include "gui/userpalette.h" #include "gui/viewport.h" diff --git a/src/net/charhandler.h b/src/net/charhandler.h index 492e27e55..cee319719 100644 --- a/src/net/charhandler.h +++ b/src/net/charhandler.h @@ -26,8 +26,6 @@ #include "localplayer.h" #include "playerinfo.h" -#include "net/logindata.h" - #include #include diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 76a7b0dbc..27aa4da80 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -22,6 +22,7 @@ #include "net/ea/playerhandler.h" +#include "localplayer.h" #include "logger.h" #include "party.h" #include "playerinfo.h" diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 6ae912102..aa5d2b793 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -25,7 +25,6 @@ #include "being.h" #include "flooritem.h" -#include "localplayer.h" namespace Net { diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 16e833ec9..bfe9eea42 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -23,6 +23,7 @@ #include "net/tmwa/playerhandler.h" #include "configuration.h" +#include "client.h" #include "logger.h" #include "net/messagein.h" diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 5e7bf19a0..798690602 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -22,8 +22,6 @@ #include "utils/stringutils.h" -#include "configuration.h" - #include #include #include -- cgit v1.2.3-70-g09d2