summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.h8
-rw-r--r--src/item.h2
-rw-r--r--src/localplayer.cpp11
-rw-r--r--src/particlecontainer.cpp9
-rw-r--r--src/resources/resourcemanager.cpp6
5 files changed, 22 insertions, 14 deletions
diff --git a/src/client.h b/src/client.h
index c120b248..3c52ea37 100644
--- a/src/client.h
+++ b/src/client.h
@@ -22,17 +22,17 @@
#ifndef CLIENT_H
#define CLIENT_H
-#include "net/serverinfo.h"
-
#include "configlistener.h"
-#include <guichan/actionlistener.hpp>
+#include "net/serverinfo.h"
-#include <string>
+#include <guichan/actionlistener.hpp>
#include <SDL.h>
#include <SDL_framerate.h>
+#include <string>
+
class Button;
class Desktop;
class LoginData;
diff --git a/src/item.h b/src/item.h
index 89b8e59e..17be8f04 100644
--- a/src/item.h
+++ b/src/item.h
@@ -41,7 +41,7 @@ class Item
/**
* Destructor.
*/
- ~Item();
+ virtual ~Item();
/**
* Sets the item id, identifying the item type.
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 0b0e22f5..b06ea456 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -135,6 +135,9 @@ LocalPlayer::~LocalPlayer()
mTargetCursorImages[0][i]->decRef();
mTargetCursorImages[1][i]->decRef();
}
+
+ delete mAwayDialog;
+ delete mAwayListener;
}
void LocalPlayer::logic()
@@ -1433,10 +1436,8 @@ void LocalPlayer::changeAwayMode()
config.getValue("afkMessage", "I am away from keyboard"));
mAwayDialog->addActionListener(mAwayListener);
}
- else
- {
- mAwayDialog = 0;
- }
+
+ mAwayDialog = 0;
}
void LocalPlayer::setAway(const std::string &message)
@@ -1478,4 +1479,4 @@ void AwayListener::action(const gcn::ActionEvent &event)
{
player_node->changeAwayMode();
}
-} \ No newline at end of file
+}
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 175c1e87..6900539d 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -71,14 +71,17 @@ void ParticleList::addLocally(Particle *particle)
void ParticleList::removeLocally(Particle *particle)
{
- for (std::list<Particle *>::iterator it = mElements.begin();
- it != mElements.end(); it++)
+ std::list<Particle *>::iterator it, it_end;
+ for (it = mElements.begin(), it_end = mElements.end();
+ it != it_end;)
{
if (*it == particle)
{
(*it)->kill();
- mElements.erase(it);
+ it = mElements.erase(it);
}
+ else
+ it++;
}
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 24f346f7..f785f20a 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -316,7 +316,11 @@ struct DyedImageLoader
}
int fileSize;
void *buffer = l->manager->loadFile(path, fileSize);
- if (!buffer) return NULL;
+ if (!buffer)
+ {
+ delete d;
+ return NULL;
+ }
Resource *res = d ? Image::load(buffer, fileSize, *d)
: Image::load(buffer, fileSize);
free(buffer);