summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-09 15:43:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-09 18:44:03 +0300
commite5726a11424ebd48f12d76149ec7e5e2b6278bdd (patch)
treebdcb9987f4109513a99f3a46e01687babc94a243 /src
parentb4bdf86b6dd57045bd2d80cfcd5e0a428a5054b3 (diff)
downloadmanaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.gz
manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.bz2
manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.tar.xz
manaplus-e5726a11424ebd48f12d76149ec7e5e2b6278bdd.zip
Fix code style.
Diffstat (limited to 'src')
-rw-r--r--src/avatar.cpp2
-rw-r--r--src/being/actorsprite.cpp8
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/being/being.h2
-rw-r--r--src/being/playerinfo.h1
-rw-r--r--src/beingequipbackend.cpp2
-rw-r--r--src/flooritem.cpp1
-rw-r--r--src/gui/widgets/avatarlistbox.cpp4
-rw-r--r--src/gui/windows/charcreatedialog.h3
-rw-r--r--src/gui/windows/connectiondialog.cpp2
-rw-r--r--src/gui/windows/connectiondialog.h2
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/serverdialog.cpp3
-rw-r--r--src/inventory.h4
-rw-r--r--src/net/download.cpp10
-rw-r--r--src/net/ea/inventoryhandler.cpp1
-rw-r--r--src/net/logindata.h6
-rw-r--r--src/resources/atlasmanager.cpp3
-rw-r--r--src/resources/db/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/iteminfo.h11
-rw-r--r--src/resources/mapreader.cpp1
-rw-r--r--src/utils/xml.cpp14
-rw-r--r--src/utils/xml.h2
24 files changed, 61 insertions, 30 deletions
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();