* Fixed a few map crashes when char-server crashes [Wizputer]

* Added fix of 0x2aff and 0x2af8 flooding [Wizputer - thanks Toster] 

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@395 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
wizputer 2004-11-28 04:42:06 +00:00
parent 3ab68a0d90
commit e10dec5a1b
2 changed files with 39 additions and 14 deletions

View File

@ -1,5 +1,7 @@
Date Added Date Added
11/27 11/27
* Fixed a few map crashes when char-server crashes [Wizputer]
* Added fix of 0x2aff and 0x2af8 flooding [Wizputer - thanks Toster]
* Fixed Map crash when person uses global message hacks [Wizputer] * Fixed Map crash when person uses global message hacks [Wizputer]
* Fixed online system, online column works and prevent double login at the login server [Wizputer] * Fixed online system, online column works and prevent double login at the login server [Wizputer]
* Fixed some compile time errors associated with showmsg [MouseJstr] * Fixed some compile time errors associated with showmsg [MouseJstr]

View File

@ -98,7 +98,7 @@ int chrif_save(struct map_session_data *sd)
{ {
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if (char_fd < 0) if (char_fd < 1)
return -1; return -1;
pc_makesavestatus(sd); pc_makesavestatus(sd);
@ -184,7 +184,10 @@ int chrif_changemapserver(struct map_session_data *sd, char *name, int x, int y,
int i, s_ip; int i, s_ip;
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if (!sd || char_fd < 1 )
return -1;
s_ip = 0; s_ip = 0;
for(i = 0; i < fd_max; i++) for(i = 0; i < fd_max; i++)
if (session[i] && session[i]->session_data == sd) { if (session[i] && session[i]->session_data == sd) {
@ -283,7 +286,7 @@ int chrif_authreq(struct map_session_data *sd)
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if (!sd || !char_fd || !sd->bl.id || !sd->login_id1) if (!sd || char_fd < 1 || !sd->bl.id || !sd->login_id1)
return -1; return -1;
for(i = 0; i < fd_max; i++) for(i = 0; i < fd_max; i++)
@ -311,7 +314,7 @@ int chrif_charselectreq(struct map_session_data *sd)
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if(!sd || !char_fd || !sd->bl.id || !sd->login_id1) if(!sd || char_fd < 1 || !sd->bl.id || !sd->login_id1)
return -1; return -1;
s_ip = 0; s_ip = 0;
@ -337,7 +340,7 @@ int chrif_charselectreq(struct map_session_data *sd)
*/ */
int chrif_searchcharid(int char_id) int chrif_searchcharid(int char_id)
{ {
if (!char_id) if (!char_id || char_fd < 1)
return -1; return -1;
WFIFOW(char_fd,0) = 0x2b08; WFIFOW(char_fd,0) = 0x2b08;
@ -355,6 +358,9 @@ int chrif_changegm(int id, const char *pass, int len)
{ {
if (battle_config.etc_log) if (battle_config.etc_log)
printf("chrif_changegm: account: %d, password: '%s'.\n", id, pass); printf("chrif_changegm: account: %d, password: '%s'.\n", id, pass);
if (char_fd < 1 )
return -1;
WFIFOW(char_fd,0) = 0x2b0a; WFIFOW(char_fd,0) = 0x2b0a;
WFIFOW(char_fd,2) = len + 8; WFIFOW(char_fd,2) = len + 8;
@ -373,7 +379,10 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email)
{ {
if (battle_config.etc_log) if (battle_config.etc_log)
printf("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n", id, actual_email, new_email); printf("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n", id, actual_email, new_email);
if (char_fd < 1 )
return -1;
WFIFOW(char_fd,0) = 0x2b0c; WFIFOW(char_fd,0) = 0x2b0c;
WFIFOL(char_fd,2) = id; WFIFOL(char_fd,2) = id;
memcpy(WFIFOP(char_fd,6), actual_email, 40); memcpy(WFIFOP(char_fd,6), actual_email, 40);
@ -396,6 +405,9 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email)
*/ */
int chrif_char_ask_name(int id, char * character_name, short operation_type, int year, int month, int day, int hour, int minute, int second) int chrif_char_ask_name(int id, char * character_name, short operation_type, int year, int month, int day, int hour, int minute, int second)
{ {
if (char_fd < 1 )
return -1;
WFIFOW(char_fd, 0) = 0x2b0e; WFIFOW(char_fd, 0) = 0x2b0e;
WFIFOL(char_fd, 2) = id; // account_id of who ask (for answer) -1 if nobody WFIFOL(char_fd, 2) = id; // account_id of who ask (for answer) -1 if nobody
memcpy(WFIFOP(char_fd,6), character_name, 24); memcpy(WFIFOP(char_fd,6), character_name, 24);
@ -419,6 +431,9 @@ int chrif_char_ask_name(int id, char * character_name, short operation_type, int
*------------------------------------------ *------------------------------------------
*/ */
int chrif_changesex(int id, int sex) { int chrif_changesex(int id, int sex) {
if (char_fd < 1 )
return -1;
WFIFOW(char_fd,0) = 0x3000; WFIFOW(char_fd,0) = 0x3000;
WFIFOW(char_fd,2) = 9; WFIFOW(char_fd,2) = 9;
WFIFOL(char_fd,4) = id; WFIFOL(char_fd,4) = id;
@ -649,7 +664,10 @@ int chrif_saveaccountreg2(struct map_session_data *sd)
{ {
int p, j; int p, j;
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if (char_fd < 1 )
return -1;
p = 8; p = 8;
for(j = 0; j < sd->status.account_reg2_num; j++) { for(j = 0; j < sd->status.account_reg2_num; j++) {
struct global_reg *reg = &sd->status.account_reg2[j]; struct global_reg *reg = &sd->status.account_reg2[j];
@ -820,7 +838,7 @@ int chrif_chardisconnect(struct map_session_data *sd)
{ {
nullpo_retr(-1, sd); nullpo_retr(-1, sd);
if(char_fd<=0) if(char_fd < 1)
return -1; return -1;
WFIFOW(char_fd,0)=0x2b18; WFIFOW(char_fd,0)=0x2b18;
@ -849,7 +867,9 @@ int chrif_recvgmaccounts(int fd)
*/ */
int chrif_reloadGMdb(void) int chrif_reloadGMdb(void)
{ {
if (char_fd < 1 )
return -1;
WFIFOW(char_fd,0) = 0x2af7; WFIFOW(char_fd,0) = 0x2af7;
WFIFOSET(char_fd, 2); WFIFOSET(char_fd, 2);
@ -865,7 +885,10 @@ int chrif_reloadGMdb(void)
char buf[256]; char buf[256];
FILE *fp; FILE *fp;
int i; int i;
if (char_fd < 1 )
return -1;
WFIFOW(char_fd,0) = 0x2b16; WFIFOW(char_fd,0) = 0x2b16;
WFIFOW(char_fd,2) = base_rate; WFIFOW(char_fd,2) = base_rate;
WFIFOW(char_fd,4) = job_rate; WFIFOW(char_fd,4) = job_rate;
@ -899,7 +922,7 @@ int chrif_reloadGMdb(void)
int chrif_char_offline(struct map_session_data *sd) int chrif_char_offline(struct map_session_data *sd)
{ {
if (char_fd < 0) if (char_fd < 1)
return -1; return -1;
WFIFOW(char_fd,0) = 0x2b17; WFIFOW(char_fd,0) = 0x2b17;
@ -915,7 +938,7 @@ int chrif_char_offline(struct map_session_data *sd)
*----------------------------------------- *-----------------------------------------
*/ */
int chrif_char_reset_offline(void) { int chrif_char_reset_offline(void) {
if (char_fd < 0) if (char_fd < 1)
return -1; return -1;
WFIFOW(char_fd,0) = 0x2b18; WFIFOW(char_fd,0) = 0x2b18;
@ -931,7 +954,7 @@ int chrif_char_reset_offline(void) {
int chrif_char_online(struct map_session_data *sd) int chrif_char_online(struct map_session_data *sd)
{ {
if (char_fd < 0) if (char_fd < 1)
return -1; return -1;
WFIFOW(char_fd,0) = 0x2b19; WFIFOW(char_fd,0) = 0x2b19;
@ -1025,7 +1048,7 @@ int send_users_tochar(int tid, unsigned int tick, int id, int data) {
int users = 0, i; int users = 0, i;
struct map_session_data *sd; struct map_session_data *sd;
if (char_fd <= 0 || session[char_fd] == NULL) if (char_fd < 1 || session[char_fd] == NULL || !chrif_isconnect()) // Thanks to Toster
return 0; return 0;
WFIFOW(char_fd,0) = 0x2aff; WFIFOW(char_fd,0) = 0x2aff;