From 14d9db5229186a56ce6f270f0b3e5aee1a92a650 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 4 Jan 2015 20:47:58 +0300 Subject: char: read max char class from char server config. --- src/char/char.c | 6 ++++++ src/char/config.c | 6 ++++++ src/char/config.h | 2 ++ src/char/init.c | 1 + 4 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index fcb4535..4b59b67 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -48,6 +48,12 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) chr->mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed. const uint16 race = RFIFOW(fd, 31); + if (race > max_char_class) + { + chr->creation_failed(fd, 10); + hookStop(); + return; + } char_dat.class_ = race; chr->mmo_char_tosql(result, &char_dat); diff --git a/src/char/config.c b/src/char/config.c index 5eefbc1..cddc6b6 100644 --- a/src/char/config.c +++ b/src/char/config.c @@ -14,6 +14,7 @@ #include "char/config.h" char *inter_server_ip = NULL; +int max_char_class = 0; void config_inter_server_ip(const char *val) { @@ -28,6 +29,11 @@ void config_inter_server_ip(const char *val) inter_server_ip = aStrdup(buf); } +void config_max_char_class(const char *val) +{ + max_char_class = atoi(val); +} + void config_final(void) { if (inter_server_ip) diff --git a/src/char/config.h b/src/char/config.h index 930c293..ef1cf34 100644 --- a/src/char/config.h +++ b/src/char/config.h @@ -6,7 +6,9 @@ void config_final(void); void config_inter_server_ip(const char *val); +void config_max_char_class(const char *val); extern char *inter_server_ip; +extern int max_char_class; #endif // EVOL_CHAR_CONFIG diff --git a/src/char/init.c b/src/char/init.c index 5193101..100b28a 100644 --- a/src/char/init.c +++ b/src/char/init.c @@ -71,6 +71,7 @@ HPExport void server_preinit (void) setDefaultMap(); addCharInterConf("inter_server_ip", config_inter_server_ip); + addCharConf("max_char_class", config_max_char_class); } HPExport void server_online (void) -- cgit v1.2.3-70-g09d2