summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-04 20:47:58 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-04 20:47:58 +0300
commit14d9db5229186a56ce6f270f0b3e5aee1a92a650 (patch)
treea72934a05abfbbe74412f3b16826c2f60b3a20f0
parentb83f07275fb87c61f4664a384f3de2a4938ab76c (diff)
downloadevol-hercules-14d9db5229186a56ce6f270f0b3e5aee1a92a650.tar.gz
evol-hercules-14d9db5229186a56ce6f270f0b3e5aee1a92a650.tar.bz2
evol-hercules-14d9db5229186a56ce6f270f0b3e5aee1a92a650.tar.xz
evol-hercules-14d9db5229186a56ce6f270f0b3e5aee1a92a650.zip
char: read max char class from char server config.
-rw-r--r--src/char/char.c6
-rw-r--r--src/char/config.c6
-rw-r--r--src/char/config.h2
-rw-r--r--src/char/init.c1
4 files changed, 15 insertions, 0 deletions
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)