summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-02-07 19:38:32 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-02-07 22:41:23 -0800
commit83b2e0b3ceda907b7186acfcc56c214fc04d9c13 (patch)
treef4dcc8d8b59fd9a633bc2604cc92f0523cc76ee4 /src/login
parentc67c2b7435a13d7ce17b2075e22dc5c6036f702a (diff)
downloadtmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.gz
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.bz2
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.tar.xz
tmwa-83b2e0b3ceda907b7186acfcc56c214fc04d9c13.zip
Remove some macros
Diffstat (limited to 'src/login')
-rw-r--r--src/login/login.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 7af76f8..1618461 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -31,13 +31,13 @@
static_assert(std::is_same<time_t, long>::value, "much code assumes time_t is a long (sorry)");
-#define MAX_SERVERS 30
+constexpr int MAX_SERVERS = 30;
#define LOGIN_CONF_NAME "conf/login_athena.conf"
#define LAN_CONF_NAME "conf/lan_support.conf"
-#define START_ACCOUNT_NUM 2000000
-#define END_ACCOUNT_NUM 100000000
+constexpr int START_ACCOUNT_NUM = 2000000;
+constexpr int END_ACCOUNT_NUM = 100000000;
struct mmo_account
{
@@ -158,7 +158,7 @@ struct login_session_data
char md5key[20];
};
-#define AUTH_FIFO_SIZE 256
+constexpr int AUTH_FIFO_SIZE = 256;
struct
{
int account_id, login_id1, login_id2;
@@ -203,8 +203,19 @@ static
pid_t pid = 0; // For forked DB writes
-#define VERSION_2_UPDATEHOST 0x01 // client supports updatehost
-#define VERSION_2_SERVERORDER 0x02 // send servers in forward order
+namespace e
+{
+enum class VERSION_2 : uint8_t
+{
+ /// client supports updatehost
+ UPDATEHOST = 0x01,
+ /// send servers in forward order
+ SERVERORDER = 0x02,
+};
+ENUM_BITWISE_OPERATORS(VERSION_2)
+}
+using e::VERSION_2;
+
//------------------------------
// Writing function of logs file
//------------------------------
@@ -1139,9 +1150,7 @@ void parse_fromchar(int fd)
{
if (auth_fifo[i].account_id == acc &&
auth_fifo[i].login_id1 == RFIFOL(fd, 6) &&
-#if CMP_AUTHFIFO_LOGIN2 != 0
auth_fifo[i].login_id2 == RFIFOL(fd, 10) && // relate to the versions higher than 18
-#endif
auth_fifo[i].sex == RFIFOB(fd, 14) &&
(!check_ip_flag
|| auth_fifo[i].ip == RFIFOL(fd, 15))
@@ -3118,9 +3127,9 @@ void parse_login(int fd)
result = mmo_auth(&account, fd);
if (result == -1)
{
- int version_2 = RFIFOB(fd, 54);
- if (!(version_2 & VERSION_2_UPDATEHOST)
- || !(version_2 & VERSION_2_SERVERORDER))
+ VERSION_2 version_2 = static_cast<VERSION_2>(RFIFOB(fd, 54));
+ if (!bool(version_2 & VERSION_2::UPDATEHOST)
+ || !bool(version_2 & VERSION_2::SERVERORDER))
result = 5; // client too old
}
if (result == -1)