diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/socket.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 6 | ||||
-rw-r--r-- | src/map/intif.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 10 | ||||
-rw-r--r-- | src/map/map.h | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 9a61b0827..35d350e95 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -873,13 +873,13 @@ int do_sockets(int next) if(!session[i]) continue; - + + RFIFOFLUSH(i); // after parse, check client's RFIFO size to know if there is an invalid packet (too big and not parsed) if (session[i]->rdata_size == session[i]->max_rdata) { set_eof(i); continue; } - RFIFOFLUSH(i); } #ifdef SHOW_SERVER_STATS diff --git a/src/map/clif.c b/src/map/clif.c index 02e64aaba..425759d29 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5587,7 +5587,7 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val void clif_displaymessage(const int fd, const char* mes) { nullpo_retv(mes); - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: %s\n",mes); } else if ( fd > 0 ) { size_t len; @@ -5619,7 +5619,7 @@ void clif_displaymessage2(const int fd, const char* mes) { size_t len = strnlen(line, 255); if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: %s\n",line); } else { WFIFOHEAD(fd, 5 + len); @@ -5638,7 +5638,7 @@ void clif_displaymessage2(const int fd, const char* mes) { void clif_displaymessage_sprintf(const int fd, const char* mes, ...) { va_list ap; - if( fd == -2 ) { + if( map->cpsd_active && fd == 0 ) { ShowInfo("HCP: "); va_start(ap,mes); _vShowMessage(MSG_NONE,mes,ap); diff --git a/src/map/intif.c b/src/map/intif.c index 78940785e..6b39bd1a5 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2125,7 +2125,7 @@ void intif_parse_MessageToFD(int fd) { int aid = RFIFOL(fd,8); struct map_session_data * sd = session[u_fd]->session_data; /* matching e.g. previous fd owner didn't dc during request or is still the same */ - if( sd->bl.id == aid ) { + if( sd && sd->bl.id == aid ) { char msg[512]; safestrncpy(msg, (char*)RFIFOP(fd,12), RFIFOW(fd,2) - 12); clif->message(u_fd,msg); diff --git a/src/map/map.c b/src/map/map.c index 4bc272035..b45863b11 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5423,13 +5423,15 @@ CPCMD(gm_use) { ShowError("gm:use invalid syntax. use '"CL_WHITE"gm:use @command <optional params>"CL_RESET"'\n"); return; } - map->cpsd->fd = -2; + + map->cpsd_active = true; + if( !atcommand->exec(map->cpsd->fd, map->cpsd, line, false) ) ShowInfo("HCP: '"CL_WHITE"%s"CL_RESET"' failed\n",line); else ShowInfo("HCP: '"CL_WHITE"%s"CL_RESET"' was used\n",line); - map->cpsd->fd = 0; - + + map->cpsd_active = false; } /* Hercules Console Parser */ void map_cp_defaults(void) { @@ -5840,6 +5842,8 @@ void map_defaults(void) { sprintf(map->server_db,"ragnarok"); map->mysql_handle = NULL; + map->cpsd_active = false; + map->port = 0; map->users = 0; map->ip_set = 0; diff --git a/src/map/map.h b/src/map/map.h index f39ae024f..aed506992 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -891,6 +891,8 @@ struct map_interface { struct eri *flooritem_ers; /* */ int bonus_id; + /* */ + bool cpsd_active; /* funcs */ void (*zone_init) (void); void (*zone_remove) (int m); |