summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-06 00:26:05 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-06 00:26:05 +0000
commit1941e274acd375ff70fd09a9d458755d2a82e66e (patch)
tree0c159d8d9da64267b7ca56397c775d256cc780e6
parent54fa93b126ce6f2ed5ec24b134fe367fa5bc5c87 (diff)
downloadmanaserv-1941e274acd375ff70fd09a9d458755d2a82e66e.tar.gz
manaserv-1941e274acd375ff70fd09a9d458755d2a82e66e.tar.bz2
manaserv-1941e274acd375ff70fd09a9d458755d2a82e66e.tar.xz
manaserv-1941e274acd375ff70fd09a9d458755d2a82e66e.zip
Cleaned up unnecessary header dependencies and fixed some indentations.
-rw-r--r--ChangeLog25
-rw-r--r--src/account.cpp4
-rw-r--r--src/account.h1
-rw-r--r--src/accounthandler.cpp8
-rw-r--r--src/accounthandler.h10
-rw-r--r--src/chatchannelmanager.cpp3
-rw-r--r--src/chathandler.cpp11
-rw-r--r--src/chathandler.h7
-rw-r--r--src/client.cpp5
-rw-r--r--src/configuration.cpp13
-rw-r--r--src/connectionhandler.cpp14
-rw-r--r--src/connectionhandler.h11
-rw-r--r--src/dal/dataprovider.h1
-rw-r--r--src/dal/dataproviderfactory.h7
-rw-r--r--src/dal/mysqldataprovider.cpp4
-rw-r--r--src/dal/mysqldataprovider.h2
-rw-r--r--src/dal/pqdataprovider.h3
-rw-r--r--src/dal/recordset.cpp5
-rw-r--r--src/dal/recordset.h6
-rw-r--r--src/dal/sqlitedataprovider.cpp3
-rw-r--r--src/dal/sqlitedataprovider.h5
-rw-r--r--src/dalstorage.cpp7
-rw-r--r--src/dalstorage.h6
-rw-r--r--src/gamehandler.cpp7
-rw-r--r--src/gamehandler.h5
-rw-r--r--src/items.h1
-rw-r--r--src/map.cpp2
-rw-r--r--src/map.h1
-rw-r--r--src/mapmanager.cpp3
-rw-r--r--src/mapmanager.h3
-rw-r--r--src/mapreader.cpp11
-rw-r--r--src/mapreader.h2
-rw-r--r--src/messagehandler.cpp2
-rw-r--r--src/messagehandler.h4
-rw-r--r--src/messagein.cpp4
-rw-r--r--src/messagein.h5
-rw-r--r--src/messageout.cpp6
-rw-r--r--src/messageout.h4
-rw-r--r--src/netcomputer.cpp2
-rw-r--r--src/netcomputer.h5
-rw-r--r--src/netsession.cpp1
-rw-r--r--src/netsession.h10
-rw-r--r--src/object.h2
-rw-r--r--src/packet.cpp4
-rw-r--r--src/resourcemanager.cpp6
-rw-r--r--src/resourcemanager.h3
-rw-r--r--src/script.h28
-rw-r--r--src/skill.cpp73
-rw-r--r--src/skill.h10
-rw-r--r--src/sqlitestorage.cpp1
-rw-r--r--src/sqlitestorage.h3
-rw-r--r--src/state.cpp4
-rw-r--r--src/state.h8
-rw-r--r--src/storage.cpp5
-rw-r--r--src/utils/base64.cpp4
-rw-r--r--src/utils/cipher.cpp4
-rw-r--r--src/utils/cipher.h3
-rw-r--r--src/utils/logger.cpp3
-rw-r--r--src/utils/logger.h3
-rw-r--r--src/utils/stringfilter.cpp5
-rw-r--r--src/utils/stringfilter.h4
61 files changed, 226 insertions, 186 deletions
diff --git a/ChangeLog b/ChangeLog
index 9051b104..da310e01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2006-03-06 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/connectionhandler.h, src/storage.cpp, src/configuration.cpp,
+ src/script.h, src/messageout.cpp, src/map.cpp, src/messagein.h,
+ src/skill.h, src/messagehandler.h, src/resourcemanager.h,
+ src/netsession.cpp, src/accounthandler.cpp, src/dalstorage.h,
+ src/sqlitestorage.h, src/account.cpp, src/connectionhandler.cpp,
+ src/chatchannelmanager.cpp, src/netcomputer.h, src/messagein.cpp,
+ src/client.cpp, src/messageout.h, src/dalstorage.cpp,
+ src/netsession.h, src/accounthandler.h, src/mapreader.cpp,
+ src/account.h, src/netcomputer.cpp, src/mapmanager.cpp, src/object.h,
+ src/gamehandler.h, src/dal/mysqldataprovider.h, src/dal/recordset.h,
+ src/dal/dataproviderfactory.h, src/dal/sqlitedataprovider.cpp,
+ src/dal/dataprovider.h, src/dal/mysqldataprovider.cpp,
+ src/dal/pqdataprovider.h, src/dal/recordset.cpp,
+ src/dal/sqlitedataprovider.h, src/state.cpp, src/chathandler.h,
+ src/items.h, src/mapreader.h, src/packet.cpp, src/gamehandler.cpp,
+ src/mapmanager.h, src/chathandler.cpp, src/skill.cpp,
+ src/utils/cipher.h, src/utils/logger.cpp, src/utils/stringfilter.h,
+ src/utils/base64.cpp, src/utils/logger.h, src/utils/cipher.cpp,
+ src/utils/stringfilter.cpp, src/resourcemanager.cpp,
+ src/messagehandler.cpp, src/map.h, src/state.h, src/sqlitestorage.cpp:
+ Cleaned up unnecessary header dependencies and fixed some
+ indentations.
+
2006-03-05 Yohann Ferreira <bertram@cegetel.net>
* src/state.cpp, src/defines.h, src/chathandler.cpp,
diff --git a/src/account.cpp b/src/account.cpp
index 86815ed4..b5a7903b 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -20,12 +20,10 @@
* $Id$
*/
+#include "account.h"
-#include "utils/cipher.h"
#include "utils/functors.h"
-#include "account.h"
-
namespace tmwserv
{
diff --git a/src/account.h b/src/account.h
index 5cb57ede..2d9da17a 100644
--- a/src/account.h
+++ b/src/account.h
@@ -26,7 +26,6 @@
#include <string>
-#include <vector>
#include "being.h"
diff --git a/src/accounthandler.cpp b/src/accounthandler.cpp
index a0f6828a..90327118 100644
--- a/src/accounthandler.cpp
+++ b/src/accounthandler.cpp
@@ -22,12 +22,16 @@
*/
#include "accounthandler.h"
+
+#include "account.h"
+#include "configuration.h"
#include "connectionhandler.h"
#include "debug.h"
#include "storage.h"
-#include "account.h"
+#include "messagein.h"
#include "messageout.h"
-#include "configuration.h"
+#include "netcomputer.h"
+
#include "utils/logger.h"
#include "utils/stringfilter.h"
diff --git a/src/accounthandler.h b/src/accounthandler.h
index 14f13cf3..62d6e46f 100644
--- a/src/accounthandler.h
+++ b/src/accounthandler.h
@@ -25,9 +25,13 @@
#define _TMWSERV_ACCOUNTHANDLER_H_
#include "messagehandler.h"
-#include "netcomputer.h"
-#include "messagein.h"
-#include "account.h"
+
+class MessageIn;
+class NetComputer;
+
+namespace tmwserv {
+ class Account;
+}
/**
* Manages the data stored in user accounts and provides a reliable interface
diff --git a/src/chatchannelmanager.cpp b/src/chatchannelmanager.cpp
index 99458f47..05c9ea25 100644
--- a/src/chatchannelmanager.cpp
+++ b/src/chatchannelmanager.cpp
@@ -21,9 +21,10 @@
* $Id$
*/
+#include "chatchannelmanager.h"
+
#include <map>
-#include "chatchannelmanager.h"
#include "storage.h"
ChatChannelManager::ChatChannelManager()
diff --git a/src/chathandler.cpp b/src/chathandler.cpp
index 009a8b3b..05dc046f 100644
--- a/src/chathandler.cpp
+++ b/src/chathandler.cpp
@@ -22,12 +22,15 @@
*/
#include "chathandler.h"
-#include "state.h"
-#include "being.h"
-#include "defines.h"
+
+#include "chatchannelmanager.h"
+#include "connectionhandler.h"
+#include "messagein.h"
+#include "messageout.h"
+#include "netcomputer.h"
+
#include "utils/logger.h"
#include "utils/stringfilter.h"
-#include "chatchannelmanager.h"
void ChatHandler::receiveMessage(NetComputer &computer, MessageIn &message)
{
diff --git a/src/chathandler.h b/src/chathandler.h
index b4227207..6336c890 100644
--- a/src/chathandler.h
+++ b/src/chathandler.h
@@ -24,9 +24,12 @@
#ifndef _TMWSERV_CHATHANDLER_H_
#define _TMWSERV_CHATHANDLER_H_
+#include <iosfwd>
+
#include "messagehandler.h"
-#include "netcomputer.h"
-#include "messagein.h"
+
+class MessageIn;
+class NetComputer;
/**
* Manages all chat related
diff --git a/src/client.cpp b/src/client.cpp
index cf69b564..87646f10 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -20,12 +20,13 @@
* $Id$
*/
-#include <SDL.h>
-#include <SDL_net.h>
#include <iostream>
+#include <SDL_net.h>
+
#include "defines.h"
#include "messageout.h"
#include "messagein.h"
+#include "packet.h"
#if defined WIN32
#include "../testclient_private.h"
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 5f9caa2d..fd2bca41 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -23,16 +23,11 @@
#include "configuration.h"
-//#include "log.h"
-//#include "main.h"
-
-#include <math.h>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
+
+#include <cmath>
+
#include <libxml/xmlwriter.h>
+
#include "utils/logger.h"
// MSVC libxml2 at the moment doesn't work right when using MinGW, missing this
diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp
index a336a842..e3b30dde 100644
--- a/src/connectionhandler.cpp
+++ b/src/connectionhandler.cpp
@@ -20,14 +20,16 @@
* $Id$
*/
-
-#include <vector>
-#include <sstream>
-#include <SDL_net.h>
-
#include "connectionhandler.h"
-#include "netsession.h"
+
#include "chatchannelmanager.h"
+#include "messagehandler.h"
+#include "messagein.h"
+#include "messageout.h"
+#include "netcomputer.h"
+#include "netsession.h"
+#include "packet.h"
+
#include "utils/logger.h"
#ifdef SCRIPT_SUPPORT
diff --git a/src/connectionhandler.h b/src/connectionhandler.h
index c00abfc6..3eb4ac2c 100644
--- a/src/connectionhandler.h
+++ b/src/connectionhandler.h
@@ -24,16 +24,17 @@
#ifndef _TMWSERV_CONNECTIONHANDLER_H_
#define _TMWSERV_CONNECTIONHANDLER_H_
-#include "messagehandler.h"
-#include "netcomputer.h"
-#include "packet.h"
-#include "being.h"
-#include "messageout.h"
+#include <list>
#include <map>
#include <SDL_net.h>
+#include "being.h"
+
#define IN_BUFFER_SIZE 8192
+class MessageHandler;
+class MessageOut;
+class NetComputer;
// Forward declaration
class ListenThreadData;
diff --git a/src/dal/dataprovider.h b/src/dal/dataprovider.h
index 6687a749..fe034873 100644
--- a/src/dal/dataprovider.h
+++ b/src/dal/dataprovider.h
@@ -27,7 +27,6 @@
#include <string>
-#include "dalexcept.h"
#include "recordset.h"
diff --git a/src/dal/dataproviderfactory.h b/src/dal/dataproviderfactory.h
index 480f6da0..165113bd 100644
--- a/src/dal/dataproviderfactory.h
+++ b/src/dal/dataproviderfactory.h
@@ -20,20 +20,15 @@
* $Id$
*/
-
#ifndef _TMWSERV_DATA_PROVIDER_FACTORY_H_
#define _TMWSERV_DATA_PROVIDER_FACTORY_H_
-#include <stdexcept>
-
-#include "dataprovider.h"
-
-
namespace tmwserv
{
namespace dal
{
+ class DataProvider;
/**
diff --git a/src/dal/mysqldataprovider.cpp b/src/dal/mysqldataprovider.cpp
index d397253c..69b4937e 100644
--- a/src/dal/mysqldataprovider.cpp
+++ b/src/dal/mysqldataprovider.cpp
@@ -20,11 +20,9 @@
* $Id$
*/
-
-#include "dalexcept.h"
-
#include "mysqldataprovider.h"
+#include "dalexcept.h"
namespace tmwserv
{
diff --git a/src/dal/mysqldataprovider.h b/src/dal/mysqldataprovider.h
index 76194680..698c9fc5 100644
--- a/src/dal/mysqldataprovider.h
+++ b/src/dal/mysqldataprovider.h
@@ -25,7 +25,7 @@
#define _TMWSERV_MYSQL_DATA_PROVIDER_H_
-#include <string>
+#include <iosfwd>
#include <mysql/mysql.h>
diff --git a/src/dal/pqdataprovider.h b/src/dal/pqdataprovider.h
index 8b0c0bf6..73d5c8d7 100644
--- a/src/dal/pqdataprovider.h
+++ b/src/dal/pqdataprovider.h
@@ -25,8 +25,7 @@
#define _TMWSERV_PQDATAPROVIDER_H_
-#include <string>
-
+#include <iosfwd>
#include <libpq-fe.h>
#include "dataprovider.h"
diff --git a/src/dal/recordset.cpp b/src/dal/recordset.cpp
index f404c2a2..d59447c7 100644
--- a/src/dal/recordset.cpp
+++ b/src/dal/recordset.cpp
@@ -20,11 +20,12 @@
* $Id$
*/
+#include "recordset.h"
#include <sstream>
+#include <stdexcept>
-#include "recordset.h"
-
+#include "dalexcept.h"
namespace tmwserv
{
diff --git a/src/dal/recordset.h b/src/dal/recordset.h
index eac33cfd..0300c926 100644
--- a/src/dal/recordset.h
+++ b/src/dal/recordset.h
@@ -20,18 +20,12 @@
* $Id$
*/
-
#ifndef _TMWSERV_RECORDSET_H_
#define _TMWSERV_RECORDSET_H_
-
#include <iostream>
-#include <stdexcept>
#include <vector>
-#include "dalexcept.h"
-
-
namespace tmwserv
{
namespace dal
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp
index 2af82fcd..e0f67f55 100644
--- a/src/dal/sqlitedataprovider.cpp
+++ b/src/dal/sqlitedataprovider.cpp
@@ -23,6 +23,9 @@
#include "sqlitedataprovider.h"
+#include <stdexcept>
+
+#include "dalexcept.h"
namespace tmwserv
{
diff --git a/src/dal/sqlitedataprovider.h b/src/dal/sqlitedataprovider.h
index 384067c5..60ac7b6e 100644
--- a/src/dal/sqlitedataprovider.h
+++ b/src/dal/sqlitedataprovider.h
@@ -20,13 +20,10 @@
* $Id$
*/
-
#ifndef _TMWSERV_SQLITE_DATA_PROVIDER_H_
#define _TMWSERV_SQLITE_DATA_PROVIDER_H_
-
-#include <string>
-
+#include <iosfwd>
#include <sqlite3.h>
#include "dataprovider.h"
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp
index be5222dd..5d4f96a6 100644
--- a/src/dalstorage.cpp
+++ b/src/dalstorage.cpp
@@ -20,10 +20,13 @@
* $Id$
*/
-#include <sstream>
+#include "dalstorage.h"
#include "configuration.h"
-#include "dalstorage.h"
+#include "dalstoragesql.h"
+
+#include "dal/dalexcept.h"
+#include "dal/dataproviderfactory.h"
#include "utils/cipher.h"
#include "utils/functors.h"
diff --git a/src/dalstorage.h b/src/dalstorage.h
index 4e2768ab..e7b17022 100644
--- a/src/dalstorage.h
+++ b/src/dalstorage.h
@@ -24,13 +24,9 @@
#ifndef _TMWSERV_DALSTORAGE_H_
#define _TMWSERV_DALSTORAGE_H_
-
-#include <vector>
-
-#include "dal/dataproviderfactory.h"
-#include "dalstoragesql.h"
#include "storage.h"
+#include "dal/dataprovider.h"
namespace tmwserv
{
diff --git a/src/gamehandler.cpp b/src/gamehandler.cpp
index 4c7ae662..2ccaaabb 100644
--- a/src/gamehandler.cpp
+++ b/src/gamehandler.cpp
@@ -22,9 +22,14 @@
*/
#include "gamehandler.h"
-#include "messageout.h"
+
#include <iostream>
+#include "messagein.h"
+#include "messageout.h"
+#include "netcomputer.h"
+#include "packet.h"
+
void GameHandler::receiveMessage(NetComputer &computer, MessageIn &message)
{
if (computer.getCharacter().get() == NULL)
diff --git a/src/gamehandler.h b/src/gamehandler.h
index 46245bf4..4a017705 100644
--- a/src/gamehandler.h
+++ b/src/gamehandler.h
@@ -25,8 +25,9 @@
#define _TMW_SERVER_GAMEHANDLER_
#include "messagehandler.h"
-#include "netcomputer.h"
-#include "messagein.h"
+
+class MessageIn;
+class NetComputer;
/**
* Manage main game events & server processing.
diff --git a/src/items.h b/src/items.h
index c50da65e..0d8aefcc 100644
--- a/src/items.h
+++ b/src/items.h
@@ -24,7 +24,6 @@
#ifndef ITEMS_H
#define ITEMS_H
-#include "script.h"
#include "object.h"
namespace tmwserv
diff --git a/src/map.cpp b/src/map.cpp
index cb992de5..843e9664 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -25,6 +25,8 @@
#include <queue>
+#include "being.h"
+
namespace tmwserv
{
diff --git a/src/map.h b/src/map.h
index 99e0a2ad..e51572df 100644
--- a/src/map.h
+++ b/src/map.h
@@ -24,7 +24,6 @@
#ifndef _TMW_MAP_H
#define _TMW_MAP_H
-#include "being.h"
#include <list>
#include <map>
#include <string>
diff --git a/src/mapmanager.cpp b/src/mapmanager.cpp
index 73f8822e..caacbecc 100644
--- a/src/mapmanager.cpp
+++ b/src/mapmanager.cpp
@@ -22,8 +22,11 @@
*/
#include "mapmanager.h"
+
+#include "map.h"
#include "mapreader.h"
#include "storage.h"
+
#include "utils/logger.h"
namespace tmwserv
diff --git a/src/mapmanager.h b/src/mapmanager.h
index d516b4ce..14d0a159 100644
--- a/src/mapmanager.h
+++ b/src/mapmanager.h
@@ -26,12 +26,11 @@
#include <map>
-#include "map.h"
-
#include "utils/singleton.h"
namespace tmwserv
{
+ class Map;
/**
diff --git a/src/mapreader.cpp b/src/mapreader.cpp
index 1dd56eb7..5e213fd8 100644
--- a/src/mapreader.cpp
+++ b/src/mapreader.cpp
@@ -21,15 +21,16 @@
* $Id$
*/
-#include "utils/logger.h"
-#include "utils/base64.h"
#include "mapreader.h"
-#include "resourcemanager.h"
#include <cassert>
-
#include <zlib.h>
-#include <iostream>
+
+#include "map.h"
+#include "resourcemanager.h"
+
+#include "utils/base64.h"
+#include "utils/logger.h"
namespace tmwserv
{
diff --git a/src/mapreader.h b/src/mapreader.h
index 7d89a8a8..3ed67153 100644
--- a/src/mapreader.h
+++ b/src/mapreader.h
@@ -24,12 +24,12 @@
#ifndef _INCLUDED_MAPREADER_H
#define _INCLUDED_MAPREADER_H
-#include "map.h"
#include <libxml/tree.h>
#include <vector>
namespace tmwserv
{
+ class Map;
/**
diff --git a/src/messagehandler.cpp b/src/messagehandler.cpp
index a2517f39..ca4946ac 100644
--- a/src/messagehandler.cpp
+++ b/src/messagehandler.cpp
@@ -22,7 +22,7 @@
*/
#include "messagehandler.h"
-#include "debug.h"
+
#include "utils/logger.h"
void MessageHandler::receiveMessage(NetComputer &computer, MessageIn &message) {
diff --git a/src/messagehandler.h b/src/messagehandler.h
index 6949066f..022b6c5d 100644
--- a/src/messagehandler.h
+++ b/src/messagehandler.h
@@ -24,8 +24,8 @@
#ifndef _TMWSERV_MESSAGEHANDLER_H_
#define _TMWSERV_MESSAGEHANDLER_H_
-#include "netcomputer.h"
-#include "messagein.h"
+class MessageIn;
+class NetComputer;
/**
* This class represents the message handler interface. This interface is
diff --git a/src/messagein.cpp b/src/messagein.cpp
index 8434f301..88e673d7 100644
--- a/src/messagein.cpp
+++ b/src/messagein.cpp
@@ -22,7 +22,11 @@
*/
#include "messagein.h"
+
#include <SDL_net.h>
+#include <string>
+
+#include "packet.h"
MessageIn::MessageIn(Packet *packet):
mPacket(packet),
diff --git a/src/messagein.h b/src/messagein.h
index 02221efe..5d6d2278 100644
--- a/src/messagein.h
+++ b/src/messagein.h
@@ -24,8 +24,9 @@
#ifndef _TMWSERV_MESSAGEIN_H_
#define _TMWSERV_MESSAGEIN_H_
-#include "packet.h"
-#include <string>
+#include <iosfwd>
+
+class Packet;
/**
* Used for parsing an incoming message.
diff --git a/src/messageout.cpp b/src/messageout.cpp
index 63c69db4..e5400e64 100644
--- a/src/messageout.cpp
+++ b/src/messageout.cpp
@@ -22,8 +22,12 @@
*/
#include "messageout.h"
-#include <iostream>
+
+#include <cstdlib>
#include <SDL_net.h>
+#include <string>
+
+#include "packet.h"
MessageOut::MessageOut():
mPacket(0),
diff --git a/src/messageout.h b/src/messageout.h
index 5f8e364a..f13695ab 100644
--- a/src/messageout.h
+++ b/src/messageout.h
@@ -24,9 +24,9 @@
#ifndef _TMWSERV_MESSAGEOUT_H_
#define _TMWSERV_MESSAGEOUT_H_
-#include <string>
+#include <iosfwd>
-#include "packet.h"
+class Packet;
/**
* Used for building an outgoing message.
diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp
index 777610b4..f3f1aeb7 100644
--- a/src/netcomputer.cpp
+++ b/src/netcomputer.cpp
@@ -22,7 +22,9 @@
*/
#include "netcomputer.h"
+
#include "chatchannelmanager.h"
+#include "packet.h"
#include "state.h"
NetComputer::NetComputer(ConnectionHandler *handler, TCPsocket sock):
diff --git a/src/netcomputer.h b/src/netcomputer.h
index c6f2c5fc..89ad6ba7 100644
--- a/src/netcomputer.h
+++ b/src/netcomputer.h
@@ -24,17 +24,16 @@
#ifndef _TMWSERV_NETCOMPUTER_H_
#define _TMWSERV_NETCOMPUTER_H_
-#include "packet.h"
+#include <iosfwd>
#include <SDL_net.h>
-#include <string>
#include <queue>
-#include <list>
#include "account.h"
#include "being.h"
// Forward declaration
class ConnectionHandler;
+class Packet;
/**
* This class represents a known computer on the network. For example a
diff --git a/src/netsession.cpp b/src/netsession.cpp
index 130b18aa..23476f6d 100644
--- a/src/netsession.cpp
+++ b/src/netsession.cpp
@@ -23,6 +23,7 @@
#include "netsession.h"
+#include "connectionhandler.h"
/**
* This function is the new thread created to listen to a server socket. It
diff --git a/src/netsession.h b/src/netsession.h
index 36315177..b02b9ede 100644
--- a/src/netsession.h
+++ b/src/netsession.h
@@ -24,12 +24,12 @@
#ifndef _TMWSERV_NETSESSION_H_
#define _TMWSERV_NETSESSION_H_
-#include "netcomputer.h"
-#include "connectionhandler.h"
-#include <SDL.h>
-#include <SDL_thread.h>
-#include <SDL_net.h>
#include <map>
+#include <SDL_net.h>
+#include <SDL_thread.h>
+
+class ConnectionHandler;
+class NetComputer;
/**
* Data communicated to a new listen thread. The <code>running</code> member is
diff --git a/src/object.h b/src/object.h
index b8640285..17237be0 100644
--- a/src/object.h
+++ b/src/object.h
@@ -25,8 +25,8 @@
#define _TMWSERV_OBJECT_H_
#include <utility>
-#include <string>
#include <vector>
+
#include "utils/countedptr.h"
namespace tmwserv
diff --git a/src/packet.cpp b/src/packet.cpp
index 133c72a8..1994ef98 100644
--- a/src/packet.cpp
+++ b/src/packet.cpp
@@ -22,8 +22,8 @@
*/
#include "packet.h"
-#include <string.h>
-#include <cstdlib>
+
+#include <cstring>
Packet::Packet(const char *data, int length):
length(length)
diff --git a/src/resourcemanager.cpp b/src/resourcemanager.cpp
index 5f68d889..0ddf5931 100644
--- a/src/resourcemanager.cpp
+++ b/src/resourcemanager.cpp
@@ -22,12 +22,10 @@
*/
#include "resourcemanager.h"
-#include "utils/logger.h"
-#include <iostream>
-#include <sstream>
+
#include <physfs.h>
-#include <cassert>
+#include "utils/logger.h"
#ifdef WIN32
#include <io.h>
diff --git a/src/resourcemanager.h b/src/resourcemanager.h
index a7d37f54..97fb9956 100644
--- a/src/resourcemanager.h
+++ b/src/resourcemanager.h
@@ -24,8 +24,7 @@
#ifndef _TMW_RESOURCE_MANAGER_H
#define _TMW_RESOURCE_MANAGER_H
-#include <map>
-#include <string>
+#include <iosfwd>
#include <vector>
/**
diff --git a/src/script.h b/src/script.h
index d58ea9a1..ab851f38 100644
--- a/src/script.h
+++ b/src/script.h
@@ -26,7 +26,7 @@
#ifdef SCRIPT_SUPPORT
-#include <iostream>
+#include <string>
/*
* Script
@@ -43,25 +43,23 @@
*/
class Script
{
- protected:
- // Filename of the script corresponding to the script object
- std::string scriptName;
+ protected:
+ // Filename of the script corresponding to the script object
+ std::string scriptName;
- public:
- Script(const std::string &file)
- : scriptName(file)
- { }
+ public:
+ Script(const std::string &file):scriptName(file) { }
- virtual ~Script() { }
+ virtual ~Script() { }
- //State update
- virtual void update() = 0;
+ //State update
+ virtual void update() = 0;
- //Execute specified function
- virtual bool execute(const std::string &) = 0;
+ //Execute specified function
+ virtual bool execute(const std::string &) = 0;
- //Script sent raw message
- virtual void message(char *) = 0;
+ //Script sent raw message
+ virtual void message(char *) = 0;
};
extern Script *script; // Global script (temporary?
diff --git a/src/skill.cpp b/src/skill.cpp
index fab74163..6990a348 100644
--- a/src/skill.cpp
+++ b/src/skill.cpp
@@ -20,48 +20,50 @@
* $Id$
*/
-
#include "skill.h"
-#include "utils/logger.h"
+#include "utils/logger.h"
Skill::Skill(const std::string &ident) :
- id(ident),
- light(0.0),
- dark(0.0)
+ id(ident),
+ light(0.0),
+ dark(0.0)
{
//
}
-Skill::~Skill() {
+Skill::~Skill()
+{
//cleanup
for (unsigned int i = 0; i < children.size(); i++) {
- if (children[i])
- delete children[i];
+ if (children[i])
+ delete children[i];
}
}
-bool Skill::addSkill(const std::string &ident, Skill *skill) {
+bool Skill::addSkill(const std::string &ident, Skill *skill)
+{
if (ident == id) {
- //add skill to children
- children.push_back(skill);
- return true;
+ //add skill to children
+ children.push_back(skill);
+ return true;
}
for (unsigned int i = 0; i < children.size(); i++) {
- //recurse
- if (children[i]->addSkill(ident, skill))
- return true;
+ //recurse
+ if (children[i]->addSkill(ident, skill))
+ return true;
}
return false;
}
-bool Skill::useSkill() {
+bool Skill::useSkill()
+{
#ifdef SCRIPT_SUPPORT
//run skill script
- LOG_ERROR("Skill: Skills not implemented.", 0)
+ LOG_ERROR("Skill: Skills not implemented.", 0);
#else
- LOG_ERROR("Skill: Could not use skill; scripting disabled.", 0)
+ LOG_ERROR("Skill: Could not use skill; scripting disabled.", 0);
#endif
return true;
}
@@ -71,30 +73,31 @@ bool Skill::setScript(const std::string &scriptName)
return true;
}
-bool Skill::deleteSkill(const std::string &ident, bool delTree) {
+bool Skill::deleteSkill(const std::string &ident, bool delTree)
+{
//prevent deletion of self
if (ident == id) {
LOG_ERROR("Skill: Attempt to delete self.", 0)
- return false;
+ return false;
}
for (unsigned int i = 0; i < children.size(); i++) {
- if (children[i]->id == ident) {
- if (children[i]->children.size() > 0 && delTree)
- return false;
- else {
- //delete skill & remove from children
- std::vector<Skill*>::iterator tmp = children.begin() + i;
- delete children[i];
- children.erase(tmp);
+ if (children[i]->id == ident) {
+ if (children[i]->children.size() > 0 && delTree)
+ return false;
+ else {
+ //delete skill & remove from children
+ std::vector<Skill*>::iterator tmp = children.begin() + i;
+ delete children[i];
+ children.erase(tmp);
- return true;
- }
- } else {
- //recurse
- if (children[i]->deleteSkill(ident))
- return true;
- }
+ return true;
+ }
+ } else {
+ //recurse
+ if (children[i]->deleteSkill(ident))
+ return true;
+ }
}
return false;
}
diff --git a/src/skill.h b/src/skill.h
index cfaeae8e..301baa8c 100644
--- a/src/skill.h
+++ b/src/skill.h
@@ -94,13 +94,13 @@ class Skill
/*
* printTree
- * Print tree to stdout
+ * Print tree to stderr
*/
void printTree(const std::string &indent) {
- std::cerr << indent << id << std::endl;
- for (unsigned int i = 0; i < children.size(); i++) {
- children[i]->printTree(indent + " ");
- }
+ std::cerr << indent << id << std::endl;
+ for (unsigned int i = 0; i < children.size(); i++) {
+ children[i]->printTree(indent + " ");
+ }
}
};
diff --git a/src/sqlitestorage.cpp b/src/sqlitestorage.cpp
index f6086689..f9d06c9b 100644
--- a/src/sqlitestorage.cpp
+++ b/src/sqlitestorage.cpp
@@ -22,6 +22,7 @@
*/
#include "sqlitestorage.h"
+
#include <iostream>
#include <sstream>
diff --git a/src/sqlitestorage.h b/src/sqlitestorage.h
index 81c53f8c..f2158e02 100644
--- a/src/sqlitestorage.h
+++ b/src/sqlitestorage.h
@@ -24,9 +24,10 @@
#ifndef _TMWSERV_SQLITESTORAGE_H_
#define _TMWSERV_SQLITESTORAGE_H_
-#include "sqlite/SQLiteWrapper.h"
#include "storage.h"
+#include "sqlite/SQLiteWrapper.h"
+
/**
* SQLite implemention of persistent dynamic data storage.
*/
diff --git a/src/state.cpp b/src/state.cpp
index a708911b..b7bc7bf4 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -23,8 +23,8 @@
#include "state.h"
-#include <iostream>
-
+#include "connectionhandler.h"
+#include "map.h"
#include "mapmanager.h"
#include "messageout.h"
diff --git a/src/state.h b/src/state.h
index ba32bdcd..65acf4bb 100644
--- a/src/state.h
+++ b/src/state.h
@@ -24,15 +24,17 @@
#ifndef _TMW_SERVER_STATE_
#define _TMW_SERVER_STATE_
-#include <string>
#include <map>
-#include "connectionhandler.h"
+
#include "being.h"
-#include "map.h"
+
#include "utils/singleton.h"
+class ConnectionHandler;
+
namespace tmwserv
{
+ class Map;
/**
* Combined map/entity structure
diff --git a/src/storage.cpp b/src/storage.cpp
index d2a875b1..0ba23616 100644
--- a/src/storage.cpp
+++ b/src/storage.cpp
@@ -20,12 +20,9 @@
* $Id$
*/
-
-#include <stdexcept>
-
#include "storage.h"
-#include "dalstorage.h"
+#include "dalstorage.h"
namespace tmwserv
{
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index e2df07de..973376e4 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -17,8 +17,8 @@
*/
/* $Id$ */
-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
#include "base64.h"
diff --git a/src/utils/cipher.cpp b/src/utils/cipher.cpp
index 1b232e7e..6eda3ec5 100644
--- a/src/utils/cipher.cpp
+++ b/src/utils/cipher.cpp
@@ -20,6 +20,7 @@
* $Id$
*/
+#include "cipher.h"
#include <iomanip>
#include <sstream>
@@ -27,9 +28,6 @@
#include <openssl/evp.h>
#include <openssl/md5.h>
-#include "cipher.h"
-
-
namespace tmwserv
{
namespace utils
diff --git a/src/utils/cipher.h b/src/utils/cipher.h
index a6e6c552..bfca4cb1 100644
--- a/src/utils/cipher.h
+++ b/src/utils/cipher.h
@@ -24,8 +24,7 @@
#ifndef _TMWSERV_CIPHER_H_
#define _TMWSERV_CIPHER_H_
-
-#include <string>
+#include <iosfwd>
#include "singleton.h"
diff --git a/src/utils/logger.cpp b/src/utils/logger.cpp
index 048fd5b1..cd620f69 100644
--- a/src/utils/logger.cpp
+++ b/src/utils/logger.cpp
@@ -20,6 +20,7 @@
* $Id$
*/
+#include "logger.h"
#include <ctime>
#include <iomanip>
@@ -29,8 +30,6 @@
#include <windows.h>
#endif
-#include "logger.h"
-
namespace tmwserv
{
diff --git a/src/utils/logger.h b/src/utils/logger.h
index 75c86593..1e5ba27d 100644
--- a/src/utils/logger.h
+++ b/src/utils/logger.h
@@ -24,10 +24,9 @@
#ifndef _TMWSERV_LOGGER_H_
#define _TMWSERV_LOGGER_H_
-
+#include <iosfwd>
#include <fstream>
#include <sstream>
-#include <string>
#include "singleton.h"
diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp
index 3e72a278..fc9ed1ea 100644
--- a/src/utils/stringfilter.cpp
+++ b/src/utils/stringfilter.cpp
@@ -20,10 +20,13 @@
* $Id$
*/
-#include "../defines.h"
#include "stringfilter.h"
+
#include "logger.h"
+#include "../configuration.h"
+#include "../defines.h"
+
namespace tmwserv
{
namespace utils
diff --git a/src/utils/stringfilter.h b/src/utils/stringfilter.h
index 009bbeb4..e38d1931 100644
--- a/src/utils/stringfilter.h
+++ b/src/utils/stringfilter.h
@@ -24,8 +24,10 @@
#ifndef _TMWSERV_SLANGSFILTER_H_
#define _TMWSERV_SLANGSFILTER_H_
+#include <list>
#include <string>
-#include "../configuration.h"
+
+class Configuration;
namespace tmwserv
{