summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp6
-rw-r--r--src/being.h32
-rw-r--r--src/beingmanager.cpp2
-rw-r--r--src/configlistener.h2
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/configuration.h3
-rw-r--r--src/effectmanager.cpp2
-rw-r--r--src/effectmanager.h5
-rw-r--r--src/engine.cpp10
-rw-r--r--src/engine.h2
-rw-r--r--src/equipment.cpp2
-rw-r--r--src/floor_item.cpp16
-rw-r--r--src/floor_item.h22
-rw-r--r--src/game.cpp7
-rw-r--r--src/game.h1
-rw-r--r--src/graphics.h8
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/debugwindow.cpp1
-rw-r--r--src/gui/equipmentwindow.cpp1
-rw-r--r--src/gui/gui.h1
-rw-r--r--src/gui/inventorywindow.cpp1
-rw-r--r--src/gui/itemshortcutcontainer.cpp1
-rw-r--r--src/gui/setup_players.h2
-rw-r--r--src/gui/viewport.cpp1
-rw-r--r--src/gui/viewport.h7
-rw-r--r--src/guichanfwd.h3
-rw-r--r--src/inventory.cpp42
-rw-r--r--src/itemshortcut.cpp17
-rw-r--r--src/joystick.cpp2
-rw-r--r--src/joystick.h6
-rw-r--r--src/keyboardconfig.cpp3
-rw-r--r--src/keyboardconfig.h11
-rw-r--r--src/localplayer.cpp8
-rw-r--r--src/localplayer.h8
-rw-r--r--src/log.cpp2
-rw-r--r--src/log.h1
-rw-r--r--src/main.cpp4
-rw-r--r--src/map.cpp5
-rw-r--r--src/map.h3
-rw-r--r--src/monster.cpp3
-rw-r--r--src/net/beinghandler.cpp1
-rw-r--r--src/net/equipmenthandler.cpp1
-rw-r--r--src/net/loginhandler.h1
-rw-r--r--src/net/partyhandler.cpp1
-rw-r--r--src/npc.cpp1
-rw-r--r--src/openglgraphics.cpp5
-rw-r--r--src/particle.cpp2
-rw-r--r--src/particle.h2
-rw-r--r--src/particlecontainer.cpp5
-rw-r--r--src/particlecontainer.h6
-rw-r--r--src/particleemitter.cpp5
-rw-r--r--src/particleemitter.h4
-rw-r--r--src/particleemitterprop.h1
-rw-r--r--src/party.cpp1
-rw-r--r--src/player.cpp7
-rw-r--r--src/player.h2
-rw-r--r--src/player_relations.cpp5
-rw-r--r--src/player_relations.h5
-rw-r--r--src/properties.h3
-rw-r--r--src/resources/animation.cpp2
-rw-r--r--src/resources/buddylist.h3
-rw-r--r--src/resources/colordb.cpp2
-rw-r--r--src/resources/dye.cpp1
-rw-r--r--src/resources/emotedb.cpp2
-rw-r--r--src/resources/image.h2
-rw-r--r--src/resources/imageloader.cpp1
-rw-r--r--src/resources/imagewriter.h2
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/itemdb.h2
-rw-r--r--src/resources/mapreader.cpp1
-rw-r--r--src/resources/mapreader.h2
-rw-r--r--src/resources/monsterdb.cpp2
-rw-r--r--src/resources/monsterdb.h2
-rw-r--r--src/resources/npcdb.cpp2
-rw-r--r--src/resources/resource.h3
-rw-r--r--src/resources/soundeffect.h3
-rw-r--r--src/simpleanimation.cpp10
-rw-r--r--src/simpleanimation.h11
-rw-r--r--src/text.cpp6
-rw-r--r--src/text.h10
-rw-r--r--src/textmanager.cpp14
-rw-r--r--src/textmanager.h5
-rw-r--r--src/textparticle.cpp2
-rw-r--r--src/textparticle.h2
-rw-r--r--src/utils/tostring.h2
85 files changed, 189 insertions, 222 deletions
diff --git a/src/being.cpp b/src/being.cpp
index dc843e43..2b4ba767 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -25,6 +25,7 @@
#include "animatedsprite.h"
#include "being.h"
#include "configuration.h"
+#include "effectmanager.h"
#include "game.h"
#include "graphics.h"
#include "localplayer.h"
@@ -34,7 +35,12 @@
#include "sound.h"
#include "text.h"
+#include "gui/speechbubble.h"
+
+#include "resources/colordb.h"
+
#include "resources/emotedb.h"
+#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
diff --git a/src/being.h b/src/being.h
index 812ffdd3..109a44ad 100644
--- a/src/being.h
+++ b/src/being.h
@@ -22,37 +22,39 @@
#ifndef BEING_H
#define BEING_H
-#include <list>
-#include <memory>
+#include <guichan/color.hpp>
+
#include <SDL_types.h>
+
#include <string>
#include <vector>
#include <bitset>
-#include "animatedsprite.h"
-#include "effectmanager.h"
-#include "map.h"
#include "particlecontainer.h"
#include "position.h"
#include "sprite.h"
-#include "gui/speechbubble.h"
-
-#include "resources/colordb.h"
+#include "resources/spritedef.h"
#define FIRST_IGNORE_EMOTE 14
#define STATUS_EFFECTS 32
class AnimatedSprite;
+class Image;
class ItemInfo;
class Item;
class Map;
class Graphics;
class Particle;
+class Position;
class SpeechBubble;
class Text;
-enum Gender {
+typedef std::list<Sprite*> Sprites;
+typedef Sprites::iterator SpriteIterator;
+
+enum Gender
+{
GENDER_MALE = 0,
GENDER_FEMALE = 1,
GENDER_UNSPECIFIED = 2
@@ -61,7 +63,8 @@ enum Gender {
class Being : public Sprite
{
public:
- enum Type {
+ enum Type
+ {
UNKNOWN,
PLAYER,
NPC,
@@ -71,7 +74,8 @@ class Being : public Sprite
/**
* Action the being is currently performing.
*/
- enum Action {
+ enum Action
+ {
STAND,
WALK,
ATTACK,
@@ -80,7 +84,8 @@ class Being : public Sprite
HURT
};
- enum Sprite {
+ enum Sprite
+ {
BASE_SPRITE = 0,
SHOE_SPRITE,
BOTTOMCLOTHES_SPRITE,
@@ -96,7 +101,8 @@ class Being : public Sprite
VECTOREND_SPRITE
};
- enum TargetCursorSize {
+ enum TargetCursorSize
+ {
TC_SMALL = 0,
TC_MEDIUM,
TC_LARGE,
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index 9e620ca0..a417ee50 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cassert>
-
#include "beingmanager.h"
#include "localplayer.h"
#include "monster.h"
diff --git a/src/configlistener.h b/src/configlistener.h
index 51d58144..ec7d6a2c 100644
--- a/src/configlistener.h
+++ b/src/configlistener.h
@@ -22,7 +22,7 @@
#ifndef CONFIGLISTENER_H
#define CONFIGLISTENER_H
-#include <iosfwd>
+#include <string>
/**
* The listener interface for receiving notifications about changes to
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 04cb4f36..f6c74428 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <libxml/xmlwriter.h>
-
#include "configlistener.h"
#include "configuration.h"
#include "log.h"
diff --git a/src/configuration.h b/src/configuration.h
index 0cc4e29f..da12e1e4 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -22,8 +22,9 @@
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
-#include <cassert>
#include <libxml/xmlwriter.h>
+
+#include <cassert>
#include <list>
#include <map>
#include <string>
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 63796f73..0a04c33d 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+#include "being.h"
#include "effectmanager.h"
#include "log.h"
#include "particle.h"
diff --git a/src/effectmanager.h b/src/effectmanager.h
index a9efcdbc..619b8e0d 100644
--- a/src/effectmanager.h
+++ b/src/effectmanager.h
@@ -25,15 +25,14 @@
#include <list>
#include <string>
-#include "being.h"
-
class Being;
class EffectManager
{
public:
- struct EffectDescription {
+ struct EffectDescription
+ {
int id;
std::string GFX;
std::string SFX;
diff --git a/src/engine.cpp b/src/engine.cpp
index 29b8921a..c91e42f9 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -19,18 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <list>
-
-#include "being.h"
#include "beingmanager.h"
-#include "configuration.h"
#include "engine.h"
#include "flooritemmanager.h"
#include "game.h"
-#include "graphics.h"
#include "localplayer.h"
#include "log.h"
-#include "main.h"
#include "map.h"
#include "particle.h"
#include "sound.h"
@@ -43,14 +37,10 @@
#include "net/protocol.h"
#include "resources/mapreader.h"
-#include "resources/monsterdb.h"
#include "resources/resourcemanager.h"
-#include "utils/dtor.h"
#include "utils/tostring.h"
-extern Minimap *minimap;
-
char itemCurrenyQ[10] = "0";
Engine::Engine(Network *network):
diff --git a/src/engine.h b/src/engine.h
index f2852351..7ad6d894 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -22,7 +22,6 @@
#ifndef _ENGINE_H
#define _ENGINE_H
-#include <iosfwd>
#include <string>
class Map;
@@ -52,7 +51,6 @@ class Engine
const std::string &getCurrentMapName() { return mMapName; }
-
/**
* Sets the currently active map.
*/
diff --git a/src/equipment.cpp b/src/equipment.cpp
index d5e0f656..b21115a3 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include "equipment.h"
#include "item.h"
#include "inventory.h"
diff --git a/src/floor_item.cpp b/src/floor_item.cpp
index 0c4c1c10..fbe606b4 100644
--- a/src/floor_item.cpp
+++ b/src/floor_item.cpp
@@ -20,8 +20,12 @@
*/
#include "floor_item.h"
+#include "graphics.h"
+#include "item.h"
#include "map.h"
+#include "resources/image.h"
+
FloorItem::FloorItem(unsigned int id,
unsigned int itemId,
unsigned short x,
@@ -46,3 +50,15 @@ FloorItem::~FloorItem()
delete mItem;
}
+
+unsigned int FloorItem::getItemId() const
+{
+ return mItem->getId();
+}
+
+void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const
+{
+ graphics->drawImage(mItem->getImage(),
+ mX * 32 + offsetX,
+ mY * 32 + offsetY);
+}
diff --git a/src/floor_item.h b/src/floor_item.h
index a7299bfb..444c756a 100644
--- a/src/floor_item.h
+++ b/src/floor_item.h
@@ -22,11 +22,16 @@
#ifndef FLOORITEM_H
#define FLOORITEM_H
-#include "graphics.h"
-#include "item.h"
-#include "map.h"
+#include <list>
+
#include "sprite.h"
-#include "resources/image.h"
+
+class Graphics;
+class Image;
+class Item;
+class Map;
+
+typedef std::list<Sprite*> Sprites;
/**
* An item lying on the floor.
@@ -56,7 +61,7 @@ class FloorItem : public Sprite
/**
* Returns the item id.
*/
- unsigned int getItemId() const { return mItem->getId(); }
+ unsigned int getItemId() const;
/**
* Returns the x coordinate.
@@ -80,12 +85,7 @@ class FloorItem : public Sprite
*
* @see Sprite::draw(Graphics, int, int)
*/
- void draw(Graphics *graphics, int offsetX, int offsetY) const
- {
- graphics->drawImage(mItem->getImage(),
- mX * 32 + offsetX,
- mY * 32 + offsetY);
- }
+ void draw(Graphics *graphics, int offsetX, int offsetY) const;
private:
unsigned int mId;
diff --git a/src/game.cpp b/src/game.cpp
index 28c29874..e2064f58 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -25,9 +25,9 @@
#include <string>
#include <guichan/exception.hpp>
-#include <guichan/sdl/sdlinput.hpp>
#include "beingmanager.h"
+#include "configuration.h"
#include "effectmanager.h"
#include "emoteshortcut.h"
#include "engine.h"
@@ -55,7 +55,6 @@
#include "gui/help.h"
#include "gui/inventorywindow.h"
#include "gui/shortcutwindow.h"
-#include "gui/shortcutcontainer.h"
#include "gui/itemshortcutcontainer.h"
#include "gui/menuwindow.h"
#include "gui/minimap.h"
@@ -73,7 +72,6 @@
#include "gui/trade.h"
#include "gui/viewport.h"
-#include "net/protocol.h"
#include "net/beinghandler.h"
#include "net/buysellhandler.h"
#include "net/chathandler.h"
@@ -87,14 +85,11 @@
#include "net/protocol.h"
#include "net/skillhandler.h"
#include "net/tradehandler.h"
-#include "net/messageout.h"
#include "resources/imagewriter.h"
#include "utils/gettext.h"
-extern Graphics *graphics;
-
class Map;
std::string map_path;
diff --git a/src/game.h b/src/game.h
index 4f512d97..c9fc8d79 100644
--- a/src/game.h
+++ b/src/game.h
@@ -22,7 +22,6 @@
#ifndef GAME_
#define GAME_
-#include <iosfwd>
#include <memory>
#include "configlistener.h"
diff --git a/src/graphics.h b/src/graphics.h
index 8009ceda..172032dc 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -46,14 +46,16 @@ struct SDL_Surface;
* Sections 0, 2, 6 and 8 will remain as is. 1, 3, 4, 5 and 7 will be
* repeated to fit the size of the widget.
*/
-struct ImageRect {
+struct ImageRect
+{
Image *grid[9];
};
/**
* A central point of control for graphics.
*/
-class Graphics : public gcn::SDLGraphics {
+class Graphics : public gcn::SDLGraphics
+{
public:
/**
* Constructor.
@@ -151,4 +153,6 @@ class Graphics : public gcn::SDLGraphics {
bool mFullscreen, mHWAccel;
};
+extern Graphics *graphics;
+
#endif
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 4433b646..6626b848 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -41,6 +41,8 @@
#include "../net/charserverhandler.h"
#include "../net/messageout.h"
+#include "../resources/colordb.h"
+
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
#include "../utils/trim.h"
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 055d9963..5a5acfad 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -24,7 +24,6 @@
#include <guichan/widgets/label.hpp>
#include "debugwindow.h"
-#include "gui.h"
#include "viewport.h"
#include "widgets/layout.h"
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 5ba9501d..e553fbe7 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -26,7 +26,6 @@
#include "button.h"
#include "equipmentwindow.h"
-#include "gui.h"
#include "itempopup.h"
#include "playerbox.h"
#include "viewport.h"
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 9681d44a..5c0c24f7 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -115,7 +115,6 @@ class Gui : public gcn::Gui
};
extern Gui *gui; /**< The GUI system */
-extern Viewport *viewport; /**< The viewport */
extern SDLInput *guiInput; /**< GUI input */
/**
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index a3572d4f..70b3efb5 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -27,7 +27,6 @@
#include <guichan/widgets/label.hpp>
#include "button.h"
-#include "gui.h"
#include "inventorywindow.h"
#include "item_amount.h"
#include "itemcontainer.h"
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index e152b03d..d3cc2c22 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -20,7 +20,6 @@
*/
#include <SDL_mouse.h>
-#include "gui.h"
#include "itemshortcutcontainer.h"
#include "itempopup.h"
#include "viewport.h"
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 393fc6aa..2edc6983 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -53,7 +53,7 @@ private:
PlayerTableModel *mPlayerTableModel;
GuiTable *mPlayerTable;
GuiTable *mPlayerTitleTable;
- ScrollArea *mPlayerScrollArea;
+ gcn::ScrollArea *mPlayerScrollArea;
gcn::CheckBox *mPersistIgnores;
gcn::CheckBox *mDefaultTrading;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 11a0004b..25e69c43 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -19,7 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "gui.h"
#include "popupmenu.h"
#include "viewport.h"
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index e352f765..522ea734 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -27,13 +27,14 @@
#include "windowcontainer.h"
#include "../configlistener.h"
+#include "../position.h"
-class Map;
class FloorItem;
+class Graphics;
class ImageSet;
class Item;
+class Map;
class PopupMenu;
-class Graphics;
/**
* The viewport on the map. Displays the current map and handles mouse input
@@ -137,4 +138,6 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
PopupMenu *mPopupMenu; /**< Popup menu. */
};
+extern Viewport *viewport; /**< The viewport */
+
#endif
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
index 2e97db68..4863421c 100644
--- a/src/guichanfwd.h
+++ b/src/guichanfwd.h
@@ -22,7 +22,8 @@
#ifndef GUICHANFWD_H
#define GUICHANFWD_H
-namespace gcn {
+namespace gcn
+{
class ActionListener;
class AllegroGraphics;
class AllegroImage;
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 8824e1ba..3ca26e1e 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -20,7 +20,6 @@
*/
#include <algorithm>
-#include <cassert>
#include "inventory.h"
#include "item.h"
@@ -28,7 +27,8 @@
struct SlotUsed : public std::unary_function<Item*, bool>
{
- bool operator()(const Item *item) const {
+ bool operator()(const Item *item) const
+ {
return item && item->getId() != -1 && item->getQuantity() > 0;
}
};
@@ -59,10 +59,9 @@ Item* Inventory::getItem(int index) const
Item* Inventory::findItem(int itemId) const
{
for (int i = 0; i < mSize; i++)
- {
if (mItems[i] && mItems[i]->getId() == itemId)
return mItems[i];
- }
+
return NULL;
}
@@ -73,38 +72,41 @@ void Inventory::addItem(int id, int quantity, bool equipment)
void Inventory::setItem(int index, int id, int quantity, bool equipment)
{
- if (index < 0 || index >= mSize) {
+ if (index < 0 || index >= mSize)
+ {
logger->log("Warning: invalid inventory index: %d", index);
return;
}
- if (!mItems[index] && id > 0) {
+ if (!mItems[index] && id > 0)
+ {
Item *item = new Item(id, quantity, equipment);
item->setInvIndex(index);
mItems[index] = item;
- } else if (id > 0) {
+ }
+ else if (id > 0)
+ {
mItems[index]->setId(id);
mItems[index]->setQuantity(quantity);
mItems[index]->setEquipment(equipment);
- } else if (mItems[index]) {
+ }
+ else if (mItems[index])
+ {
removeItemAt(index);
}
}
void Inventory::clear()
{
- for (int i = 0; i < mSize; i++) {
+ for (int i = 0; i < mSize; i++)
removeItemAt(i);
- }
}
void Inventory::removeItem(int id)
{
- for (int i = 0; i < mSize; i++) {
- if (mItems[i] && mItems[i]->getId() == id) {
+ for (int i = 0; i < mSize; i++)
+ if (mItems[i] && mItems[i]->getId() == id)
removeItemAt(i);
- }
- }
}
void Inventory::removeItemAt(int index)
@@ -115,11 +117,9 @@ void Inventory::removeItemAt(int index)
bool Inventory::contains(Item *item) const
{
- for (int i = 0; i < mSize; i++) {
- if (mItems[i] && mItems[i]->getId() == item->getId()) {
+ for (int i = 0; i < mSize; i++)
+ if (mItems[i] && mItems[i]->getId() == item->getId())
return true;
- }
- }
return false;
}
@@ -138,11 +138,9 @@ int Inventory::getNumberOfSlotsUsed() const
int Inventory::getLastUsedSlot() const
{
- for (int i = mSize - 1; i >= 0; i--) {
- if (SlotUsed()(mItems[i])) {
+ for (int i = mSize - 1; i >= 0; i--)
+ if (SlotUsed()(mItems[i]))
return i;
- }
- }
return -1;
}
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 7bfbc88e..3404b0e3 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -33,9 +33,8 @@ ItemShortcut::ItemShortcut():
mItemSelected(-1)
{
for (int i = 0; i < SHORTCUT_ITEMS; i++)
- {
mItems[i] = -1;
- }
+
load();
}
@@ -51,9 +50,7 @@ void ItemShortcut::load()
int itemId = (int) config.getValue("shortcut" + toString(i), -1);
if (itemId != -1)
- {
mItems[i] = itemId;
- }
}
}
@@ -73,13 +70,15 @@ void ItemShortcut::useItem(int index)
Item *item = player_node->getInventory()->findItem(mItems[index]);
if (item && item->getQuantity())
{
- if (item->isEquipment()) {
- if (item->isEquipped()) {
+ if (item->isEquipment())
+ {
+ if (item->isEquipped())
player_node->unequipItem(item);
- } else {
+ else
player_node->equipItem(item);
- }
- } else {
+ }
+ else
+ {
player_node->useItem(item);
}
}
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 1233c37f..7e9a2285 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -25,8 +25,6 @@
#include "joystick.h"
#include "log.h"
-#include <cassert>
-
int Joystick::joystickCount = 0;
void Joystick::init()
diff --git a/src/joystick.h b/src/joystick.h
index a7090293..4e5c3d23 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -30,14 +30,16 @@ class Joystick
/**
* Number of buttons we can handle.
*/
- enum {
+ enum
+ {
MAX_BUTTONS = 6
};
/**
* Directions, to be used as bitmask values.
*/
- enum {
+ enum
+ {
UP = 1,
DOWN = 2,
LEFT = 4,
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 745a81db..ecf47573 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -19,12 +19,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <guichan/sdl/sdlinput.hpp>
-
#include "configuration.h"
#include "keyboardconfig.h"
#include "log.h"
+#include "gui/sdlinput.h"
#include "gui/setup_keyboard.h"
#include "utils/gettext.h"
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index ba8039bf..bfcde31c 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -22,13 +22,9 @@
#ifndef KEYBOARDCONFIG_H
#define KEYBOARDCONFIG_H
+#include <SDL_types.h>
#include <string>
-#include <guichan/sdl/sdlinput.hpp>
-
-#include "gui/sdlinput.h"
-#include "gui/setup_keyboard.h"
-
/**
* Each key represents a key function. Such as 'Move up', 'Attack' etc.
*/
@@ -40,6 +36,8 @@ struct KeyFunction
int value; /** The actual value that is used. */
};
+class Setup_Keyboard;
+
class KeyboardConfig
{
public:
@@ -148,7 +146,8 @@ class KeyboardConfig
* The key assignment view gets arranged according to the order of
* these values.
*/
- enum KeyAction {
+ enum KeyAction
+ {
KEY_NO_VALUE = -1,
KEY_MOVE_UP,
KEY_MOVE_DOWN,
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index bc0b2b81..01de3b41 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -24,20 +24,24 @@
#include "equipment.h"
#include "floor_item.h"
#include "game.h"
+#include "graphics.h"
#include "inventory.h"
#include "item.h"
#include "localplayer.h"
-#include "main.h"
+#include "map.h"
#include "monster.h"
#include "particle.h"
+#include "simpleanimation.h"
#include "sound.h"
-#include "monster.h"
+#include "text.h"
#include "gui/gui.h"
#include "net/messageout.h"
#include "net/protocol.h"
+#include "resources/animation.h"
+#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
diff --git a/src/localplayer.h b/src/localplayer.h
index 7f5596e4..d6d5ad2e 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -22,8 +22,9 @@
#ifndef LOCALPLAYER_H
#define LOCALPLAYER_H
+#include <memory>
+
#include "player.h"
-#include "simpleanimation.h"
// TODO move into some sane place...
#define MAX_SLOT 2
@@ -36,7 +37,9 @@ class FloorItem;
class ImageSet;
class Inventory;
class Item;
+class Map;
class Network;
+class SimpleAnimation;
/**
* The local player character.
@@ -44,7 +47,8 @@ class Network;
class LocalPlayer : public Player
{
public:
- enum Attribute {
+ enum Attribute
+ {
STR = 0, AGI, VIT, INT, DEX, LUK
};
diff --git a/src/log.cpp b/src/log.cpp
index e50edeb2..b0024f80 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cstdarg>
-#include <cstdlib>
#include <iostream>
#include <sstream>
diff --git a/src/log.h b/src/log.h
index fcd48757..b06bdc89 100644
--- a/src/log.h
+++ b/src/log.h
@@ -22,7 +22,6 @@
#ifndef _LOG_H
#define _LOG_H
-#include <iosfwd>
#include <fstream>
class ChatWindow;
diff --git a/src/main.cpp b/src/main.cpp
index 65b61de2..73e0b0fe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,8 +28,6 @@
#include <guichan/actionlistener.hpp>
-#include <guichan/sdl/sdlinput.hpp>
-
#include <guichan/widgets/label.hpp>
#include <libxml/parser.h>
@@ -65,7 +63,6 @@
#include "gui/register.h"
#include "gui/sdlinput.h"
#include "gui/setup.h"
-#include "gui/textfield.h"
#include "gui/updatewindow.h"
#include "net/charserverhandler.h"
@@ -82,7 +79,6 @@
#include "resources/npcdb.h"
#include "resources/resourcemanager.h"
-#include "utils/dtor.h"
#include "utils/gettext.h"
#include "utils/tostring.h"
diff --git a/src/map.cpp b/src/map.cpp
index 57b79ef4..716e9aee 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -68,6 +68,11 @@ TileAnimation::TileAnimation(Animation *ani):
{
}
+TileAnimation::~TileAnimation()
+{
+ delete mLastImage;
+}
+
void TileAnimation::update()
{
//update animation
diff --git a/src/map.h b/src/map.h
index bd4cb122..1423565f 100644
--- a/src/map.h
+++ b/src/map.h
@@ -27,9 +27,9 @@
#include "position.h"
#include "properties.h"
-
#include "simpleanimation.h"
+class Animation;
class AmbientOverlay;
class Graphics;
class Image;
@@ -72,6 +72,7 @@ class TileAnimation
{
public:
TileAnimation(Animation *ani);
+ ~TileAnimation();
void update();
void addAffectedTile(MapLayer *layer, int index)
{ mAffected.push_back(std::make_pair(layer, index)); }
diff --git a/src/monster.cpp b/src/monster.cpp
index 4f2c97e7..33703817 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -28,8 +28,7 @@
#include "text.h"
#include "resources/monsterdb.h"
-
-#include "utils/tostring.h"
+#include "resources/monsterinfo.h"
static const int NAME_X_OFFSET = 16;
static const int NAME_Y_OFFSET = 16;
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 69bc462c..69f462ec 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -32,7 +32,6 @@
#include "../game.h"
#include "../localplayer.h"
#include "../log.h"
-#include "../main.h"
#include "../npc.h"
#include "../particle.h"
#include "../player_relations.h"
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 319d1205..9a3c396a 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -23,7 +23,6 @@
#include "messagein.h"
#include "protocol.h"
-#include "../beingmanager.h"
#include "../equipment.h"
#include "../inventory.h"
#include "../item.h"
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index c847b4c1..df86b634 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -25,7 +25,6 @@
#include <string>
#include "messagehandler.h"
-#include <string>
struct LoginData;
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index d4b7455b..2437d0a0 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -29,7 +29,6 @@
#include "../gui/confirm_dialog.h"
#include "../beingmanager.h"
-#include "../game.h"
#include "../party.h"
PartyHandler::PartyHandler(Party *party) : mParty(party)
diff --git a/src/npc.cpp b/src/npc.cpp
index cef98e45..7b7db125 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -20,7 +20,6 @@
*/
#include "animatedsprite.h"
-#include "graphics.h"
#include "localplayer.h"
#include "npc.h"
#include "particle.h"
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index d3278c1a..e7e7b204 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -19,14 +19,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cstring>
#include <SDL.h>
-#include <guichan/exception.hpp>
-#include <guichan/image.hpp>
-
#include "log.h"
-#include "main.h"
#include "openglgraphics.h"
#include "resources/image.h"
diff --git a/src/particle.cpp b/src/particle.cpp
index 4de9fe29..d89d0a3e 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -22,6 +22,8 @@
#include <algorithm>
#include <cmath>
+#include <guichan/color.hpp>
+
#include "animationparticle.h"
#include "configuration.h"
#include "imageparticle.h"
diff --git a/src/particle.h b/src/particle.h
index 87e4d69d..881bbb74 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -25,8 +25,6 @@
#include <list>
#include <string>
-#include <guichan/color.hpp>
-
#include "guichanfwd.h"
#include "sprite.h"
#include "vector.h"
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index d100ba27..1ed51053 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -21,9 +21,9 @@
#include <cassert>
+#include "particle.h"
#include "particlecontainer.h"
-
ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent) :
mDelParent(delParent),
mNext(parent)
@@ -103,9 +103,6 @@ void ParticleList::moveTo(float x, float y)
}
}
-
-
-
// -- particle vector ----------------------------------------
ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent) :
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index 0181f6e1..4fb00027 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -25,8 +25,7 @@
#include <list>
#include <vector>
-#include "particle.h"
-
+class Particle;
/**
* Set of particle effects. May be stacked with other ParticleContainers. All
@@ -65,8 +64,6 @@ protected:
ParticleContainer *mNext; /**< Contained container, if any */
};
-
-
/**
* Linked list of particle effects.
*/
@@ -94,7 +91,6 @@ protected:
std::list<Particle *> mElements; /**< Contained particle effects */
};
-
/**
* Particle container with indexing facilities
*/
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index ca9f7bf5..fa5dcde4 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -19,19 +19,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <cmath>
+
#include "animationparticle.h"
#include "imageparticle.h"
#include "log.h"
#include "particle.h"
#include "particleemitter.h"
-#include "resources/animation.h"
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
-#include <cmath>
-
#define SIN45 0.707106781f
#define DEG_RAD_FACTOR 0.017453293f
diff --git a/src/particleemitter.h b/src/particleemitter.h
index cc77f215..67b35ae2 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -26,10 +26,10 @@
#include "utils/xml.h"
-#include "resources/animation.h"
-
#include "particleemitterprop.h"
+#include "resources/animation.h"
+
class Image;
class Map;
class Particle;
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index fde78f8f..e68ac222 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -20,7 +20,6 @@
*/
#include <cmath>
-#include <cstdlib>
/**
* Returns a random numeric value that is larger than or equal min and smaller
diff --git a/src/party.cpp b/src/party.cpp
index 67262176..e9304ada 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -19,7 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "beingmanager.h"
#include "game.h"
#include "localplayer.h"
#include "party.h"
diff --git a/src/player.cpp b/src/player.cpp
index ca8c9f14..610dfeb1 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -19,16 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <iostream>
-
#include "animatedsprite.h"
#include "game.h"
-#include "graphics.h"
-#include "log.h"
#include "player.h"
+#include "text.h"
+#include "resources/colordb.h"
#include "resources/itemdb.h"
-#include "resources/iteminfo.h"
#include "utils/strprintf.h"
diff --git a/src/player.h b/src/player.h
index 5fe9963a..f9911bb8 100644
--- a/src/player.h
+++ b/src/player.h
@@ -23,8 +23,8 @@
#define PLAYER_H
#include "being.h"
-#include "text.h"
+class FlashText;
class Graphics;
class Map;
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index 057eea94..6386c246 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -21,12 +21,13 @@
#include <algorithm>
+#include "being.h"
#include "beingmanager.h"
+#include "configuration.h"
#include "graphics.h"
+#include "player.h"
#include "player_relations.h"
-#include "gui/gui.h"
-
#define PLAYER_IGNORE_STRATEGY_NOP "nop"
#define PLAYER_IGNORE_STRATEGY_EMOTE0 "emote0"
#define DEFAULT_IGNORE_STRATEGY PLAYER_IGNORE_STRATEGY_EMOTE0
diff --git a/src/player_relations.h b/src/player_relations.h
index 0f8bb4e3..1eb4ede6 100644
--- a/src/player_relations.h
+++ b/src/player_relations.h
@@ -27,9 +27,8 @@
#include <string>
#include <vector>
-#include "being.h"
-#include "configuration.h"
-#include "player.h"
+class Being;
+class Player;
struct PlayerRelation
{
diff --git a/src/properties.h b/src/properties.h
index 91367552..4bad8e59 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -35,8 +35,7 @@ class Properties
/**
* Destructor.
*/
- virtual
- ~Properties() {}
+ virtual ~Properties() {}
/**
* Get a map property.
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 8d7156a9..54c319de 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include "animation.h"
#include "../utils/dtor.h"
diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h
index d769b2b8..f0758c25 100644
--- a/src/resources/buddylist.h
+++ b/src/resources/buddylist.h
@@ -27,7 +27,8 @@
#include <guichan/listmodel.hpp>
-class BuddyList : public gcn::ListModel {
+class BuddyList : public gcn::ListModel
+{
public:
/**
* Constructor
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index f80ca6b3..7456f0e4 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -19,14 +19,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cassert>
#include <libxml/tree.h>
#include "colordb.h"
#include "../log.h"
-#include "../utils/dtor.h"
#include "../utils/gettext.h"
#include "../utils/xml.h"
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index fd760c3f..63d85501 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -19,7 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
#include <sstream>
#include "dye.h"
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 2f43822d..adc1635c 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -20,11 +20,9 @@
*/
#include "emotedb.h"
-#include "resourcemanager.h"
#include "../log.h"
-#include "../utils/dtor.h"
#include "../utils/gettext.h"
#include "../utils/xml.h"
diff --git a/src/resources/image.h b/src/resources/image.h
index 5b376053..9af10fda 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -40,6 +40,8 @@
#include "resource.h"
class Dye;
+class SDL_Rect;
+class SDL_Surface;
/**
* Defines a class for loading and storing images.
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index 8ad6c5d4..c182b44c 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -20,7 +20,6 @@
*/
#include <cassert>
-#include <string>
#include <guichan/color.hpp>
#include <guichan/sdl/sdlpixel.hpp>
diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h
index a9133846..039d3afb 100644
--- a/src/resources/imagewriter.h
+++ b/src/resources/imagewriter.h
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <iosfwd>
-
struct SDL_Surface;
class ImageWriter
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 752ea38b..9976f0d4 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -24,8 +24,6 @@
#include <libxml/tree.h>
#include "itemdb.h"
-#include "iteminfo.h"
-#include "resourcemanager.h"
#include "../log.h"
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index e7c23ca2..08a7acd0 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -26,6 +26,8 @@
#include "iteminfo.h"
+class ItemInfo;
+
/**
* The namespace that holds the item information.
*/
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index a4ec3b69..2278dc67 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -23,6 +23,7 @@
#include <iostream>
#include <zlib.h>
+#include "animation.h"
#include "image.h"
#include "mapreader.h"
#include "resourcemanager.h"
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index ef945c3f..0ed553c3 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -22,8 +22,6 @@
#ifndef MAPREADER_H
#define MAPREADER_H
-#include <iosfwd>
-
#include <libxml/tree.h>
class Map;
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index c7926260..c7824a5d 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -20,7 +20,7 @@
*/
#include "monsterdb.h"
-#include "resourcemanager.h"
+#include "monsterinfo.h"
#include "../log.h"
diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h
index 6fbde55f..0a218661 100644
--- a/src/resources/monsterdb.h
+++ b/src/resources/monsterdb.h
@@ -24,7 +24,7 @@
#include <map>
-#include "monsterinfo.h"
+class MonsterInfo;
/**
* Monster information database.
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 88572481..73c3939d 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -20,11 +20,9 @@
*/
#include "npcdb.h"
-#include "resourcemanager.h"
#include "../log.h"
-#include "../utils/dtor.h"
#include "../utils/gettext.h"
#include "../utils/xml.h"
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 303b82c8..7c5f989e 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -62,8 +62,7 @@ class Resource
/**
* Destructor.
*/
- virtual
- ~Resource();
+ virtual ~Resource();
private:
std::string mIdPath; /**< Path identifying this resource. */
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 05ec9e54..116df930 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -35,8 +35,7 @@ class SoundEffect : public Resource
/**
* Destructor.
*/
- virtual
- ~SoundEffect();
+ virtual ~SoundEffect();
/**
* Loads a sample from a buffer in memory.
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 17d9ce60..9066ed7f 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -19,14 +19,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "graphics.h"
#include "log.h"
#include "simpleanimation.h"
+#include "resources/animation.h"
#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
+SimpleAnimation::SimpleAnimation(Animation *animation):
+ mAnimation(animation),
+ mAnimationTime(0),
+ mAnimationPhase(0),
+ mCurrentFrame(mAnimation->getFrame(0))
+{
+};
+
SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
mAnimationTime(0),
mAnimationPhase(0)
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index a7178145..16ac2906 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -22,12 +22,12 @@
#ifndef SIMPLEANIMAION_H
#define SIMPLEANIMAION_H
-#include "resources/animation.h"
-
#include "utils/xml.h"
+class Animation;
class Frame;
class Graphics;
+class Image;
/**
* This class is a leightweight alternative to the AnimatedSprite class.
@@ -39,12 +39,7 @@ class SimpleAnimation
/**
* Creates a simple animation with an already created animation.
*/
- SimpleAnimation(Animation *animation):
- mAnimation(animation),
- mAnimationTime(0),
- mAnimationPhase(0),
- mCurrentFrame(mAnimation->getFrame(0))
- {};
+ SimpleAnimation(Animation *animation);
/**
* Creates a simple animation that creates its animation from XML Data.
diff --git a/src/text.cpp b/src/text.cpp
index 14ee3919..8f93f157 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -18,8 +18,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <cstring>
-
#include <guichan/font.hpp>
#include "text.h"
@@ -72,7 +70,7 @@ Text::~Text()
}
}
-void Text::draw(Graphics *graphics, int xOff, int yOff)
+void Text::draw(gcn::Graphics *graphics, int xOff, int yOff)
{
graphics->setFont(boldFont);
@@ -102,7 +100,7 @@ FlashText::FlashText(const std::string &text, int x, int y,
{
}
-void FlashText::draw(Graphics *graphics, int xOff, int yOff)
+void FlashText::draw(gcn::Graphics *graphics, int xOff, int yOff)
{
if (mTime)
{
diff --git a/src/text.h b/src/text.h
index 43d6b5ea..c898bbe3 100644
--- a/src/text.h
+++ b/src/text.h
@@ -21,10 +21,10 @@
#ifndef TEXT_H
#define TEXT_H
-#include "graphics.h"
-#include "guichanfwd.h"
+#include <guichan/color.hpp>
+#include <guichan/graphics.hpp>
-#include <list>
+#include "guichanfwd.h"
class TextManager;
@@ -52,7 +52,7 @@ class Text
/**
* Draws the text.
*/
- virtual void draw(Graphics *graphics, int xOff, int yOff);
+ virtual void draw(gcn::Graphics *graphics, int xOff, int yOff);
private:
int mX; /**< Actual x-value of left of text written. */
@@ -84,7 +84,7 @@ class FlashText : public Text
/**
* Draws the text
*/
- virtual void draw(Graphics *graphics, int xOff, int yOff);
+ virtual void draw(gcn::Graphics *graphics, int xOff, int yOff);
private:
int mTime; /**< Time left for flashing */
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 7c5d2713..d40ba4d2 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -59,7 +59,7 @@ TextManager::~TextManager()
{
}
-void TextManager::draw(Graphics *graphics, int xOff, int yOff)
+void TextManager::draw(gcn::Graphics *graphics, int xOff, int yOff)
{
for (TextList::iterator bPtr = mTextList.begin(), ePtr = mTextList.end();
bPtr != ePtr; ++bPtr)
@@ -89,21 +89,13 @@ void TextManager::place(const Text *textObj, const Text *omit,
int from = (*ptr)->mY - occupiedTop;
int to = from + (*ptr)->mHeight - 1;
if (to < 0 || from >= TEST) // out of range considered
- {
continue;
- }
if (from < 0)
- {
from = 0;
- }
if (to >= TEST)
- {
to = TEST - 1;
- }
for (int i = from; i <= to; ++i)
- {
occupied[i] = true;
- }
}
}
bool ok = true;
@@ -111,10 +103,10 @@ void TextManager::place(const Text *textObj, const Text *omit,
{
ok = ok && !occupied[i];
}
+
if (ok)
- {
return;
- }
+
// Have to move it up or down, so find nearest spaces either side
int consec = 0;
int upSlot = -1; // means not found
diff --git a/src/textmanager.h b/src/textmanager.h
index a08660d5..b1e10f08 100644
--- a/src/textmanager.h
+++ b/src/textmanager.h
@@ -23,8 +23,9 @@
#include <list>
+#include "guichanfwd.h"
+
class Text;
-class Graphics;
class TextManager
{
@@ -57,7 +58,7 @@ class TextManager
/**
* Draw the text
*/
- void draw(Graphics *graphics, int xOff, int yOff);
+ void draw(gcn::Graphics *graphics, int xOff, int yOff);
private:
/**
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 7e329b4e..f38c32ce 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <guichan/color.hpp>
+
#include "graphics.h"
#include "textparticle.h"
diff --git a/src/textparticle.h b/src/textparticle.h
index bc7cd88c..cdf99d8f 100644
--- a/src/textparticle.h
+++ b/src/textparticle.h
@@ -22,8 +22,6 @@
#ifndef _TEXTPARTICLE_H
#define _TEXTPARTICLE_H
-#include <guichan/color.hpp>
-
#include "guichanfwd.h"
#include "particle.h"
diff --git a/src/utils/tostring.h b/src/utils/tostring.h
index eb86f99e..62eb44e4 100644
--- a/src/utils/tostring.h
+++ b/src/utils/tostring.h
@@ -34,7 +34,7 @@ std::string toString(const T &arg)
// TODO: Is there a good way to suppress warnings from classes which don't use
// this function?
-static char *iptostring(int address)
+inline char *iptostring(int address)
{
static char asciiIP[16];