summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/account.h4
-rw-r--r--src/accounthandler.cpp3
-rw-r--r--src/accounthandler.h4
-rw-r--r--src/defines.h72
-rw-r--r--src/messageout.h4
5 files changed, 34 insertions, 53 deletions
diff --git a/src/account.h b/src/account.h
index aa1590c3..62c0ec7c 100644
--- a/src/account.h
+++ b/src/account.h
@@ -31,10 +31,6 @@
#include "object.h"
-// kindjal: are we actually using this?
-#define ACC_MAX_CHARS 4
-
-
namespace tmwserv
{
diff --git a/src/accounthandler.cpp b/src/accounthandler.cpp
index 40fca0f8..ec862532 100644
--- a/src/accounthandler.cpp
+++ b/src/accounthandler.cpp
@@ -87,7 +87,8 @@ int AccountHandler::loginMessage(NetComputer &computer, MessageIn &message)
* requested handle, ERROR on early termination of the
* routine.
*/
-int AccountHandler::assignAccount(NetComputer &computer, AccountData *account)
+int
+AccountHandler::assignAccount(NetComputer &computer, tmwserv::Account *account)
{
// RETURN TMW_ACCOUNTERROR_ASSIGNFAILED if: the account was accessed before
// being initalized.
diff --git a/src/accounthandler.h b/src/accounthandler.h
index c2f7f182..b9460cc2 100644
--- a/src/accounthandler.h
+++ b/src/accounthandler.h
@@ -28,7 +28,7 @@
#include "messagehandler.h"
#include "netcomputer.h"
#include "messagein.h"
-#include "defines.h"
+#include "account.h"
/**
* Manages the data stored in user accounts and provides a reliable interface
@@ -55,7 +55,7 @@ class AccountHandler : public MessageHandler
/**
* Account assignment.
*/
- int assignAccount(NetComputer &computer, AccountData *account);
+ int assignAccount(NetComputer &computer, tmwserv::Account *account);
};
#endif
diff --git a/src/defines.h b/src/defines.h
index 8bd2e94b..ff670b86 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -27,50 +27,32 @@
#include <string>
#include "object.h"
-// this file holds the global definitions and constants to be included
-// in multiple places throughout the server
-
-// debug and error definitions go in debug.h, not here
-
-
-// I. ACCOUNT DEFINITIONS
-
-// A. Account Types
-
-#define STATUS_NORMAL 0 // denotes normal account status
-#define STATUS_ADMIN 1 // denotes admin acount status
-#define STATUS_GM 2 // denotes GM account status
-#define STATUS_BANNED 3 // denotes a temporarily banned account
-#define STATUS_RESTRICTED 4 // denotes a restricted access account
-
-// Player Gender
-#define GENDER_MALE 0 // denotes male gender
-#define GENDER_FEMALE 1 // denotes female gender
-#define GENDER_UNKNOWN 2 // denotes unkown gender (possibly for some monsters?)
+/**
+ * Enumeration type for account levels.
+ *
+ * Note the the actual tasks that can be done by admin or gm, or the
+ * restrictions on a restricted user, are not specified yet. Also, banned
+ * status will probably be derived from a date field (the time until an account
+ * is banned).
+ *
+ * It may be better to wait and see what permissions we'd want to grant to or
+ * take from users, and then come up with a convenient way to handle that.
+ */
+typedef enum {
+ AL_NORMAL, // User has regular rights
+ AL_ADMIN, // User can perform administrator tasks
+ AL_GM, // User can perform a subset of administrator tasks
+ AL_BANNED, // This user is currently banned
+ AL_RESTRICTED // User rights have been restricted
+} AccountLevels;
+
+/**
+ * Enumeration type for the player genders.
+ */
+typedef enum {
+ GENDER_MALE,
+ GENDER_FEMALE,
+ GENDER_UNKNOWN
+} Genders;
-// DATA STRUCTURES DEFINITIONS
-
-// persistent character data
-struct CharData
-{
- Being player; // player information
- //std::string charName; // (depreciated :) now in player.name
- //equipData charEquip; // structure of equipped items (check Being)
- //estateData charEstate; // character's estate data (check Being)
- Being charPet[3]; // character's pets (using generic being object)
- //petData charPet[3]; // character's pets (depreciated :)
- //itemData charItem; // character's inventory (check Being)
- //graphicData charGraphic; // character's appearance (should be in Being)
-};
-
-// Account Data Structure
-struct AccountData
-{
- std::string accountID; // the account's ID
- std::string accountEMail; // the email of the account's owner
- std::string accountPass; // the account's password
- int accountStatus; // the account's status: normal, gm, banned, etc.
- CharData accountChar[5]; // the characters stored in the account.
-};
-
#endif
diff --git a/src/messageout.h b/src/messageout.h
index 88f57903..d48cb899 100644
--- a/src/messageout.h
+++ b/src/messageout.h
@@ -24,6 +24,8 @@
#ifndef _TMW_SERVER_MESSAGEOUT_
#define _TMW_SERVER_MESSAGEOUT_
+#include <string>
+
#include "packet.h"
class MessageOut
@@ -47,7 +49,7 @@ class MessageOut
* Writes a string. If a fixed length is not given (-1), it is stored
* as a short at the start of the string.
*/
- void writeString(int length = -1);
+ void writeString(const std::string &string, int length = -1);
/**
* Returns an instance of Packet derived from the written data. Use for