summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
Diffstat (limited to 'src/char')
-rw-r--r--src/char/Makefile.in2
-rw-r--r--src/char/char.c26
-rw-r--r--src/char/char.h6
-rw-r--r--src/char/geoip.c5
-rw-r--r--src/char/int_guild.c19
-rw-r--r--src/char/inter.c8
6 files changed, 45 insertions, 21 deletions
diff --git a/src/char/Makefile.in b/src/char/Makefile.in
index 456f7e9d2..fe40621fb 100644
--- a/src/char/Makefile.in
+++ b/src/char/Makefile.in
@@ -23,7 +23,7 @@ CONFIG_D = ../config
CONFIG_H = $(wildcard $(CONFIG_D)/*.h) $(wildcard $(CONFIG_D)/*/*.h)
COMMON_D = ../common
-COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h))
+COMMON_H = $(filter-out %.p.h, $(wildcard $(COMMON_D)/*.h)) ../plugins/HPMHooking.h
SYSINFO_INC = $(COMMON_D)/sysinfo.inc
COMMON_INCLUDE = -I..
diff --git a/src/char/char.c b/src/char/char.c
index 929473e33..5f92e37bf 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -62,6 +62,14 @@
#include <stdlib.h>
#include <sys/types.h>
+#if MAX_MAP_SERVERS > 1
+# ifdef _MSC_VER
+# pragma message("WARNING: your settings allow more than one map server to connect, this is deprecated dangerous feature USE IT AT YOUR OWN RISK")
+# else
+# warning your settings allow more than one map server to connect, this is deprecated dangerous feature USE IT AT YOUR OWN RISK
+# endif
+#endif
+
// private declarations
char char_db[256] = "char";
char scdata_db[256] = "sc_data";
@@ -1882,7 +1890,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) {
//When the weapon is sent and your option is riding, the client crashes on login!?
// FIXME[Haru]: is OPTION_HANBOK intended to be part of this list? And if it is, should the list also include other OPTION_ costumes?
- WBUFW(buf,56) = p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK) ? 0 : p->weapon;
+ WBUFW(buf,56) = (p->option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_HANBOK)) ? 0 : p->weapon;
WBUFW(buf,58) = p->base_level;
WBUFW(buf,60) = min(p->skill_point, INT16_MAX);
@@ -5750,11 +5758,25 @@ static CMDLINEARG(netconfig)
chr->NET_CONF_NAME = aStrdup(params);
return true;
}
+
+/**
+ * --run-once handler
+ *
+ * Causes the server to run its loop once, and shutdown. Useful for testing.
+ * @see cmdline->exec
+ */
+static CMDLINEARG(runonce)
+{
+ core->runflag = CORE_ST_STOP;
+ return true;
+}
+
/**
* Initializes the command line arguments handlers.
*/
void cmdline_args_init_local(void)
{
+ CMDLINEARG_DEF2(run-once, runonce, "Closes server after loading (testing).", CMDLINE_OPT_NORMAL);
CMDLINEARG_DEF2(char-config, charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM);
CMDLINEARG_DEF2(inter-config, interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM);
CMDLINEARG_DEF2(net-config, netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM);
@@ -5793,11 +5815,13 @@ int do_init(int argc, char **argv) {
sockt->net_config_read(chr->NET_CONF_NAME);
chr->sql_config_read(chr->SQL_CONF_NAME);
+#ifndef BUILDBOT
if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) {
ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n");
ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n");
ShowNotice("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n");
}
+#endif
inter->init_sql(chr->INTER_CONF_NAME); // inter server configuration
diff --git a/src/char/char.h b/src/char/char.h
index 9cde18e96..a0cfb3bd7 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -68,7 +68,11 @@ struct mmo_map_server {
VECTOR_DECL(uint16) maps;
};
-#define MAX_MAP_SERVERS 2
+/**
+ * deprecated feature, multi map been a dangerous in-complete feature for so long and going to be removed.
+ * USE IT AT YOUR OWN RISK!
+ */
+#define MAX_MAP_SERVERS 1
#define DEFAULT_AUTOSAVE_INTERVAL (300*1000)
diff --git a/src/char/geoip.c b/src/char/geoip.c
index 433ff0918..002045850 100644
--- a/src/char/geoip.c
+++ b/src/char/geoip.c
@@ -132,9 +132,8 @@ void geoip_final(bool shutdown)
**/
void geoip_init(void)
{
- int i, fno;
+ int fno;
char db_type = 1;
- unsigned char delim[3];
struct stat bufa;
FILE *db;
@@ -165,6 +164,8 @@ void geoip_init(void)
if (fseek(db, -3l, SEEK_END) != 0) {
db_type = 0;
} else {
+ int i;
+ unsigned char delim[3];
for (i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++) {
if (fread(delim, sizeof(delim[0]), 3, db) != 3) {
db_type = 0;
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 21f38d049..d2507a2f9 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -146,22 +146,17 @@ int inter_guild_tosql(struct guild *g,int flag)
*t_info = '\0';
// Insert a new guild the guild
- if (flag&GS_BASIC && g->guild_id == -1)
- {
+ if (flag&GS_BASIC && g->guild_id == -1) {
strcat(t_info, " guild_create");
// Create a new guild
- if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` "
- "(`name`,`master`,`guild_lv`,`max_member`,`average_lv`,`char_id`) "
- "VALUES ('%s', '%s', '%d', '%d', '%d', '%d')",
- guild_db, esc_name, esc_master, g->guild_lv, g->max_member, g->average_lv, g->member[0].char_id) )
- {
+ if (SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` "
+ "(`name`,`master`,`guild_lv`,`max_member`,`average_lv`,`char_id`) "
+ "VALUES ('%s', '%s', '%d', '%d', '%d', '%d')",
+ guild_db, esc_name, esc_master, g->guild_lv, g->max_member, g->average_lv, g->member[0].char_id)) {
Sql_ShowDebug(inter->sql_handle);
- if (g->guild_id == -1)
- return 0; //Failed to create guild!
- }
- else
- {
+ return 0; //Failed to create guild!
+ } else {
g->guild_id = (int)SQL->LastInsertId(inter->sql_handle);
new_guild = 1;
}
diff --git a/src/char/inter.c b/src/char/inter.c
index 9fea2885c..d277abec9 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -968,8 +968,8 @@ int mapif_wis_message(struct WisData *wd)
//if (wd->len > 2047-56) wd->len = 2047-56; //Force it to fit to avoid crashes. [Skotlex]
if (wd->len < 0)
wd->len = 0;
- if (wd->len >= sizeof(wd->msg) - 1)
- wd->len = sizeof(wd->msg) - 1;
+ if (wd->len >= (int)sizeof(wd->msg) - 1)
+ wd->len = (int)sizeof(wd->msg) - 1;
WBUFW(buf, 0) = 0x3801;
WBUFW(buf, 2) = 56 +wd->len;
@@ -1085,7 +1085,6 @@ int mapif_parse_broadcast(int fd)
int mapif_parse_WisRequest(int fd)
{
struct WisData* wd;
- static int wisid = 0;
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];// escaped name
char* data;
@@ -1125,6 +1124,7 @@ int mapif_parse_WisRequest(int fd)
}
else
{
+ static int wisid = 0;
CREATE(wd, struct WisData, 1);
// Whether the failure of previous wisp/page transmission (timeout)
@@ -1172,7 +1172,7 @@ int mapif_parse_WisToGM(int fd)
{
unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
- memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2));
+ memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2)); // Message contains the NUL terminator (see intif_wis_message_to_gm())
WBUFW(buf, 0) = 0x3803;
mapif->sendall(buf, RFIFOW(fd,2));