summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-02-20 18:06:03 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-02-20 18:06:03 +0000
commitd8214f7e46ec507dac603ea2a108410f5f64a4bd (patch)
tree1a04035a97c81ef0aa9e2c43d205653af17b004c
parent9200c6879214c7ebca52c271e29ad0ee7f69d0b6 (diff)
downloadmana-d8214f7e46ec507dac603ea2a108410f5f64a4bd.tar.gz
mana-d8214f7e46ec507dac603ea2a108410f5f64a4bd.tar.bz2
mana-d8214f7e46ec507dac603ea2a108410f5f64a4bd.tar.xz
mana-d8214f7e46ec507dac603ea2a108410f5f64a4bd.zip
Merged revisions 3790,3799,3801-3807,3809-3810,3812-3813,3815-3816,3818-3821 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r3790 | b_lindeijer | 2007-12-18 14:54:17 +0100 (Tue, 18 Dec 2007) | 3 lines Remember to delete the progressbar and label also when the game was not started. ........ r3801 | b_lindeijer | 2007-12-21 12:56:23 +0100 (Fri, 21 Dec 2007) | 2 lines Fixed shop list box not to scroll up when the selection is removed. ........ r3802 | b_lindeijer | 2007-12-21 13:37:17 +0100 (Fri, 21 Dec 2007) | 2 lines Added logging of error on PHYSFS_addToSearchPath. ........ r3803 | b_lindeijer | 2007-12-21 15:56:38 +0100 (Fri, 21 Dec 2007) | 3 lines Fixed inventory size not matching the size assumed by eAthena and related memory corruption and increased default chat log length. ........ r3804 | the_enemy | 2007-12-21 16:07:20 +0100 (Fri, 21 Dec 2007) | 1 line Attempted to fix client freeze when unable to connect to update host, and added exit dialog ........ r3805 | b_lindeijer | 2007-12-22 16:24:14 +0100 (Sat, 22 Dec 2007) | 2 lines Updated version to 0.0.24. Release data set to tomorrow, we'll see. ........ r3806 | b_lindeijer | 2007-12-22 21:42:35 +0100 (Sat, 22 Dec 2007) | 2 lines Make sure chat messages are also trimmed for the local player. ........ r3809 | crush_tmw | 2007-12-23 03:16:53 +0100 (Sun, 23 Dec 2007) | 1 line Particle images are now reference-counted properly. Avoided attempts to load "data/graphics/" when a monster or equipment piece has no sprite. Error placeholder is now used when attempting to load a sprite definition file that doesn't exist. ........ r3810 | b_lindeijer | 2007-12-24 02:20:42 +0100 (Mon, 24 Dec 2007) | 2 lines Updated release date. ........ r3812 | the_enemy | 2007-12-24 15:16:15 +0100 (Mon, 24 Dec 2007) | 1 line Minor update, fixed disconnection dialog ........ r3813 | b_lindeijer | 2007-12-24 15:45:34 +0100 (Mon, 24 Dec 2007) | 2 lines Fixed compile warning. ........ r3816 | b_lindeijer | 2007-12-25 13:31:21 +0100 (Tue, 25 Dec 2007) | 2 lines Fixed year. :) ........ r3818 | b_lindeijer | 2007-12-25 23:11:55 +0100 (Tue, 25 Dec 2007) | 2 lines Updated CMake file. ........ r3821 | b_lindeijer | 2007-12-26 19:06:15 +0100 (Wed, 26 Dec 2007) | 2 lines Fixed year in README too. ........
-rw-r--r--ChangeLog46
-rw-r--r--INSTALL12
-rw-r--r--NEWS12
-rw-r--r--data/help/changes.txt34
-rw-r--r--data/help/header.txt2
-rw-r--r--src/game.cpp31
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/shoplistbox.cpp4
-rw-r--r--src/gui/updatewindow.cpp15
-rw-r--r--src/inventory.cpp6
-rw-r--r--src/localplayer.cpp1
-rw-r--r--src/localplayer.h4
-rw-r--r--src/main.cpp3
-rw-r--r--src/monster.cpp8
-rw-r--r--src/net/chathandler.cpp1
-rw-r--r--src/openglgraphics.cpp2
-rw-r--r--src/particleemitter.cpp35
-rw-r--r--src/particleemitter.h10
-rw-r--r--src/player.cpp15
-rw-r--r--src/resources/resourcemanager.cpp8
-rw-r--r--src/resources/resourcemanager.h4
-rw-r--r--src/resources/spritedef.cpp3
22 files changed, 210 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index 874bb04a..01824d45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -141,6 +141,50 @@
Len.
* data/maps/new_3-1.tmx: Some mapping errors fixed by Zipon.
+2007-12-25 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * data/help/header.txt: Fixed year. :)
+
+2007-12-24 David Athay <ko2fan@gmail.com>
+
+ * src/game.cpp: Fixed dialog for disconnections, so it says Ok, not
+ yes/no.
+ * src/openglgraphics.cpp: Changed type so it would compile on Leopard.
+
+2007-12-24 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/particleemitter.cpp: Fix compile warning.
+
+2007-12-23 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/particleemitter.cpp, src/particleemitter.h: Particle images are
+ now reference-counted properly.
+ * src/resources/spritedef.cpp: Error placeholder is now used when
+ attempting to load a sprite definition file that doesn't exist.
+ * src/monster.cpp, src/player.cpp: Avoided attempts to load
+ "data/graphics/" when a monster or equipment piece has no sprite.
+ * data/graphics/particles/cookingfire.particle.xml: Removed some
+ particle properties that did nothing because they were misspelled.
+
+2007-12-22 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/net/chathandler.cpp, NEWS: Make sure chat messages are also
+ trimmed for the local player.
+
+2007-12-21 David Athay <ko2fan@gmail.com>
+
+ * src/game.cpp, src/gui/updatewindow.cpp: Attempted to fix client
+ freeze when unable to connect to update host, and added exit dialog
+ when client loses connection.
+
+2007-12-21 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/shoplistbox.cpp: Fixed shop list box not to scroll up when
+ the selection is removed.
+ * src/resources/resourcemanager.h, src/resources/resourcemanager.cpp:
+ Added logging of error on PHYSFS_addToSearchPath.
+ * src/main.cpp: Increased default chat log length.
+
2007-12-19 Philipp Sehmisch <tmw@crushnet.org>
* data/maps/new_18-1.tmx: Fixed a map bug (monster trap) on
@@ -157,8 +201,6 @@
2007-12-18 Bjørn Lindeijer <bjorn@lindeijer.nl>
- * src/main.cpp: Remember to delete the progressbar and label also when
- the game was not started.
* tools/upalyzer/analyse.php: Added initial version of the update
analysis tool upalyzer.
* tools/upalyzer/analyse.php: Optimized with single loop approach and
diff --git a/INSTALL b/INSTALL
index a6f43ed1..ac5a9fb8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -20,13 +20,14 @@ and some libraries. The required libraries are:
* SDL_mixer http://www.libsdl.org/projects/SDL_mixer/
* SDL_image http://www.libsdl.org/projects/SDL_image/
* ENet 1.2 http://enet.bespin.org/
-* Guichan 0.7.0 http://guichan.sourceforge.net/
+* Guichan 0.7.x http://guichan.sourceforge.net/
* libxml2 http://www.xmlsoft.org/
* physfs 1.0.x http://icculus.org/physfs/
* zlib 1.2.x http://www.gzip.org/zlib/
* libcurl http://curl.haxx.se/libcurl/
-If you checked TMW out from CVS you will also need these tools to compile:
+If you checked TMW out from Subversion you will also need these tools to
+compile:
* GNU automake 1.9 http://www.gnu.org/software/automake/
* GNU autoconf http://www.gnu.org/software/autoconf/
@@ -50,11 +51,10 @@ It should have installed The Mana World on your system now, and you can run it
with "tmw". By default all files are installed to /usr/local, you can pass a
different prefix to configure as usual.
- NOTE: For those people with modern video cards and fast OpenGL performance,
- we have been working on OpenGL support. To enable this perform step 3 as
- follows:
+ NOTE: It is possible to compile TMW without support for OpenGL rendering.
+ To do this perform step 3 as follows:
- "./configure --with-opengl"
+ ./configure --without-opengl
Rebuild the executable from scratch using "make clean" and then "make".
diff --git a/NEWS b/NEWS
index a1ad3814..ebdae676 100644
--- a/NEWS
+++ b/NEWS
@@ -1,20 +1,26 @@
-0.0.24 (... 2007)
+0.0.24 (24 December 2007)
+- Added female specific hair styles
- Added user-definable key settings
-- Added shortcut bar for quick access to inventory items
- Added XP gaining notification
- Added close button to most windows
+- Added support for dynamic sprite recoloring
+- Added notification when the connection to the server is lost
- Updated to work with Guichan 0.7.x
- Mouse cursor now indicates when resize is possible
- Changed amount slider in buy and sell dialogs to start at 1
- Made weapon sprites and sounds customizable
- Made buy and sell dialogs resizable
- Merged equipment database with items database
+- Chat window log no longer goes back forever
+- Chat messages are trimmed (spaces are removed on both sides)
- Fixed segmentation fault with some OpenGL drivers
-- Fixed updating of defence when increasing vitality
+- Fixed updating of defense when increasing vitality
- Fixed a bug that prevented being-controlled particles from being deleted
- Fixed a crash in the particle engine related to child emitters
- Fixed encoding issues with user home directory
- Fixed a crash in equipment window on failure to load an item icon
+- Fixed a crash on filling up your inventory
+- Fixed item list in shops not to scroll back when selling
0.0.23 (3 June 2007)
- Added a particle engine along with some particle effects
diff --git a/data/help/changes.txt b/data/help/changes.txt
index dd062e49..26bd21d1 100644
--- a/data/help/changes.txt
+++ b/data/help/changes.txt
@@ -3,6 +3,30 @@
##3 === RECENT CHANGES ===
+ 0.0.24 (24 December 2007)
+ - Added female specific hair styles
+ - Added user-definable key settings
+ - Added XP gaining notification
+ - Added close button to most windows
+ - Added support for dynamic sprite recoloring
+ - Added notification when the connection to the server is lost
+ - Updated to work with Guichan 0.7.x
+ - Mouse cursor now indicates when resize is possible
+ - Changed amount slider in buy and sell dialogs to start at 1
+ - Made weapon sprites and sounds customizable
+ - Made buy and sell dialogs resizable
+ - Merged equipment database with items database
+ - Chat window log no longer goes back forever
+ - Chat messages are trimmed (spaces are removed on both sides)
+ - Fixed segmentation fault with some OpenGL drivers
+ - Fixed updating of defense when increasing vitality
+ - Fixed a bug that prevented being-controlled particles from being deleted
+ - Fixed a crash in the particle engine related to child emitters
+ - Fixed encoding issues with user home directory
+ - Fixed a crash in equipment window on failure to load an item icon
+ - Fixed a crash on filling up your inventory
+ - Fixed item list in shops not to scroll back when selling
+
0.0.23 (3 June 2007)
- Added a particle engine along with some particle effects
- Added a cursor to indicate targeted enemy
@@ -46,13 +70,3 @@
- Fixed pathfinding to allow walking through beings when they block your path
- Fixed an issue with NPC dialogs staying open after player respawn
- 0.0.21.1 (30 October 2006)
- - Reload wallpaper after loading updates
- - Added support for gzip compressed map layer data
- - Added support for building with CMake
- - Added slider to setup dialog for configuring overlay effect
- - Fixed excessive unnecessary reloading of sprites
- - Fixed problem with OpenGL related redefinition
- - Fixed problems with hiding windows using h
- - Fixed trade window positioning
-
diff --git a/data/help/header.txt b/data/help/header.txt
index b10ed991..19afb84f 100644
--- a/data/help/header.txt
+++ b/data/help/header.txt
@@ -2,7 +2,7 @@
##1 T H E M A N A W O R L D
##1 ==========================================
- ##2Version:##6 0.0.23 ##2Date:##33 June 2007
+ ##2Version:##6 0.0.24 ##2Date:##324 December 2007
##2 Website: http://themanaworld.org
diff --git a/src/game.cpp b/src/game.cpp
index 7ae21009..cf6dc547 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -60,6 +60,7 @@
#include "gui/ministatus.h"
#include "gui/npclistdialog.h"
#include "gui/npc_text.h"
+#include "gui/ok_dialog.h"
#include "gui/sdlinput.h"
#include "gui/sell.h"
#include "gui/setup.h"
@@ -96,6 +97,7 @@ Joystick *joystick = NULL;
extern Window *weightNotice;
extern Window *deathNotice;
QuitDialog *quitDialog = NULL;
+OkDialog *disconnectedDialog = NULL;
ChatWindow *chatWindow;
MenuWindow *menuWindow;
@@ -128,6 +130,21 @@ Particle *particleEngine = NULL;
const int MAX_TIME = 10000;
/**
+ * Listener used for exitting handling.
+ */
+namespace {
+ struct ExitListener : public gcn::ActionListener
+ {
+ void action(const gcn::ActionEvent &event)
+ {
+ if (event.getId() == "yes" || event.getId() == "ok") {
+ done = true;
+ }
+ }
+ } exitListener;
+}
+
+/**
* Advances game logic counter.
*/
Uint32 nextTick(Uint32 interval, void *param)
@@ -407,6 +424,20 @@ void Game::logic()
// Handle network stuff
Net::flush();
+
+ // TODO: Fix notification when the connection is lost
+ if (false /*!mNetwork->isConnected() */)
+ {
+ if (!disconnectedDialog)
+ {
+ disconnectedDialog = new
+ OkDialog("Network Error",
+ "The connection to the server was lost, the program will now quit");
+ disconnectedDialog->addActionListener(&exitListener);
+ }
+
+ disconnectedDialog->requestMoveToTop();
+ }
}
}
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index bf23a419..0ef1ab35 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -65,7 +65,7 @@ InventoryWindow::InventoryWindow():
mDropButton = new Button(_("Drop"), "drop", this);
mSplitButton = new Button(_("Split"), "split", this);
- mItems = new ItemContainer(player_node->mInventory.get(), 10, 5);
+ mItems = new ItemContainer(player_node->mInventory, 10, 5);
mItems->addSelectionListener(this);
mInvenScroll = new ScrollArea(mItems);
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index ffa4d116..e6d3c516 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -114,10 +114,10 @@ void ShopListBox::setSelected(int selected)
std::max(-1, selected));
gcn::Widget *parent = getParent();
- if (parent)
+ if (parent && mSelected >= 0)
{
gcn::Rectangle scroll;
- scroll.y = (mSelected < 0) ? 0 : mRowHeight * mSelected;
+ scroll.y = mRowHeight * mSelected;
scroll.height = mRowHeight;
parent->showWidgetPart(this, scroll);
}
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 5d81bb9c..abae69f6 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -307,17 +307,20 @@ int UpdaterWindow::downloadThread(void *ptr)
switch (res)
{
case CURLE_COULDNT_CONNECT:
- // give more debug info on that error
- std::cerr << "curl error " << res << ": "
- << uw->mCurlError << " " << url.c_str()
- << std::endl;
- break;
-
default:
std::cerr << "curl error " << res << ": "
<< uw->mCurlError << " host: " << url.c_str()
<< std::endl;
+ break;
+ }
+
+ if (!uw->mStoreInMemory)
+ {
+ fclose(outfile);
+ ::remove(outFilename.c_str());
}
+ attempts++;
+ continue;
}
curl_easy_cleanup(curl);
diff --git a/src/inventory.cpp b/src/inventory.cpp
index bc4bd1c0..807e1223 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -26,6 +26,7 @@
#include <algorithm>
#include "item.h"
+#include "log.h"
struct SlotUsed : public std::unary_function<Item*, bool>
{
@@ -64,6 +65,11 @@ void Inventory::addItem(int id, int quantity)
void Inventory::setItem(int index, int id, int quantity)
{
+ if (index < 0 || index >= INVENTORY_SIZE) {
+ logger->log("Warning: invalid inventory index: %d", index);
+ return;
+ }
+
if (!mItems[index] && id > 0) {
mItems[index] = new Item(id, quantity);
mItems[index]->setInvIndex(index);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 12de3de4..085c80c5 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -69,6 +69,7 @@ LocalPlayer::LocalPlayer():
LocalPlayer::~LocalPlayer()
{
+ delete mInventory;
}
void LocalPlayer::logic()
diff --git a/src/localplayer.h b/src/localplayer.h
index fca6f993..548325dc 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -24,8 +24,6 @@
#ifndef _TMW_LOCALPLAYER_H
#define _TMW_LOCALPLAYER_H
-#include <memory>
-
#include "player.h"
// TODO move into some sane place...
@@ -329,7 +327,7 @@ class LocalPlayer : public Player
float mLastAttackTime; /**< Used to synchronize the charge dialog */
- std::auto_ptr<Inventory> mInventory;
+ Inventory *mInventory;
std::auto_ptr<Equipment> mEquipment;
protected:
diff --git a/src/main.cpp b/src/main.cpp
index 0726f5dc..9c69b203 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -191,7 +191,7 @@ void initConfiguration(const Options &options)
config.setValue("fpslimit", 0);
config.setValue("updatehost", "http://updates.themanaworld.org");
config.setValue("customcursor", 1);
- config.setValue("ChatLogLength", 64);
+ config.setValue("ChatLogLength", 128);
// Checking if the configuration file exists... otherwise create it with
// default options.
@@ -1055,7 +1055,6 @@ int main(int argc, char *argv[])
#ifdef PACKAGE_VERSION
delete versionLabel;
#endif
-
}
catch (...)
{
diff --git a/src/monster.cpp b/src/monster.cpp
index 9cbd28eb..ae749017 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -35,8 +35,12 @@
Monster::Monster(Uint16 id, Uint16 job, Map *map):
Being(id, job, map)
{
- mSprites[BASE_SPRITE] = AnimatedSprite::load(
- "graphics/sprites/" + getInfo().getSprite());
+ std::string filename = getInfo().getSprite();
+ if (filename.empty())
+ filename = "error.xml";
+
+ mSprites[BASE_SPRITE] =
+ AnimatedSprite::load("graphics/sprites/" + filename);
}
Being::Type
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index 9fe231e6..d10c1556 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -191,6 +191,7 @@ void ChatHandler::handleMessage(MessageIn &msg)
{
chatMsg.erase(0, pos + 3);
}
+ trim(chatMsg);
player_node->setSpeech(chatMsg, SPEECH_TIME);
}
else
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 51e99fa0..76eff9f5 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -89,7 +89,7 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
(gotDoubleBuffer ? "with" : "without"));
char const *glExtensions = (char const *)glGetString(GL_EXTENSIONS);
- int texSize;
+ GLint texSize;
bool rectTex = strstr(glExtensions, "GL_ARB_texture_rectangle");
if (rectTex)
{
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 035882b6..6f66b632 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -237,9 +237,44 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
}
}
+ParticleEmitter::ParticleEmitter(const ParticleEmitter &o)
+{
+ *this = o;
+}
+
+ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o)
+{
+ mParticlePosX = o.mParticlePosX;
+ mParticlePosY = o.mParticlePosY;
+ mParticlePosZ = o.mParticlePosZ;
+ mParticleAngleHorizontal = o.mParticleAngleHorizontal;
+ mParticleAngleVertical = o.mParticleAngleVertical;
+ mParticlePower = o.mParticlePower;
+ mParticleGravity = o.mParticleGravity;
+ mParticleRandomnes = o.mParticleRandomnes;
+ mParticleBounce = o.mParticleBounce;
+ mParticleTarget = o.mParticleTarget;
+ mParticleAcceleration = o.mParticleAcceleration;
+ mParticleDieDistance = o.mParticleDieDistance;
+ mParticleMomentum = o.mParticleMomentum;
+ mParticleLifetime = o.mParticleLifetime;
+ mParticleFadeOut = o.mParticleFadeOut;
+ mParticleFadeIn = o.mParticleFadeIn;
+ mMap = o.mMap;
+ mOutput = o.mOutput;
+ mParticleImage = o.mParticleImage;
+ mParticleAnimation = o.mParticleAnimation;
+ mParticleChildEmitters = o.mParticleChildEmitters;
+
+ if (mParticleImage) mParticleImage->incRef();
+
+ return *this;
+}
+
ParticleEmitter::~ParticleEmitter()
{
+ if (mParticleImage) mParticleImage->decRef();
}
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 37d067a6..c9524488 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -48,6 +48,16 @@ class ParticleEmitter
ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map);
/**
+ * Copy Constructor (necessary for reference counting of particle images)
+ */
+ ParticleEmitter(const ParticleEmitter &o);
+
+ /**
+ * Assignment operator that calls the copy constructor
+ */
+ ParticleEmitter & operator=(const ParticleEmitter &o);
+
+ /**
* Destructor.
*/
~ParticleEmitter();
diff --git a/src/player.cpp b/src/player.cpp
index 050790e8..b1372925 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -128,9 +128,16 @@ void Player::setSprite(int slot, int id, const std::string &color)
}
else
{
- AnimatedSprite *equipmentSprite = AnimatedSprite::load(
- "graphics/sprites/" + ItemDB::get(id).getSprite(mGender) +
- "|" + color);
+ std::string filename = ItemDB::get(id).getSprite(mGender);
+ AnimatedSprite *equipmentSprite = NULL;
+
+ if (!filename.empty())
+ {
+ if (!color.empty())
+ filename += "|" + color;
+ equipmentSprite =
+ AnimatedSprite::load("graphics/sprites/" + filename);
+ }
if (equipmentSprite)
equipmentSprite->setDirection(getSpriteDirection());
@@ -139,9 +146,7 @@ void Player::setSprite(int slot, int id, const std::string &color)
mSprites[slot] = equipmentSprite;
if (slot == WEAPON_SPRITE)
- {
mEquippedWeapon = &ItemDB::get(id);
- }
setAction(mAction);
}
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 6f91390e..fb9da9d7 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -144,11 +144,15 @@ ResourceManager::setWriteDir(const std::string &path)
return (bool) PHYSFS_setWriteDir(path.c_str());
}
-void
+bool
ResourceManager::addToSearchPath(const std::string &path, bool append)
{
logger->log("Adding to PhysicsFS: %s", path.c_str());
- PHYSFS_addToSearchPath(path.c_str(), append ? 1 : 0);
+ if (!PHYSFS_addToSearchPath(path.c_str(), append ? 1 : 0)) {
+ logger->log("Error: %s", PHYSFS_getLastError());
+ return false;
+ }
+ return true;
}
void
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 46b17d1b..abfd629a 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -73,8 +73,10 @@ class ResourceManager
* Adds a directory or archive to the search path. If append is true
* then the directory is added to the end of the search path, otherwise
* it is added at the front.
+ *
+ * @return <code>true</code> on success, <code>false</code> otherwise.
*/
- void
+ bool
addToSearchPath(const std::string &path, bool append);
/**
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index de6f8d0b..d2e32c03 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -62,7 +62,8 @@ SpriteDef *SpriteDef::load(std::string const &animationFile, int variant)
char *data = (char*) resman->loadFile
(animationFile.substr(0, pos).c_str(), size);
- if (!data) return NULL;
+ if (!data && animationFile != "graphics/sprites/error.xml")
+ return load("graphics/sprites/error.xml", 0);
xmlDocPtr doc = xmlParseMemory(data, size);
free(data);