From 8aeb011694ca3023d93dd6e904b3f42ab93f8ba9 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 12 Jan 2014 15:10:55 -0200 Subject: Two Adjustments From some notes I took while working on the megapatch: - Dropped unused char_dat variable in chrif's auth_node - Fixed DB/BB/PB Logging, which could create false logs due to where it was placed. Signed-off-by: shennetsind --- src/map/chrif.c | 9 +-------- src/map/chrif.h | 1 - src/map/npc.c | 2 +- src/map/pc.c | 8 ++++---- 4 files changed, 6 insertions(+), 14 deletions(-) (limited to 'src/map') diff --git a/src/map/chrif.c b/src/map/chrif.c index d66ec1d85..aaef0d6ef 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -126,9 +126,6 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { if ( session[fd] && session[fd]->session_data == node->sd ) session[fd]->session_data = NULL; - if ( node->char_dat ) - aFree(node->char_dat); - if ( node->sd ) aFree(node->sd); @@ -452,7 +449,7 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { switch (node->state) { case ST_LOGIN: - if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail. + if ( node->sd ) {//Since there is no way to request the char auth, make it fail. pc->authfail(node->sd); chrif->char_offline(node->sd); chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); @@ -618,7 +615,6 @@ void chrif_authok(int fd) { sd = node->sd; if( runflag == MAPSERVER_ST_RUNNING && - node->char_dat == NULL && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 ) @@ -1597,9 +1593,6 @@ void chrif_send_report(char* buf, int len) { int auth_db_final(DBKey key, DBData *data, va_list ap) { struct auth_node *node = DB->data2ptr(data); - if (node->char_dat) - aFree(node->char_dat); - if (node->sd) aFree(node->sd); diff --git a/src/map/chrif.h b/src/map/chrif.h index 24b92908d..1de0901f0 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -32,7 +32,6 @@ struct auth_node { int login_id1, login_id2, sex, fd; time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) struct map_session_data *sd; //Data from logged on char. - struct mmo_charstatus *char_dat; //Data from char server. int64 node_created; //timestamp for node timeouts enum sd_state state; //To track whether player was login in/out or changing maps. }; diff --git a/src/map/npc.c b/src/map/npc.c index 9ed6d2a7e..722e5199c 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2188,7 +2188,7 @@ int npc_unload(struct npc_data* nd, bool single) { if( single && nd->bl.m != -1 ) map->remove_questinfo(nd->bl.m,nd); - if( (nd->subtype == SHOP || nd->subtype == CASHSHOP) && nd->src_id == 0) //src check for duplicate shops [Orcao] + if( nd->src_id == 0 && ( nd->subtype == SHOP || nd->subtype == CASHSHOP ) ) //src check for duplicate shops [Orcao] aFree(nd->u.shop.shop_item); else if( nd->subtype == SCRIPT ) { struct s_mapiterator* iter; diff --git a/src/map/pc.c b/src/map/pc.c index e6ad4e20c..30636f40b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4343,10 +4343,6 @@ int pc_isUseitem(struct map_session_data *sd,int n) return 0; } - //Dead Branch & Bloody Branch & Porings Box - if( nameid == ITEMID_BRANCH_OF_DEAD_TREE || nameid == ITEMID_BLOODY_DEAD_BRANCH || nameid == ITEMID_PORING_BOX ) - logs->branch(sd); - return 1; } @@ -4456,6 +4452,10 @@ int pc_useitem(struct map_session_data *sd,int n) { } } + //Dead Branch & Bloody Branch & Porings Box + if( nameid == ITEMID_BRANCH_OF_DEAD_TREE || nameid == ITEMID_BLOODY_DEAD_BRANCH || nameid == ITEMID_PORING_BOX ) + logs->branch(sd); + sd->itemid = sd->status.inventory[n].nameid; sd->itemindex = n; if(sd->catch_target_class != -1) //Abort pet catching. -- cgit v1.2.3-70-g09d2