diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-03-21 13:30:58 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-03-21 13:30:58 +0000 |
commit | 28f6096586bf4e3465140f48f1eae54f11fef88d (patch) | |
tree | cad019bc88da694a12706c0cf23ef48e4a84f6df /src | |
parent | 995eea38b362e9c57abfb5354a8b6e1af6dd3637 (diff) | |
download | manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.tar.gz manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.tar.bz2 manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.tar.xz manaserv-28f6096586bf4e3465140f48f1eae54f11fef88d.zip |
Some header fixes, formatting conventions and moved DevCpp project file.
Diffstat (limited to 'src')
-rw-r--r-- | src/connectionhandler.h | 1 | ||||
-rw-r--r-- | src/debug.cpp | 19 | ||||
-rw-r--r-- | src/debug.h | 17 | ||||
-rw-r--r-- | src/messagehandler.cpp | 14 | ||||
-rw-r--r-- | src/messagehandler.h | 4 | ||||
-rw-r--r-- | src/messagein.h | 5 | ||||
-rw-r--r-- | src/messageout.h | 5 | ||||
-rw-r--r-- | src/netcomputer.h | 1 | ||||
-rw-r--r-- | src/netsession.h | 1 | ||||
-rw-r--r-- | src/packet.h | 5 | ||||
-rw-r--r-- | src/tmwserv.dev | 219 |
11 files changed, 37 insertions, 254 deletions
diff --git a/src/connectionhandler.h b/src/connectionhandler.h index 20ce9321..d8bdba91 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 b601ac0c..09b730a8 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 8fdd19ab..754fe277 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 bf176124..cc79d45e 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 b628f4f3..3d9e8a50 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 d731cdc1..92a0a22c 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 89119632..88f57903 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 37224f5f..be730941 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 67baf7fe..c0c92b2a 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 5bb910ac..4e1d48c5 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/src/tmwserv.dev deleted file mode 100644 index 45e38318..00000000 --- a/src/tmwserv.dev +++ /dev/null @@ -1,219 +0,0 @@ -[Project] -FileName=tmwserv.dev -Name=Project1 -UnitCount=17 -Type=1 -Ver=1 -ObjFiles= -Includes= -Libs= -PrivateResource= -ResourceIncludes= -MakeIncludes= -Compiler= -CppCompiler= -Linker= -IsCpp=1 -Icon= -ExeOutput= -ObjectOutput= -OverrideOutput=0 -OverrideOutputName= -HostApplication= -Folders=header,source -CommandLine= -UseCustomMakefile=0 -CustomMakefile= -IncludeVersionInfo=0 -SupportXPThemes=0 -CompilerSet=0 -CompilerSettings= - -[Unit1] -FileName=connectionhandler.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit2] -FileName=connectionhandler.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit3] -FileName=main.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit4] -FileName=messagehandler.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit5] -FileName=messagehandler.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit6] -FileName=messagein.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit7] -FileName=messagein.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit8] -FileName=messageout.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit9] -FileName=messageout.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit10] -FileName=netcomputer.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit11] -FileName=netcomputer.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit12] -FileName=netsession.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit13] -FileName=netsession.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit14] -FileName=packet.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit15] -FileName=packet.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[VersionInfo] -Major=0 -Minor=1 -Release=1 -Build=1 -LanguageID=1033 -CharsetID=1252 -CompanyName= -FileVersion= -FileDescription=Developed using the Dev-C++ IDE -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion= -AutoIncBuildNr=0 - -[Unit16] -FileName=debug.cpp -CompileCpp=1 -Folder=source -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - -[Unit17] -FileName=debug.h -CompileCpp=1 -Folder=header -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - |