summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-21 13:30:58 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-21 13:30:58 +0000
commit28f6096586bf4e3465140f48f1eae54f11fef88d (patch)
treecad019bc88da694a12706c0cf23ef48e4a84f6df
parent995eea38b362e9c57abfb5354a8b6e1af6dd3637 (diff)
downloadmanaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.tar.gz
manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.tar.xz
manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.zip
Some header fixes, formatting conventions and moved DevCpp project file.
-rw-r--r--AUTHORS1
-rw-r--r--src/connectionhandler.h1
-rw-r--r--src/debug.cpp19
-rw-r--r--src/debug.h17
-rw-r--r--src/messagehandler.cpp14
-rw-r--r--src/messagehandler.h4
-rw-r--r--src/messagein.h5
-rw-r--r--src/messageout.h5
-rw-r--r--src/netcomputer.h1
-rw-r--r--src/netsession.h1
-rw-r--r--src/packet.h5
-rw-r--r--tmwserv.dev (renamed from src/tmwserv.dev)34
12 files changed, 55 insertions, 52 deletions
diff --git a/AUTHORS b/AUTHORS
index 7276b77..1de82bf 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,2 @@
Bjorn 'Hammerbear' Lindeijer <b_lindeijer@users.sourceforge.net>
+Kiyoshi Kyokai <kyokai@users.sourceforge.net>
diff --git a/src/connectionhandler.h b/src/connectionhandler.h
index 20ce932..d8bdba9 100644
--- a/src/connectionhandler.h
+++ b/src/connectionhandler.h
@@ -22,6 +22,7 @@
*/
#ifndef _TMW_SERVER_CONNECTIONHANDLER_
+#define _TMW_SERVER_CONNECTIONHANDLER_
#include "netcomputer.h"
#include "packet.h"
diff --git a/src/debug.cpp b/src/debug.cpp
index b601ac0..09b730a 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -25,25 +25,17 @@
#include "debug.h"
// global debugging flag (set to false in release version)
-int debugflag=false;
+int debugflag = false;
-
-/* debugCatch
- * returns a message on function failure if the debug flag is set to true
- * Execution: O(1) -- Linear
- * Preconditions: TRUE
- * Postconditions: TRUE
- * --- by Kyokai
- */
-
void debugCatch(int result)
{
- if(!debugflag)
+ if (!debugflag) {
return; // break out if we are not debugging
+ }
- switch(result)
+ switch (result)
{
case TMW_SUCCESS: // function successful
return;
@@ -64,5 +56,4 @@ void debugCatch(int result)
// show a message
break;
}
-
-} \ No newline at end of file
+}
diff --git a/src/debug.h b/src/debug.h
index 8fdd19a..754fe27 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -19,13 +19,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
+
+#ifndef _TMW_SERVER_DEBUG_
+#define _TMW_SERVER_DEBUG_
- // This file defines the return types for debugging
+// This file defines the return types for debugging
-// (PASTE THE LINE BELOW to include debug support in your file)
-//
-// extern void debugCatch(int result);
-//
+/**
+ * Returns a message on function failure if the debug flag is set to true.
+ */
+extern void debugCatch(int result);
// message handler definitions
@@ -40,4 +43,6 @@
#define TMW_ACCOUNTERROR_BANNED 101
#define TMW_ACCOUNTERROR_ALREADYASSIGNED 102
#define TMW_ACCOUNTERROR_CHARNOTFOUND 103
-#defire TMW_ACCOUNTERROR_ASSIGNFAILED 104
+#define TMW_ACCOUNTERROR_ASSIGNFAILED 104
+
+#endif
diff --git a/src/messagehandler.cpp b/src/messagehandler.cpp
index bf17612..cc79d45 100644
--- a/src/messagehandler.cpp
+++ b/src/messagehandler.cpp
@@ -22,22 +22,16 @@
*/
#include "messagehandler.h"
-
-extern void debugCatch(int result)
+#include "debug.h"
/* recieveMessage
* This function recieves a message, then sends it to the appropriate handler
* sub-routine for processing.
- * Execution: O(x) -- Variable
* Preconditions: valid parameters, queue initialized, etc.
* Postconditions: message successfully processed.
- * --- by Kyokai
*/
void MessageHandler::receiveMessage(NetComputer *computer, MessageIn &message)
{
- // ASSERT: valid computer
- // ASSERT: valid message
-
int result = 0;
// determine message type
@@ -53,10 +47,8 @@ void MessageHandler::receiveMessage(NetComputer *computer, MessageIn &message)
}
-
/* loginMessage
* Accepts a login message and interprets it, assigning the proper login
- * Execution: O(n) -- Linear by (number of accounts)
* Preconditions: The requested handle is not logged in already.
* The requested handle exists.
* The requested handle is not banned or restricted.
@@ -64,11 +56,9 @@ void MessageHandler::receiveMessage(NetComputer *computer, MessageIn &message)
* Postconditions: the player recieves access through a character in the world.
* Return Value: SUCCESS if the player was successfully assigned the requested char
* ERROR on early termination of the routine.
- * --- by Kyokai
*/
int MessageHandler::loginMessage(NetComputer *computer, MessageIn &message)
{
-
// Get the handle (account) the player is requesting
// RETURN TMW_ACCOUNTERROR_NOEXIST if: requested does not handle exist
// RETURN TMW_ACCOUNTERROR_BANNED if: the handle status is HANDLE_STATUS_BANNED
@@ -81,6 +71,4 @@ int MessageHandler::loginMessage(NetComputer *computer, MessageIn &message)
// RETURN TMW_ACCOUNTERROR_ASSIGNFAILED if: assignment not successful
// return TMW_SUCCESS -- successful exit
-
}
-
diff --git a/src/messagehandler.h b/src/messagehandler.h
index b628f4f..3d9e8a5 100644
--- a/src/messagehandler.h
+++ b/src/messagehandler.h
@@ -22,12 +22,11 @@
*/
#ifndef _TMW_SERVER_MESSAGEHANDLER_
+#define _TMW_SERVER_MESSAGEHANDLER_
#include "netcomputer.h"
#include "messagein.h"
-#include "debug.h"
-
/**
* This class represents the message handler interface. This interface is
* implemented by classes that mean to handle a certain subset of the incoming
@@ -47,6 +46,7 @@ class MessageHandler
* methods to convenient parse and build packets transparently.
*/
void receiveMessage(NetComputer *computer, MessageIn &message);
+
void loginMessage(NetComputer *computer, MessageIn &message);
};
diff --git a/src/messagein.h b/src/messagein.h
index d731cdc..92a0a22 100644
--- a/src/messagein.h
+++ b/src/messagein.h
@@ -21,6 +21,9 @@
* $Id$
*/
+#ifndef _TMW_SERVER_MESSAGEIN_
+#define _TMW_SERVER_MESSAGEIN_
+
#include "packet.h"
/**
@@ -49,3 +52,5 @@ class MessageIn
Packet *packet;
unsigned int pos;
};
+
+#endif
diff --git a/src/messageout.h b/src/messageout.h
index 8911963..88f5790 100644
--- a/src/messageout.h
+++ b/src/messageout.h
@@ -21,6 +21,9 @@
* $Id$
*/
+#ifndef _TMW_SERVER_MESSAGEOUT_
+#define _TMW_SERVER_MESSAGEOUT_
+
#include "packet.h"
class MessageOut
@@ -55,3 +58,5 @@ class MessageOut
private:
Packet *packet; /**< Created packet. */
};
+
+#endif
diff --git a/src/netcomputer.h b/src/netcomputer.h
index 37224f5..be73094 100644
--- a/src/netcomputer.h
+++ b/src/netcomputer.h
@@ -22,6 +22,7 @@
*/
#ifndef _TMW_SERVER_NETCOMPUTER_
+#define _TMW_SERVER_NETCOMPUTER_
// Forward declaration
class NetSession;
diff --git a/src/netsession.h b/src/netsession.h
index 67baf7f..c0c92b2 100644
--- a/src/netsession.h
+++ b/src/netsession.h
@@ -22,6 +22,7 @@
*/
#ifndef _TMW_SERVER_NETSESSION_
+#define _TMW_SERVER_NETSESSION_
#include "netcomputer.h"
#include "connectionhandler.h"
diff --git a/src/packet.h b/src/packet.h
index 5bb910a..4e1d48c 100644
--- a/src/packet.h
+++ b/src/packet.h
@@ -21,6 +21,9 @@
* $Id$
*/
+#ifndef _TMW_SERVER_PACKET_
+#define _TMW_SERVER_PACKET_
+
/**
* A packet wraps a certain amount of bytes for sending and receiving.
*/
@@ -40,3 +43,5 @@ class Packet
char *data; /**< Packet data */
unsigned int length; /**< Length of data in bytes */
};
+
+#endif
diff --git a/src/tmwserv.dev b/tmwserv.dev
index 45e3831..995dcc4 100644
--- a/src/tmwserv.dev
+++ b/tmwserv.dev
@@ -30,7 +30,7 @@ CompilerSet=0
CompilerSettings=
[Unit1]
-FileName=connectionhandler.cpp
+FileName=src\connectionhandler.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -40,7 +40,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit2]
-FileName=connectionhandler.h
+FileName=src\connectionhandler.h
CompileCpp=1
Folder=header
Compile=1
@@ -50,7 +50,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit3]
-FileName=main.cpp
+FileName=src\main.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -60,7 +60,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit4]
-FileName=messagehandler.cpp
+FileName=src\messagehandler.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -70,7 +70,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit5]
-FileName=messagehandler.h
+FileName=src\messagehandler.h
CompileCpp=1
Folder=header
Compile=1
@@ -80,7 +80,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit6]
-FileName=messagein.cpp
+FileName=src\messagein.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -90,7 +90,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit7]
-FileName=messagein.h
+FileName=src\messagein.h
CompileCpp=1
Folder=header
Compile=1
@@ -100,7 +100,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit8]
-FileName=messageout.cpp
+FileName=src\messageout.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -110,7 +110,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit9]
-FileName=messageout.h
+FileName=src\messageout.h
CompileCpp=1
Folder=header
Compile=1
@@ -120,7 +120,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit10]
-FileName=netcomputer.cpp
+FileName=src\netcomputer.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -130,7 +130,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit11]
-FileName=netcomputer.h
+FileName=src\netcomputer.h
CompileCpp=1
Folder=header
Compile=1
@@ -140,7 +140,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit12]
-FileName=netsession.cpp
+FileName=src\netsession.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -150,7 +150,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit13]
-FileName=netsession.h
+FileName=src\netsession.h
CompileCpp=1
Folder=header
Compile=1
@@ -160,7 +160,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit14]
-FileName=packet.cpp
+FileName=src\packet.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -170,7 +170,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit15]
-FileName=packet.h
+FileName=src\packet.h
CompileCpp=1
Folder=header
Compile=1
@@ -198,7 +198,7 @@ ProductVersion=
AutoIncBuildNr=0
[Unit16]
-FileName=debug.cpp
+FileName=src\debug.cpp
CompileCpp=1
Folder=source
Compile=1
@@ -208,7 +208,7 @@ OverrideBuildCmd=0
BuildCmd=
[Unit17]
-FileName=debug.h
+FileName=src\debug.h
CompileCpp=1
Folder=header
Compile=1