summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-21 14:52:23 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-21 14:52:23 +0000
commiteb3546a33a9689a745e6497fc9e781f4e7f9b3c1 (patch)
tree27d1ce4e1aab84a20c171ba4bc33b47baf227dfc /src
parente85f5bc390679728f16264908755a5b594055f8b (diff)
downloadhercules-eb3546a33a9689a745e6497fc9e781f4e7f9b3c1.tar.gz
hercules-eb3546a33a9689a745e6497fc9e781f4e7f9b3c1.tar.bz2
hercules-eb3546a33a9689a745e6497fc9e781f4e7f9b3c1.tar.xz
hercules-eb3546a33a9689a745e6497fc9e781f4e7f9b3c1.zip
- Added define MAX_CHARS so you can easily mod the server to support a different amount of characters per account (however, there is still the issue of hexing the client to support this change)
- Updated msg_athena.conf so it no longer uses broken english on several entries. Thanks to Scerez for the updated file. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10044 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c30
-rw-r--r--src/char_sql/char.c18
-rw-r--r--src/char_sql/int_guild.c2
-rw-r--r--src/common/mmo.h2
4 files changed, 27 insertions, 25 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ec4d24caf..92286bea8 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -99,7 +99,7 @@ int log_inter = 1; // loggin inter or not [devil]
struct char_session_data{
int account_id, login_id1, login_id2, sex;
- int found_char[9];
+ int found_char[MAX_CHARS];
char email[40]; // e-mail (default: a@a.com) by [Yor]
time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
};
@@ -1145,7 +1145,7 @@ int make_new_char(int fd, unsigned char *dat) {
} // else, all letters/symbols are authorised (except control char removed before)
if (dat[24] + dat[25] + dat[26] + dat[27] + dat[28] + dat[29] != 5*6 || // stats
- dat[30] >= 9 || // slots (dat[30] can not be negativ)
+ dat[30] >= MAX_CHARS || // slots (dat[30] can not be negativ)
dat[33] <= 0 || dat[33] >= 24 || // hair style
dat[31] >= 9) { // hair color (dat[31] can not be negativ)
char_log("Make new char error (invalid values): (connection #%d, account: %d) slot %d, name: %s, stats: %d+%d+%d+%d+%d+%d=%d, hair: %d, hair color: %d" RETCODE,
@@ -1731,11 +1731,11 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) {
for(i = 0; i < char_num; i++) {
if (char_dat[i].status.account_id == sd->account_id) {
sd->found_char[found_num] = i;
- if( ++found_num == 9 )
+ if( ++found_num == MAX_CHARS )
break;
}
}
- for(i = found_num; i < 9; i++)
+ for(i = found_num; i < MAX_CHARS; i++)
sd->found_char[i] = -1;
@@ -2295,7 +2295,7 @@ int parse_tologin(int fd) {
for (j = 0; j < fd_max; j++) {
if (session[j] && (sd2 = (struct char_session_data*)session[j]->session_data) &&
sd2->account_id == char_dat[char_num-1].status.account_id) {
- for (k = 0; k < 9; k++) {
+ for (k = 0; k < MAX_CHARS; k++) {
if (sd2->found_char[k] == char_num-1) {
sd2->found_char[k] = i;
break;
@@ -3477,10 +3477,10 @@ int parse_char(int fd) {
break;
}
// otherwise, load the character
- for (ch = 0; ch < 9; ch++)
+ for (ch = 0; ch < MAX_CHARS; ch++)
if (sd->found_char[ch] >= 0 && char_dat[sd->found_char[ch]].status.char_num == char_num)
break;
- if (ch == 9)
+ if (ch == MAX_CHARS)
{ //Not found?? May be forged packet.
break;
}
@@ -3628,7 +3628,7 @@ int parse_char(int fd) {
WFIFOSET(fd,len);
RFIFOSKIP(fd,37);
}
- for(ch = 0; ch < 9; ch++) {
+ for(ch = 0; ch < MAX_CHARS; ch++) {
if (sd->found_char[ch] == -1) {
sd->found_char[ch] = i;
break;
@@ -3657,7 +3657,7 @@ int parse_char(int fd) {
break;
}
// we change the packet to set it like selection.
- for (i = 0; i < 9; i++)
+ for (i = 0; i < MAX_CHARS; i++)
if (sd->found_char[i] != -1 && char_dat[sd->found_char[i]].status.char_id == cid) {
// we save new e-mail
memcpy(sd->email, email, 40);
@@ -3673,7 +3673,7 @@ int parse_char(int fd) {
// not send packet, it's modify of actual packet
break;
}
- if (i == 9) {
+ if (i == MAX_CHARS) {
WFIFOW(fd, 0) = 0x70;
WFIFOB(fd, 2) = 0; // 00 = Incorrect Email address
WFIFOSET(fd, 3);
@@ -3687,11 +3687,11 @@ int parse_char(int fd) {
WFIFOSET(fd, 3);
break;
}
- for (i = 0; i < 9; i++) {
+ for (i = 0; i < MAX_CHARS; i++) {
if (sd->found_char[i] == -1) continue;
if (char_dat[sd->found_char[i]].status.char_id == cid) break;
}
- if (i == 9) {
+ if (i == MAX_CHARS) {
WFIFOW(fd,0) = 0x70;
WFIFOB(fd,2) = 0;
WFIFOSET(fd,3);
@@ -3708,7 +3708,7 @@ int parse_char(int fd) {
for (j = 0; j < fd_max; j++) {
if (session[j] && (sd2 = (struct char_session_data*)session[j]->session_data) &&
sd2->account_id == char_dat[char_num-1].status.account_id) {
- for (k = 0; k < 9; k++) {
+ for (k = 0; k < MAX_CHARS; k++) {
if (sd2->found_char[k] == char_num-1) {
sd2->found_char[k] = sd->found_char[i];
break;
@@ -3719,9 +3719,9 @@ int parse_char(int fd) {
}
}
char_num--;
- for(ch = i; ch < 9-1; ch++)
+ for(ch = i; ch < MAX_CHARS-1; ch++)
sd->found_char[ch] = sd->found_char[ch+1];
- sd->found_char[8] = -1;
+ sd->found_char[MAX_CHARS-1] = -1;
WFIFOW(fd,0) = 0x6f;
WFIFOSET(fd,2);
break;
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index afc65c677..4f9ef962f 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -128,7 +128,7 @@ static int online_check = 1; //If one, it won't let players connect when their a
struct char_session_data{
int account_id, login_id1, login_id2,sex;
- int found_char[9];
+ int found_char[MAX_CHARS];
char email[40]; // e-mail (default: a@a.com) by [Yor]
time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
};
@@ -1298,7 +1298,7 @@ int make_new_char_sql(int fd, unsigned char *dat) {
//check stat error
if ((dat[24]+dat[25]+dat[26]+dat[27]+dat[28]+dat[29]!=6*5 ) || // stats
- (dat[30] >= 9) || // slots (dat[30] can not be negativ)
+ (dat[30] >= MAX_CHARS) || // slots (dat[30] can not be negativ)
(dat[33] <= 0) || (dat[33] >= 24) || // hair style
(dat[31] >= 9)) { // hair color (dat[31] can not be negativ)
if (log_char) {
@@ -1746,7 +1746,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) {
set_char_online(-1, 99,sd->account_id);
//search char.
- sprintf(tmp_sql, "SELECT `char_id` FROM `%s` WHERE `account_id` = '%d' AND `char_num` < '9'",char_db, sd->account_id);
+ sprintf(tmp_sql, "SELECT `char_id` FROM `%s` WHERE `account_id` = '%d' AND `char_num` < '%d'",char_db, sd->account_id, MAX_CHARS);
if (mysql_query(&mysql_handle, tmp_sql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
@@ -1763,7 +1763,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) {
mysql_free_result(sql_res);
}
- for(i = found_num; i < 9; i++)
+ for(i = found_num; i < MAX_CHARS; i++)
sd->found_char[i] = -1;
if (save_log)
@@ -3442,7 +3442,7 @@ int parse_char(int fd) {
RFIFOSKIP(fd, 37);
}
//to do
- for(ch = 0; ch < 9; ch++) {
+ for(ch = 0; ch < MAX_CHARS; ch++) {
if (sd->found_char[ch] == -1) {
sd->found_char[ch] = char_dat.char_id;
break;
@@ -3470,17 +3470,17 @@ int parse_char(int fd) {
break;
}
- for(i = 0; i < 9; i++) {
+ for(i = 0; i < MAX_CHARS; i++) {
if (sd->found_char[i] == cid) {
- for(ch = i; ch < 9-1; ch++)
+ for(ch = i; ch < MAX_CHARS-1; ch++)
sd->found_char[ch] = sd->found_char[ch+1];
- sd->found_char[8] = -1;
+ sd->found_char[MAX_CHARS-1] = -1;
break;
}
}
/* Such a character does not exist in the account */
/* If so, you are so screwed. */
- if (i == 9) {
+ if (i == MAX_CHARS) {
WFIFOW(fd, 0) = 0x70;
WFIFOB(fd, 2) = 0;
WFIFOSET(fd, 3);
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 4ad3ea070..9b29befb3 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -31,7 +31,7 @@
#define GUILD_ALLIANCE_TYPE_MASK 0x01
#define GUILD_ALLIANCE_REMOVE 0x08
-static char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
#ifndef TXT_SQL_CONVERT
//Guild cache
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 2b25725d1..b780a78c5 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -20,6 +20,8 @@
#define MAX_MAP_PER_SERVER 1024
#define MAX_INVENTORY 100
+//Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more chafacters as well.
+#define MAX_CHARS 9
//Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
//Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
#define MAX_SLOTS 4