summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-21 01:26:07 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-21 01:26:07 +0300
commit98dabed4de60bc86522632379f2499aecbae2b70 (patch)
tree48924b90447eb513f330c1e82d9afbab3719525e /src
parentec6db5f3d8b7f0b725fec0b4d8d71b330aa034c6 (diff)
downloadmanaverse-98dabed4de60bc86522632379f2499aecbae2b70.tar.gz
manaverse-98dabed4de60bc86522632379f2499aecbae2b70.tar.bz2
manaverse-98dabed4de60bc86522632379f2499aecbae2b70.tar.xz
manaverse-98dabed4de60bc86522632379f2499aecbae2b70.zip
Fix compilation errors and warnings for another gcc 4.7 snapshot.
Diffstat (limited to 'src')
-rw-r--r--src/actorspritemanager.h6
-rw-r--r--src/client.cpp4
-rw-r--r--src/configuration.h4
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/equipmentwindow.h2
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/ministatuswindow.cpp2
-rw-r--r--src/gui/socialwindow.cpp4
-rw-r--r--src/gui/textdialog.h2
-rw-r--r--src/gui/widgets/dropdown.h2
-rw-r--r--src/gui/widgets/playerbox.h4
-rw-r--r--src/gui/widgets/progressindicator.cpp4
-rw-r--r--src/localconsts.h3
-rw-r--r--src/localplayer.cpp6
-rw-r--r--src/main.cpp44
-rw-r--r--src/net/charhandler.h10
-rw-r--r--src/net/tmwa/buysellhandler.cpp2
-rw-r--r--src/net/tmwa/generalhandler.cpp4
-rw-r--r--src/particleemitter.cpp4
-rw-r--r--src/resources/resourcemanager.cpp2
-rw-r--r--src/rotationalparticle.cpp2
-rw-r--r--src/test/testlauncher.cpp6
-rw-r--r--src/text.h5
-rw-r--r--src/utils/process.cpp1
25 files changed, 69 insertions, 60 deletions
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index 90c667a73..7960c6301 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -123,7 +123,7 @@ class ActorSpriteManager: public ConfigListener
*/
Being *findNearestLivingBeing(int x, int y, int maxTileDist,
ActorSprite::Type type = Being::UNKNOWN,
- Being *excluded = 0) const;
+ Being *excluded = nullptr) const;
/**
* Returns a being nearest to another being.
@@ -292,12 +292,12 @@ class ActorSpriteManager: public ConfigListener
protected:
bool validateBeing(Being *aroundBeing, Being* being,
- Being::Type type, Being* excluded = 0,
+ Being::Type type, Being* excluded = nullptr,
int maxCost = 20) const;
Being *findNearestLivingBeing(Being *aroundBeing, int maxdist,
Being::Type type, int x, int y,
- Being *excluded = 0) const;
+ Being *excluded = nullptr) const;
void loadAttackList();
void storeAttackList();
diff --git a/src/client.cpp b/src/client.cpp
index cb4dbdb80..1c4629178 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -262,8 +262,8 @@ Client::Client(const Options &options):
mState(STATE_CHOOSE_SERVER),
mOldState(STATE_START),
mIcon(nullptr),
- mLogicCounterId(0),
- mSecondsCounterId(0),
+ mLogicCounterId(nullptr),
+ mSecondsCounterId(nullptr),
mLimitFps(false),
mConfigAutoSaved(false),
mIsMinimized(false),
diff --git a/src/configuration.h b/src/configuration.h
index 2a84588f6..00479933e 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -27,7 +27,7 @@
#include "utils/xml.h"
#include "defaults.h"
-
+#include "localconsts.h"
#include <cassert>
#include <list>
@@ -159,7 +159,7 @@ class ConfigurationObject
}
delete nextobj;
- nextobj = 0;
+ nextobj = nullptr;
}
/**
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 0dadca2dc..275bf19bb 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -65,7 +65,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
mEquipment(equipment),
mSelected(-1),
mForing(foring),
- mImageSet(0)
+ mImageSet(nullptr)
{
mBeing = being;
mItemPopup = new ItemPopup;
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index c8cf095f8..daeaeb3d7 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -85,7 +85,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener
void mousePressed(gcn::MouseEvent& mouseEvent);
Item* getEquipment(int i)
- { return mEquipment ? mEquipment->getEquipment(i) : 0; }
+ { return mEquipment ? mEquipment->getEquipment(i) : nullptr; }
void setBeing(Being *being);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f1ea1ff6e..01e2bdd17 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -98,7 +98,7 @@ InventoryWindow::WindowList InventoryWindow::instances;
InventoryWindow::InventoryWindow(Inventory *inventory):
Window("Inventory", false, nullptr, "inventory.xml"),
mInventory(inventory),
- mDropButton(0),
+ mDropButton(nullptr),
mSplit(false),
mCompactMode(false)
{
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 5f2c9cb0a..2b35ec9c4 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -128,7 +128,7 @@ class InventoryWindow : public Window,
void processEvent(Mana::Channels channel, const Mana::Event &event);
- void updateButtons(Item *item = 0);
+ void updateButtons(Item *item = nullptr);
bool isInputFocused() const;
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 3ab946fa8..00df97813 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -188,7 +188,7 @@ void MiniStatusWindow::updateBars()
void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
{
if (index >= static_cast<int>(mIcons.size()))
- mIcons.resize(index + 1, 0);
+ mIcons.resize(index + 1, nullptr);
delete mIcons[index];
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 4649c23a7..3988c819c 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -1115,11 +1115,11 @@ public:
getPlayersAvatars();
}
- void updateAvatar(std::string name)
+ void updateAvatar(std::string name A_UNUSED)
{
}
- void resetDamage(std::string name)
+ void resetDamage(std::string name A_UNUSED)
{
}
diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h
index f5395a17d..03deae8f6 100644
--- a/src/gui/textdialog.h
+++ b/src/gui/textdialog.h
@@ -44,7 +44,7 @@ public:
* @see Window::Window
*/
TextDialog(const std::string &title, const std::string &msg,
- Window *parent = 0, bool isPassword = false);
+ Window *parent = nullptr, bool isPassword = false);
~TextDialog();
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index e9b61aa43..a769678ca 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -48,7 +48,7 @@ class DropDown : public gcn::DropDown
* @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox.
*/
- DropDown(gcn::ListModel *listModel = 0,
+ DropDown(gcn::ListModel *listModel = nullptr,
gcn::ActionListener* listener = nullptr,
std::string eventId = "");
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index a066c104e..d2393ca08 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -25,6 +25,8 @@
#include <guichan/widgets/scrollarea.hpp>
+#include "localconsts.h"
+
class Being;
class ImageRect;
@@ -40,7 +42,7 @@ class PlayerBox : public gcn::ScrollArea
* Constructor. Takes the initial player character that this box should
* display, which defaults to <code>NULL</code>.
*/
- PlayerBox(const Being *being = 0);
+ PlayerBox(const Being *being = nullptr);
/**
* Destructor.
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index ae94f0a0f..6adb5a2fa 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -51,7 +51,7 @@ ProgressIndicator::ProgressIndicator()
}
else
{
- mIndicator = 0;
+ mIndicator = nullptr;
}
setSize(32, 32);
@@ -60,7 +60,7 @@ ProgressIndicator::ProgressIndicator()
ProgressIndicator::~ProgressIndicator()
{
delete mIndicator;
- mIndicator = 0;
+ mIndicator = nullptr;
}
void ProgressIndicator::logic()
diff --git a/src/localconsts.h b/src/localconsts.h
index 4a8bb062a..2d0eb5dea 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -21,6 +21,9 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#undef nullptr
#define nullptr 0
+#else
+#undef Z_NULL
+#define Z_NULL nullptr
#endif
#ifdef __GNUC__
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 89eb3b40a..0da291711 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -98,7 +98,7 @@ extern MiniStatusWindow *miniStatusWindow;
extern SkillDialog *skillDialog;
LocalPlayer::LocalPlayer(int id, int subtype):
- Being(id, PLAYER, subtype, 0),
+ Being(id, PLAYER, subtype, nullptr),
mTargetTime(-1),
mLastTarget(-1),
mTarget(nullptr),
@@ -112,7 +112,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mPathSetByMouse(false),
mLocalWalkTime(-1),
mMessageTime(0),
- mAwayDialog(0),
+ mAwayDialog(nullptr),
mAfkTime(0),
mAwayMode(false),
mPseudoAwayMode(false),
@@ -151,7 +151,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
if (userPalette)
mNameColor = &userPalette->getColor(UserPalette::SELF);
else
- mNameColor = 0;
+ mNameColor = nullptr;
mLastTargetX = 0;
mLastTargetY = 0;
diff --git a/src/main.cpp b/src/main.cpp
index 9bffcfa2a..5025d6d29 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -93,28 +93,28 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
const struct option long_options[] =
{
- { "config-dir", required_argument, 0, 'C' },
- { "data", required_argument, 0, 'd' },
- { "default", no_argument, 0, 'D' },
- { "password", required_argument, 0, 'P' },
- { "character", required_argument, 0, 'c' },
- { "help", no_argument, 0, 'h' },
- { "localdata-dir", required_argument, 0, 'L' },
- { "update-host", required_argument, 0, 'H' },
- { "port", required_argument, 0, 'p' },
- { "server", required_argument, 0, 's' },
- { "skip-update", no_argument, 0, 'u' },
- { "username", required_argument, 0, 'U' },
- { "no-opengl", no_argument, 0, 'O' },
- { "chat-log-dir", required_argument, 0, 'l' },
- { "version", no_argument, 0, 'v' },
- { "log-file", required_argument, 0, 'l' },
- { "chat-log-dir", required_argument, 0, 'L' },
- { "screenshot-dir", required_argument, 0, 'i' },
- { "safemode", no_argument, 0, 'm' },
- { "tests", no_argument, 0, 'T' },
- { "test", required_argument, 0, 't' },
- { nullptr, 0, 0, 0 }
+ { "config-dir", required_argument, nullptr, 'C' },
+ { "data", required_argument, nullptr, 'd' },
+ { "default", no_argument, nullptr, 'D' },
+ { "password", required_argument, nullptr, 'P' },
+ { "character", required_argument, nullptr, 'c' },
+ { "help", no_argument, nullptr, 'h' },
+ { "localdata-dir", required_argument, nullptr, 'L' },
+ { "update-host", required_argument, nullptr, 'H' },
+ { "port", required_argument, nullptr, 'p' },
+ { "server", required_argument, nullptr, 's' },
+ { "skip-update", no_argument, nullptr, 'u' },
+ { "username", required_argument, nullptr, 'U' },
+ { "no-opengl", no_argument, nullptr, 'O' },
+ { "chat-log-dir", required_argument, nullptr, 'l' },
+ { "version", no_argument, nullptr, 'v' },
+ { "log-file", required_argument, nullptr, 'l' },
+ { "chat-log-dir", required_argument, nullptr, 'L' },
+ { "screenshot-dir", required_argument, nullptr, 'i' },
+ { "safemode", no_argument, nullptr, 'm' },
+ { "tests", no_argument, nullptr, 'T' },
+ { "test", required_argument, nullptr, 't' },
+ { nullptr, 0, nullptr, 0 }
};
while (optind < argc)
diff --git a/src/net/charhandler.h b/src/net/charhandler.h
index f8b3f4f98..492e27e55 100644
--- a/src/net/charhandler.h
+++ b/src/net/charhandler.h
@@ -44,14 +44,14 @@ struct Character
{
Character() :
slot(0),
- dummy(0)
+ dummy(nullptr)
{
}
~Character()
{
delete dummy;
- dummy = 0;
+ dummy = nullptr;
}
int slot; /**< The index in the list of characters */
@@ -94,9 +94,9 @@ class CharHandler
protected:
CharHandler() :
- mSelectedCharacter(0),
- mCharSelectDialog(0),
- mCharCreateDialog(0)
+ mSelectedCharacter(nullptr),
+ mCharSelectDialog(nullptr),
+ mCharCreateDialog(nullptr)
{}
void updateCharSelectDialog();
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index b6473400a..629aa54f6 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -69,7 +69,7 @@ BuySellHandler::BuySellHandler()
};
handledMessages = _messages;
buySellHandler = this;
- mBuyDialog = 0;
+ mBuyDialog = nullptr;
}
void BuySellHandler::handleMessage(Net::MessageIn &msg)
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 09c216ed3..a666fa5f4 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -201,9 +201,9 @@ void GeneralHandler::reload()
static_cast<LoginHandler*>(mLoginHandler.get())->clearWorlds();
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharCreateDialog(0);
+ mCharHandler.get())->setCharCreateDialog(nullptr);
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharSelectDialog(0);
+ mCharHandler.get())->setCharSelectDialog(nullptr);
static_cast<PartyHandler*>(mPartyHandler.get())->reload();
}
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 62f6767c6..c6c819e92 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -43,7 +43,7 @@ ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target,
Map *map, int rotation,
const std::string& dyePalettes):
mOutputPauseLeft(0),
- mParticleImage(0)
+ mParticleImage(nullptr)
{
mMap = map;
mParticleTarget = target;
@@ -460,7 +460,7 @@ ParticleEmitter::~ParticleEmitter()
if (mParticleImage)
{
mParticleImage->decRef();
- mParticleImage = 0;
+ mParticleImage = nullptr;
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 06818705c..3376394bc 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -456,7 +456,7 @@ struct DyedImageLoader
if (!buffer)
{
delete d;
- return 0;
+ return nullptr;
}
Resource *res = d ? Image::load(buffer, fileSize, *d)
: Image::load(buffer, fileSize);
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index e1a7fd035..89b978f4d 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -36,7 +36,7 @@ RotationalParticle::RotationalParticle(Map *map, Animation *animation):
RotationalParticle::RotationalParticle(Map *map, XmlNodePtr animationNode,
const std::string& dyePalettes):
- ImageParticle(map, 0),
+ ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
{
}
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 2f6860d43..d3caa8938 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -36,6 +36,8 @@
#include "resources/image.h"
#include "resources/wallpaper.h"
+#include <unistd.h>
+
#ifdef WIN32
#include <windows.h>
#define sleep(seconds) Sleep((seconds) * 1000)
@@ -128,7 +130,7 @@ int TestLauncher::testFps()
int cnt = 500;
- gettimeofday(&start, NULL);
+ gettimeofday(&start, nullptr);
for (int k = 0; k < cnt; k ++)
{
for (int x = 0; x < 800; x += 20)
@@ -144,7 +146,7 @@ int TestLauncher::testFps()
mainGraphics->updateScreen();
}
- gettimeofday(&end, NULL);
+ gettimeofday(&end, nullptr);
int tFps = calcFps(&start, &end, cnt);
file << mTest << std::endl;
file << tFps << std::endl;
diff --git a/src/text.h b/src/text.h
index e28e70ac7..25fbe66f0 100644
--- a/src/text.h
+++ b/src/text.h
@@ -26,6 +26,7 @@
#include "graphics.h"
#include "guichanfwd.h"
+#include "localconsts.h"
#include <guichan/color.hpp>
@@ -42,7 +43,7 @@ class Text
Text(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
const gcn::Color *color, bool isSpeech = false,
- gcn::Font *font = 0);
+ gcn::Font *font = nullptr);
/**
* Destructor. The text is removed from the screen.
@@ -90,7 +91,7 @@ class FlashText : public Text
FlashText(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
const gcn::Color* color,
- gcn::Font *font = 0);
+ gcn::Font *font = nullptr);
/**
* Remove the text from the screen
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
index 45fdd51c6..4a2081514 100644
--- a/src/utils/process.cpp
+++ b/src/utils/process.cpp
@@ -25,6 +25,7 @@
#include <cstdio>
#include <stdlib.h>
+#include <unistd.h>
#include "localconsts.h"