- Updated map_quit to handle removing of players who are not even authenticated yet.

- New connection requests are now also blocked when there's a player already online but hasn't finished loading yet.
- Because of these changes, the friendlist notification when people join has been moved to LoadEndAck from pc_authok


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9241 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-11-17 13:57:15 +00:00
parent 6611346270
commit 68bc8eb99d
4 changed files with 21 additions and 9 deletions

View File

@ -3,6 +3,13 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/11/17
* Updated map_quit to handle removing of players who are not even
authenticated yet. [Skotlex]
* New connection requests are now also blocked when there's a player
already online but hasn't finished loading yet. [Skotlex]
* Because of these changes, the friendlist notification when people join
has been moved to LoadEndAck from pc_authok [Skotlex]
2006/11/16 2006/11/16
* Updated sql files [Toms] * Updated sql files [Toms]
* For the sake of avoiding confusion, all script events are named with prefix 'On' * For the sake of avoiding confusion, all script events are named with prefix 'On'

View File

@ -8202,8 +8202,9 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd)
if ((old_sd = map_id2sd(account_id)) != NULL) if ((old_sd = map_id2sd(account_id)) != NULL)
{ // if same account already connected, we disconnect the 2 sessions { // if same account already connected, we disconnect the 2 sessions
//Check for characters with no connection (includes those that are using autotrade) [durf],[Skotlex] //Check for characters with no connection (includes those that are using autotrade) [durf],[Skotlex]
if (old_sd->state.finalsave) if (old_sd->state.finalsave || !old_sd->state.auth)
; //Ack has not arrived yet from char-server, be patient! ; //Previous player is not done loading.
//Or he has quit, but is not done saving on the charserver.
else if (old_sd->fd) else if (old_sd->fd)
clif_authfail_fd(old_sd->fd, 2); // same id clif_authfail_fd(old_sd->fd, 2); // same id
else else
@ -8387,6 +8388,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if (night_flag && map[sd->bl.m].flag.nightenabled) if (night_flag && map[sd->bl.m].flag.nightenabled)
add_timer(gettick()+1000,clif_nighttimer,sd->bl.id,0); add_timer(gettick()+1000,clif_nighttimer,sd->bl.id,0);
// Notify everyone that this char logged in [Skotlex].
clif_foreachclient(clif_friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
//Login Event //Login Event
npc_script_event(sd, NPCE_LOGIN); npc_script_event(sd, NPCE_LOGIN);
} else { } else {

View File

@ -290,7 +290,7 @@ int map_freeblock_unlock_sub(char *file, int lineno)
if ((--block_free_lock) == 0) { if ((--block_free_lock) == 0) {
int i; int i;
for (i = 0; i < block_free_count; i++) for (i = 0; i < block_free_count; i++)
{ //Directly calling aFree shouldn't be a leak, as Free remembers the size the original pointed to memory was allocated with? [Skotlex] {
// aFree(block_free[i]); // aFree(block_free[i]);
// _mfree(block_free[i], file, lineno, __func__); // _mfree(block_free[i], file, lineno, __func__);
_mfree(block_free[i], file, ((block_free[i]?block_free[i]->type:0)*100000)+lineno, __func__); _mfree(block_free[i], file, ((block_free[i]?block_free[i]->type:0)*100000)+lineno, __func__);
@ -300,7 +300,7 @@ int map_freeblock_unlock_sub(char *file, int lineno)
} else if (block_free_lock < 0) { } else if (block_free_lock < 0) {
if (battle_config.error_log) if (battle_config.error_log)
ShowError("map_freeblock_unlock: lock count < 0 !\n"); ShowError("map_freeblock_unlock: lock count < 0 !\n");
block_free_lock = 0; // 次回以降のロックに支障が出てくるのでリセット block_free_lock = 0;
} }
return block_free_lock; return block_free_lock;
@ -1660,8 +1660,12 @@ void map_deliddb(struct block_list *bl) {
*/ */
int map_quit(struct map_session_data *sd) { int map_quit(struct map_session_data *sd) {
//nullpo_retr(0, sd); //Utterly innecessary, all invokations to this function already have an SD non-null check. if(!sd->state.auth) { //Removing a player that hasn't even finished loading
//Learn to use proper coding and stop relying on nullpo_'s for safety :P [Skotlex] idb_remove(pc_db,sd->status.account_id);
idb_remove(charid_db,sd->status.char_id);
idb_remove(id_db,sd->bl.id);
return 0;
}
if(!sd->state.waitingdisconnect) { if(!sd->state.waitingdisconnect) {
if (sd->npc_timer_id != -1) //Cancel the event timer. if (sd->npc_timer_id != -1) //Cancel the event timer.
npc_timerevent_quit(sd); npc_timerevent_quit(sd);

View File

@ -694,9 +694,6 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
if (map_charid2nick(sd->status.char_id) == NULL) if (map_charid2nick(sd->status.char_id) == NULL)
map_addchariddb(sd->status.char_id, sd->status.name); map_addchariddb(sd->status.char_id, sd->status.name);
// Notify everyone that this char logged in [Skotlex].
clif_foreachclient(clif_friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
//Prevent S. Novices from getting the no-death bonus just yet. [Skotlex] //Prevent S. Novices from getting the no-death bonus just yet. [Skotlex]
sd->die_counter=-1; sd->die_counter=-1;
//Until the reg values arrive, set them to not require trigger... //Until the reg values arrive, set them to not require trigger...