diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-09 15:43:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-09 18:44:03 +0300 |
commit | e5726a11424ebd48f12d76149ec7e5e2b6278bdd (patch) | |
tree | bdcb9987f4109513a99f3a46e01687babc94a243 | |
parent | b4bdf86b6dd57045bd2d80cfcd5e0a428a5054b3 (diff) | |
download | manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.gz manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.bz2 manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.xz manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.zip |
Fix code style.
-rwxr-xr-x | build/bmake | 55 | ||||
-rw-r--r-- | src/avatar.cpp | 2 | ||||
-rw-r--r-- | src/being/actorsprite.cpp | 8 | ||||
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/being/playerinfo.h | 1 | ||||
-rw-r--r-- | src/beingequipbackend.cpp | 2 | ||||
-rw-r--r-- | src/flooritem.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.h | 3 | ||||
-rw-r--r-- | src/gui/windows/connectiondialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/connectiondialog.h | 2 | ||||
-rw-r--r-- | src/gui/windows/itemamountwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 3 | ||||
-rw-r--r-- | src/inventory.h | 4 | ||||
-rw-r--r-- | src/net/download.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/logindata.h | 6 | ||||
-rw-r--r-- | src/resources/atlasmanager.cpp | 3 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 3 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 11 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 1 | ||||
-rw-r--r-- | src/utils/xml.cpp | 14 | ||||
-rw-r--r-- | src/utils/xml.h | 2 |
25 files changed, 116 insertions, 30 deletions
diff --git a/build/bmake b/build/bmake new file mode 100755 index 000000000..90ac52eda --- /dev/null +++ b/build/bmake @@ -0,0 +1,55 @@ +#!/bin/sh + +cd .. + +dir=`pwd` + +export CC=gcc-4.9 +export CXX=g++-4.9 + +export LANG=C + +export CXXFLAGS="-ggdb3 -O2 -pipe -ffast-math \ +-funswitch-loops \ +-Wvariadic-macros -Wvla -Wredundant-decls \ +-Wpacked-bitfield-compat -Wtrampolines \ +-Wsuggest-attribute=noreturn -Wunused -Wstrict-aliasing=2 \ +-fstrict-aliasing -Wunreachable-code -Wabi -Wdisabled-optimization \ +-Wvolatile-register-var -Winvalid-pch -Wredundant-decls \ +-Wnormalized=nfkc -Wmissing-format-attribute -Wmissing-noreturn \ +-Wswitch-default -Wsign-promo -Waddress -Wmissing-declarations \ +-Wctor-dtor-privacy -Wstrict-null-sentinel -Wlogical-op \ +-Wcast-align -Wpointer-arith -Wundef \ +-Wmissing-include-dirs -Winit-self -pedantic -Wall \ +-Wpacked -Wextra -fstrict-overflow -Wstrict-overflow=1 -Wunknown-pragmas \ +-Wwrite-strings -Wstack-protector -Wshadow -Wunused-macros -Wsynth \ +-Wbuiltin-macro-redefined -Wctor-dtor-privacy -Wdeprecated \ +-Wendif-labels -Wformat=1 -Wimport -Wnon-virtual-dtor -Wpsabi \ +-Wsign-promo -Wwrite-strings -D_FORTIFY_SOURCE=2 -Wc++11-compat -std=c++0x \ +-Wdelete-non-virtual-dtor -Wmaybe-uninitialized -Wunused-local-typedefs \ +-Wvector-operation-performance -Wfree-nonheap-object -Winvalid-memory-model \ +-Wnarrowing -Wzero-as-null-pointer-constant -funsafe-loop-optimizations \ +-Wabi-tag -Waggressive-loop-optimizations -Wclobbered -Wempty-body \ +-Wignored-qualifiers -Wliteral-suffix -Wmissing-field-initializers \ +-Woverlength-strings -Wpedantic -Wsign-compare -Wsizeof-pointer-memaccess \ +-Wsuggest-attribute=format -Wtype-limits -Wuninitialized \ +-Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function \ +-Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable \ +-fsched-pressure \ +-Wconditionally-supported -Wdate-time" + +autoreconf -i +./configure --prefix=$dir/run \ +--datadir=$dir/run/share/games \ +--bindir=$dir/run/bin \ +--mandir=$dir/run/share/man \ +--enable-memdebug=no \ +--enable-tcmalloc=no \ +--enable-googleprofiler=no \ +--enable-eathena=yes + +cd po +make -j8 update-gmo 2>../build/make1.log +cd .. +make -j8 2>build/make2.log + diff --git a/src/avatar.cpp b/src/avatar.cpp index 3e685f008..077ded04d 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -22,8 +22,6 @@ #include "avatar.h" -#include "being/being.h" - #include "debug.h" Avatar::Avatar(const std::string &name): diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 936885ed2..ece1320f8 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -138,10 +138,6 @@ void ActorSprite::controlParticle(Particle *const particle) void ActorSprite::setTargetType(const TargetCursorType type) { - static const int targetWidths[ActorSprite::NUM_TC] = {0, 0, 0}; - static const int targetHeights[ActorSprite::NUM_TC] - = {-mapTileSize / 2, -mapTileSize / 2, -mapTileSize}; - if (type == TCT_NONE) { untarget(); @@ -152,6 +148,10 @@ void ActorSprite::setTargetType(const TargetCursorType type) mUsedTargetCursor = targetCursor[static_cast<int>(type)][sz]; if (mUsedTargetCursor) { + static const int targetWidths[ActorSprite::NUM_TC] = {0, 0, 0}; + static const int targetHeights[ActorSprite::NUM_TC] + = {-mapTileSize / 2, -mapTileSize / 2, -mapTileSize}; + mCursorPaddingX = static_cast<int>(targetWidths[sz]); mCursorPaddingY = static_cast<int>(targetHeights[sz]); } diff --git a/src/being/being.cpp b/src/being/being.cpp index 8b1c8a7ba..386c07e92 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2535,7 +2535,7 @@ void Being::recalcSpritesOrder() for (size_t slot = 0; slot < sz; slot ++) { - slotRemap.push_back(slot); + slotRemap.push_back(static_cast<int>(slot)); if (spriteIdSize <= slot) continue; diff --git a/src/being/being.h b/src/being/being.h index 208b2b56b..989036974 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -530,7 +530,7 @@ class Being : public ActorSprite, public ConfigListener SpriteDirection getSpriteDirection() const A_WARN_UNUSED { return static_cast<SpriteDirection>(mSpriteDirection); } - void setPosition(const Vector &pos); + void setPosition(const Vector &pos) override; /** * Overloaded method provided for convenience. diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 02dc4897c..861e7faf4 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -26,7 +26,6 @@ #include "state.h" #include <map> -#include <string> /** * Stat information storage structure. diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp index 72d7f093a..5284a4d84 100644 --- a/src/beingequipbackend.cpp +++ b/src/beingequipbackend.cpp @@ -39,7 +39,7 @@ BeingEquipBackend::BeingEquipBackend(Being *const being) for (size_t f = 0; f < sz; f ++) { const int idx = Net::getInventoryHandler()-> - convertFromServerSlot(f); + convertFromServerSlot(static_cast<int>(f)); const int id = being->mSpriteIDs[f]; if (id > 0 && idx >= 0 && idx < EQUIPMENT_SIZE) { diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 9ffa8f64a..2e04ce014 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -37,6 +37,7 @@ #include "debug.h" extern int serverVersion; +extern volatile int cur_time; FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, const int amount, const unsigned char color) : diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index ecb92f876..a84ac7c6d 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -245,6 +245,8 @@ void AvatarListBox::draw(Graphics *graphics) text.append(" \u2642 "); break; default: + case GENDER_UNSPECIFIED: + case GENDER_OTHER: break; } } @@ -264,6 +266,8 @@ void AvatarListBox::draw(Graphics *graphics) a->getAdditionString().c_str())); break; default: + case GENDER_UNSPECIFIED: + case GENDER_OTHER: break; } } diff --git a/src/gui/windows/charcreatedialog.h b/src/gui/windows/charcreatedialog.h index 652254776..e0a188303 100644 --- a/src/gui/windows/charcreatedialog.h +++ b/src/gui/windows/charcreatedialog.h @@ -23,13 +23,14 @@ #ifndef GUI_WINDOWS_CHARCREATEDIALOG_H #define GUI_WINDOWS_CHARCREATEDIALOG_H -#include "being/being.h" +#include "being/gender.h" #include "gui/widgets/window.h" #include "listeners/actionlistener.h" #include "listeners/keylistener.h" +class Being; class Button; class CharSelectDialog; class Label; diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp index 730c4782a..fece71b0a 100644 --- a/src/gui/windows/connectiondialog.cpp +++ b/src/gui/windows/connectiondialog.cpp @@ -29,6 +29,8 @@ #include "utils/gettext.h" +#include "client.h" + #include "debug.h" extern bool mStatsReUpdated; diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h index 5b10cdfc1..959b23e69 100644 --- a/src/gui/windows/connectiondialog.h +++ b/src/gui/windows/connectiondialog.h @@ -23,7 +23,7 @@ #ifndef GUI_WINDOWS_CONNECTIONDIALOG_H #define GUI_WINDOWS_CONNECTIONDIALOG_H -#include "client.h" +#include "state.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 92ceeae76..080e44850 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -51,6 +51,8 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include <cmath> + #include "debug.h" void ItemAmountWindow::finish(const Item *const item, diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 2b890a7af..547d3ba81 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -698,7 +698,8 @@ void ServerDialog::loadCustomServers() server.onlineListUrl = config.getValue(onlineListUrlKey, ""); server.hostname = config.getValue(hostKey, ""); server.type = ServerInfo::parseType(config.getValue(typeKey, "")); - server.persistentIp = config.getValue(persistentIpKey, 0) ? true : false; + server.persistentIp = config.getValue( + persistentIpKey, 0) ? true : false; const int defaultPort = defaultPortForServerType(server.type); server.port = static_cast<uint16_t>( diff --git a/src/inventory.h b/src/inventory.h index 4da805b50..ee684fb95 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -23,11 +23,13 @@ #ifndef INVENTORY_H #define INVENTORY_H -#include "being/being.h" +#include "being/gender.h" #include <list> #include <string> +#include "localconsts.h" + class Inventory; class Item; diff --git a/src/net/download.cpp b/src/net/download.cpp index 6d13be8bf..4a9cbf0ea 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -310,7 +310,8 @@ int Download::downloadThread(void *ptr) { logger->log_r("Downloading: %s", d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1); - curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, d->mHeaders); + curl_easy_setopt(d->mCurl, CURLOPT_HTTPHEADER, + d->mHeaders); if (d->mOptions.memoryWrite) { curl_easy_setopt(d->mCurl, CURLOPT_FAILONERROR, 1); @@ -322,7 +323,10 @@ int Download::downloadThread(void *ptr) { file = fopen(outFilename.c_str(), "w+b"); if (file) - curl_easy_setopt(d->mCurl, CURLOPT_WRITEDATA, file); + { + curl_easy_setopt(d->mCurl, CURLOPT_WRITEDATA, + file); + } } curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, strprintf(PACKAGE_EXTENDED_VERSION, @@ -418,7 +422,7 @@ int Download::downloadThread(void *ptr) d->mFileName.c_str(), adler, d->mAdler); attempts++; - continue; // Bail out here to avoid the renaming + continue; } } diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index eacb98711..2f5ec35ce 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -34,7 +34,6 @@ #include "utils/delete2.h" #include "listeners/arrowslistener.h" -#include "listeners/updatestatuslistener.h" #include "debug.h" diff --git a/src/net/logindata.h b/src/net/logindata.h index f1660a64d..a2179a0b9 100644 --- a/src/net/logindata.h +++ b/src/net/logindata.h @@ -23,10 +23,14 @@ #ifndef NET_LOGINDATA_H #define NET_LOGINDATA_H -#include "being/being.h" +#include "being/gender.h" + +#include "utils/stringvector.h" #include <string> +#include "localconsts.h" + class LoginData final { public: diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index 1dad94a09..81ae0f2f6 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -301,7 +301,8 @@ void AtlasManager::convertAtlas(TextureAtlas *const atlas) void AtlasManager::injectToResources(const AtlasResource *const resource) { ResourceManager *const resman = ResourceManager::getInstance(); - FOR_EACH (std::vector<TextureAtlas*>::const_iterator, it, resource->atlases) + FOR_EACH (std::vector<TextureAtlas*>::const_iterator, + it, resource->atlases) { // add each atlas image to resources TextureAtlas *const atlas = *it; diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 7d61fedbf..81a153e04 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -22,6 +22,8 @@ #include "resources/db/itemdb.h" +#include "map.h" + #include "configuration.h" #include "logger.h" diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index b7fc0f4ac..391e546da 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -22,6 +22,9 @@ #include "resources/iteminfo.h" +#include "map.h" + +#include "resources/db/colordb.h" #include "resources/db/itemdb.h" #include "configuration.h" diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 93a2d447f..9b8c1656a 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -23,12 +23,19 @@ #ifndef RESOURCES_ITEMINFO_H #define RESOURCES_ITEMINFO_H -#include "being/being.h" +#include "being/gender.h" -#include "resources/db/colordb.h" +#include "resources/cursor.h" +#include "resources/soundinfo.h" +#include "resources/spritedef.h" #include <map> +namespace ColorDB +{ + class ItemColor; +} + enum EquipmentSlot { // Equipment rules: diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 075891764..44fc5f447 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -986,7 +986,6 @@ Tileset *MapReader::readTileset(XmlNodePtr node, break; } } - } else if (isAnim && !haveAnimation) { diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index eae3567ef..099457af3 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -79,7 +79,8 @@ static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg, ...) namespace XML { Document::Document(const std::string &filename, const bool useResman) : - mDoc(nullptr) + mDoc(nullptr), + mIsValid(false) { #ifdef USE_FUZZER if (Fuzzer::conditionTerminate(filename.c_str())) @@ -134,7 +135,8 @@ namespace XML } Document::Document(const char *const data, const int size) : - mDoc(data ? xmlParseMemory(data, size) : nullptr) + mDoc(data ? xmlParseMemory(data, size) : nullptr), + mIsValid(true) { } @@ -241,7 +243,7 @@ namespace XML return def; } - XmlNodePtr findFirstChildByName(const XmlNodePtr parent, + XmlNodePtr findFirstChildByName(const XmlNodePtrConst parent, const char *const name) { for_each_xml_child_node(child, parent) @@ -272,11 +274,11 @@ namespace XML bool Document::validateXml(const std::string &fileName) { - xmlDocPtr doc = xmlReadFile(fileName.c_str(), + const xmlDocPtr doc = xmlReadFile(fileName.c_str(), nullptr, XML_PARSE_PEDANTIC); - const bool valid(doc); + const bool valid1(doc); xmlFreeDoc(doc); - if (!valid) + if (!valid1) return false; std::ifstream file; diff --git a/src/utils/xml.h b/src/utils/xml.h index 9ed433ad5..85fa82270 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -150,7 +150,7 @@ namespace XML /** * Finds the first child node with the given name */ - XmlNodePtr findFirstChildByName(const XmlNodePtr parent, + XmlNodePtr findFirstChildByName(const XmlNodePtrConst parent, const char *const name) A_WARN_UNUSED; void initXML(); |