summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/debug.cpp68
-rw-r--r--src/debug.h43
-rw-r--r--src/messagehandler.cpp61
-rw-r--r--src/messagehandler.h3
-rw-r--r--src/tmwserv.dev219
5 files changed, 394 insertions, 0 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
new file mode 100644
index 00000000..b601ac0c
--- /dev/null
+++ b/src/debug.cpp
@@ -0,0 +1,68 @@
+/*
+ * The Mana World Server
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+ // This file contains debugging global functions
+
+#include "debug.h"
+
+// global debugging flag (set to false in release version)
+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)
+ return; // break out if we are not debugging
+
+
+ switch(result)
+ {
+ case TMW_SUCCESS: // function successful
+ return;
+ break;
+ case TMW_ACCOUNTERROR_NOEXIST: // account does not exist
+ // show the programmer a message
+ break;
+ case TMW_ACCOUNTERROR_BANNED: // account is banned
+ // show the programmer a message
+ break;
+ case TMW_ACCOUNTERROR_ALREADYASSIGNED: // account is in use
+ // show the programmer a message (this may signal a logout bug
+ break;
+ case TMW_ACCOUNTERROR_CHARNOTFOUND: // the character is not found
+ // show a message
+ break;
+ case TMW_ACCOUNTERROR_ASSIGNFAILED: // failed to assign the handle to the user
+ // show a message
+ break;
+ }
+
+} \ No newline at end of file
diff --git a/src/debug.h b/src/debug.h
new file mode 100644
index 00000000..8fdd19ab
--- /dev/null
+++ b/src/debug.h
@@ -0,0 +1,43 @@
+/*
+ * The Mana World Server
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+ // This file defines the return types for debugging
+
+// (PASTE THE LINE BELOW to include debug support in your file)
+//
+// extern void debugCatch(int result);
+//
+
+
+// message handler definitions
+// add your definitions to this list, sorted by type. Each group starts with a
+// different multiple of 100
+
+ // GENERAL
+#define TMW_SUCCESS 1 // the function completed successfully
+
+ // ACCOUNT
+#define TMW_ACCOUNTERROR_NOEXIST 101
+#define TMW_ACCOUNTERROR_BANNED 101
+#define TMW_ACCOUNTERROR_ALREADYASSIGNED 102
+#define TMW_ACCOUNTERROR_CHARNOTFOUND 103
+#defire TMW_ACCOUNTERROR_ASSIGNFAILED 104
diff --git a/src/messagehandler.cpp b/src/messagehandler.cpp
index e7b548a1..bf176124 100644
--- a/src/messagehandler.cpp
+++ b/src/messagehandler.cpp
@@ -23,3 +23,64 @@
#include "messagehandler.h"
+extern void debugCatch(int result)
+
+/* 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
+ /* switch(message.type)
+ * {
+ * case: TYPE_LOGIN
+ * result = loginMessage(computer, message);
+ * break;
+ * }
+ */
+
+ debugCatch(result);
+}
+
+
+
+/* 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.
+ * The character profile is valid
+ * 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
+ // RETURN TMW_ACCOUNTERROR_ALREADYASSIGNED if: the handle is already assigned
+
+ // Get the character within that handle that the player is requesting
+ // RETURN TMW_ACCOUNTERROR_CHARNOTFOUND if: character not found
+
+ // Assign the player to that character
+ // RETURN TMW_ACCOUNTERROR_ASSIGNFAILED if: assignment not successful
+
+ // return TMW_SUCCESS -- successful exit
+
+}
+
diff --git a/src/messagehandler.h b/src/messagehandler.h
index f52c61a6..b628f4f3 100644
--- a/src/messagehandler.h
+++ b/src/messagehandler.h
@@ -26,6 +26,8 @@
#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
@@ -45,6 +47,7 @@ class MessageHandler
* methods to convenient parse and build packets transparently.
*/
void receiveMessage(NetComputer *computer, MessageIn &message);
+ void loginMessage(NetComputer *computer, MessageIn &message);
};
#endif
diff --git a/src/tmwserv.dev b/src/tmwserv.dev
new file mode 100644
index 00000000..45e38318
--- /dev/null
+++ b/src/tmwserv.dev
@@ -0,0 +1,219 @@
+[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=
+