summaryrefslogtreecommitdiff
path: root/src/messagehandler.cpp
diff options
context:
space:
mode:
authorKiyoshi Kyokai <kiyoshi.kyokai@gmail.com>2005-03-21 05:52:34 +0000
committerKiyoshi Kyokai <kiyoshi.kyokai@gmail.com>2005-03-21 05:52:34 +0000
commit995eea38b362e9c57abfb5354a8b6e1af6dd3637 (patch)
tree616265768f4115184fb45e1f8a770aa0005d15d5 /src/messagehandler.cpp
parent6c44d26e31ac6b4c4c59052034d8ce64b1fd0507 (diff)
downloadmanaserv-995eea38b362e9c57abfb5354a8b6e1af6dd3637.tar.gz
manaserv-995eea38b362e9c57abfb5354a8b6e1af6dd3637.tar.bz2
manaserv-995eea38b362e9c57abfb5354a8b6e1af6dd3637.tar.xz
manaserv-995eea38b362e9c57abfb5354a8b6e1af6dd3637.zip
I've added the shell for the login and message handler functions, as well as debug support for logging in. Noticed we still need an account class to store the account data. Perhaps I'll work on that tommorrow.
Diffstat (limited to 'src/messagehandler.cpp')
-rw-r--r--src/messagehandler.cpp61
1 files changed, 61 insertions, 0 deletions
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
+
+}
+