summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-05 16:48:29 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-05 16:48:29 +0300
commit083cf9e66217acaa46eed142f736d76c14340157 (patch)
treefec04b3990499524d604a1fb40b5f35f718c4488 /src/char/char.c
parentbeefec1e41cb13833dece662a5d5086f64e27daf (diff)
downloadevol-hercules-083cf9e66217acaa46eed142f736d76c14340157.tar.gz
evol-hercules-083cf9e66217acaa46eed142f736d76c14340157.tar.bz2
evol-hercules-083cf9e66217acaa46eed142f736d76c14340157.tar.xz
evol-hercules-083cf9e66217acaa46eed142f736d76c14340157.zip
char: allow set in char creation race and gender only if client version >= 4.
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 1a982a8..4a3455e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -36,20 +36,25 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd)
{
// ignore char creation disable option
const int fd = *fdPtr;
+ uint16 race = 0;
+ uint8 sex = 0;
- const uint16 race = RFIFOW(fd, 31);
- if (race > max_char_class)
+ if (sd->version >= 4)
{
- chr->creation_failed(fd, 10);
- hookStop();
- return;
- }
- const uint8 sex = RFIFOB(fd, 33);
- if (sex > 1 && sex != 99)
- {
- chr->creation_failed(fd, 11);
- hookStop();
- return;
+ race = RFIFOW(fd, 31);
+ if (race > max_char_class)
+ {
+ chr->creation_failed(fd, 10);
+ hookStop();
+ return;
+ }
+ sex = RFIFOB(fd, 33);
+ if (sex > 1 && sex != 99)
+ {
+ chr->creation_failed(fd, 11);
+ hookStop();
+ return;
+ }
}
const int result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd, 2), 1, 1, 1, 1, 1, 1, RFIFOB(fd, 26), RFIFOW(fd, 27), RFIFOW(fd, 29));
@@ -63,16 +68,21 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd)
struct mmo_charstatus char_dat;
chr->mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed.
- char_dat.class_ = race;
- char_dat.sex = sex;
-
- chr->mmo_char_tosql(result, &char_dat);
+ if (sd->version >= 4)
+ {
+ char_dat.class_ = race;
+ char_dat.sex = sex;
+ chr->mmo_char_tosql(result, &char_dat);
+ }
chr->creation_ok(fd, &char_dat);
// add new entry to the chars list
sd->found_char[char_dat.slot] = result; // the char_id of the new char
}
- RFIFOSKIP(fd, 31 + 3);
+ if (sd->version >= 4)
+ RFIFOSKIP(fd, 31 + 3);
+ else
+ RFIFOSKIP(fd, 31);
hookStop();
}