summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-01-18 19:30:11 -0200
committershennetsind <ind@henn.et>2014-01-18 19:30:11 -0200
commit14f84fc044754d22740905b7fa90022b4a04b0d8 (patch)
tree761e2d387fd0bc65ec02964516a15c8d3b85a22d /src/map
parentcbde75bbe7c4a74506437f14b33dd94f8ad15b5a (diff)
downloadhercules-14f84fc044754d22740905b7fa90022b4a04b0d8.tar.gz
hercules-14f84fc044754d22740905b7fa90022b4a04b0d8.tar.bz2
hercules-14f84fc044754d22740905b7fa90022b4a04b0d8.tar.xz
hercules-14f84fc044754d22740905b7fa90022b4a04b0d8.zip
Socket interfaced
We designed this one with having as little changes required elsewhere in mind, thus the way most socket-related things are called has not changed. Plugins may now take a greater advantage of the socket features. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/chrif.c10
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/clif.c32
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/unit.c2
10 files changed, 33 insertions, 33 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3cdfb0e29..0cb552bd0 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9847,7 +9847,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
}
if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
//Clearing these to be used once more.
memset(command, '\0', sizeof(command));
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 0a3fb0ad2..3dc35fc68 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -426,7 +426,7 @@ void chrif_connectack(int fd) {
guild->castle_map_init();
}
- socket_datasync(fd, true);
+ sockt->datasync(fd, true);
chrif->skillid2idx(fd);
}
@@ -1251,7 +1251,7 @@ bool chrif_char_offline_nsd(int account_id, int char_id) {
/*=========================================
* Tell char-server to reset all chars offline [Wizputer]
*-----------------------------------------*/
-bool chrif_flush_fifo(void) {
+bool chrif_flush(void) {
chrif_check(false);
set_nonblocking(chrif->fd, 0);
@@ -1372,7 +1372,7 @@ int chrif_parse(int fd) {
chrif->on_disconnect();
return 0;
} else if ( session[fd]->flag.ping ) {/* we've reached stall time */
- if( DIFF_TICK(last_tick, session[fd]->rdata_tick) > (stall_time * 2) ) {/* we can't wait any longer */
+ if( DIFF_TICK(sockt->last_tick, session[fd]->rdata_tick) > (sockt->stall_time * 2) ) {/* we can't wait any longer */
set_eof(fd);
return 0;
} else if( session[fd]->flag.ping != 2 ) { /* we haven't sent ping out yet */
@@ -1423,7 +1423,7 @@ int chrif_parse(int fd) {
case 0x2b04: chrif->recvmap(fd); break;
case 0x2b06: chrif->changemapserverack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOW(fd,18), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); break;
case 0x2b09: map->addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
- case 0x2b0a: socket_datasync(fd, false); break;
+ case 0x2b0a: sockt->datasync(fd, false); break;
case 0x2b0d: chrif->changedsex(fd); break;
case 0x2b0f: chrif->char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break;
case 0x2b12: chrif->divorceack(RFIFOL(fd,2), RFIFOL(fd,6)); break;
@@ -1692,7 +1692,7 @@ void chrif_defaults(void) {
chrif->removefriend = chrif_removefriend;
chrif->send_report = chrif_send_report;
- chrif->flush_fifo = chrif_flush_fifo;
+ chrif->flush = chrif_flush;
chrif->skillid2idx = chrif_skillid2idx;
chrif->sd_to_auth = chrif_sd_to_auth;
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 7e7aa43cd..163fdf670 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -104,7 +104,7 @@ struct chrif_interface {
bool (*removefriend) (int char_id, int friend_id);
void (*send_report) (char* buf, int len);
- bool (*flush_fifo) (void);
+ bool (*flush) (void);
void (*skillid2idx) (int fd);
bool (*sd_to_auth) (TBL_PC* sd, enum sd_state state);
diff --git a/src/map/clif.c b/src/map/clif.c
index af328e7a7..975a5aa01 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9708,7 +9708,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
//Set last idle time... [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_WALK )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
unit->walktoxy(&sd->bl, x, y, 4);
}
@@ -9859,7 +9859,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
}
if( battle_config.idletime_criteria & BCIDLE_CHAT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
if( sd->gcbind ) {
clif->chsys_send(sd->gcbind,sd,message);
@@ -10024,7 +10024,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
sd->emotionlasttime = time(NULL);
if( battle_config.idletime_criteria & BCIDLE_EMOTION )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) {// re-roll dice
emoticon = rnd()%6+E_DICE1;
@@ -10099,7 +10099,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
pc->delinvincibletimer(sd);
if( battle_config.idletime_criteria & BCIDLE_ATTACK )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
unit->attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
@@ -10124,7 +10124,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
break;
if( battle_config.idletime_criteria & BCIDLE_SIT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
pc_setsit(sd);
skill->sit(sd,1);
@@ -10138,7 +10138,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
}
if( battle_config.idletime_criteria & BCIDLE_SIT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
pc->setstand(sd);
skill->sit(sd,0);
@@ -10332,7 +10332,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
if( battle_config.idletime_criteria & BCIDLE_CHAT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
// Chat logging type 'W' / Whisper
logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, message);
@@ -10552,7 +10552,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
break;
if( battle_config.idletime_criteria & BCIDLE_DROPITEM )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
return;
}
@@ -10580,7 +10580,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
//Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_USEITEM )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
if(n <0 || n >= MAX_INVENTORY)
@@ -10627,7 +10627,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) {
}
if( battle_config.idletime_criteria & BCIDLE_USEITEM )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
//Client doesn't send the position for ammo.
if(sd->inventory_data[p->index]->type == IT_AMMO)
@@ -10747,7 +10747,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
if( battle_config.idletime_criteria & BCIDLE_USEITEM )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
pc->unequipitem(sd,index,1);
}
@@ -11297,7 +11297,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
// Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_USESKILLTOID )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
if( sd->npc_id || sd->state.workinprogress&1 ){
#ifdef RENEWAL
@@ -11398,7 +11398,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
if( battle_config.idletime_criteria & BCIDLE_USESKILLTOPOS )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
if( skill->not_ok(skill_id, sd) )
return;
@@ -12154,7 +12154,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
}
if( battle_config.idletime_criteria & BCIDLE_CHAT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
party->send_message(sd, text, textlen);
}
@@ -13214,7 +13214,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
}
if( battle_config.idletime_criteria & BCIDLE_CHAT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
if( sd->bg_id )
bg->send_message(sd, text, textlen);
@@ -16203,7 +16203,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
}
if( battle_config.idletime_criteria & BCIDLE_CHAT )
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
bg->send_message(sd, text, textlen);
}
diff --git a/src/map/map.c b/src/map/map.c
index 052d589b4..8301caa5b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5113,7 +5113,7 @@ void do_final(void)
map->id_db->foreach(map->id_db,map->cleanup_db_sub);
chrif->char_reset_offline();
- chrif->flush_fifo();
+ chrif->flush();
atcommand->final();
battle->final();
@@ -5200,7 +5200,7 @@ void do_abort(void)
}
ShowError("Server received crash signal! Attempting to save all online characters!\n");
map->foreachpc(map->abort_sub);
- chrif->flush_fifo();
+ chrif->flush();
}
/*======================================================
@@ -5524,13 +5524,13 @@ int do_init(int argc, char *argv[])
if (!map->ip_set || !map->char_ip_set) {
char ip_str[16];
- ip2str(addr_[0], ip_str);
+ ip2str(sockt->addr_[0], ip_str);
ShowWarning("Not all IP addresses in /conf/map-server.conf configured, autodetecting...\n");
- if (naddr_ == 0)
+ if (sockt->naddr_ == 0)
ShowError("Unable to determine your IP address...\n");
- else if (naddr_ > 1)
+ else if (sockt->naddr_ > 1)
ShowNotice("Multiple interfaces detected...\n");
ShowInfo("Defaulting to %s as our IP address\n", ip_str);
diff --git a/src/map/mob.c b/src/map/mob.c
index 6a8aa5f03..dab7b99ac 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1825,7 +1825,7 @@ void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct ite
if( sd
&& (drop_rate <= sd->state.autoloot || pc->isautolooting(sd, ditem->item_data.nameid))
- && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
+ && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(sockt->last_tick, sd->idletime) < battle_config.idle_no_autoloot)
&& (battle_config.homunculus_autoloot?1:!flag)
#ifdef AUTOLOOT_DISTANCE
&& sd->bl.m == md->bl.m
diff --git a/src/map/pc.c b/src/map/pc.c
index f96b70cdb..b6c354189 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1035,7 +1035,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->cansendmail_tick = tick;
sd->hchsysch_tick = tick;
- sd->idletime = last_tick;
+ sd->idletime = sockt->last_tick;
for(i = 0; i < MAX_SPIRITBALL; i++)
sd->spirit_timer[i] = INVALID_TIMER;
diff --git a/src/map/pc.h b/src/map/pc.h
index f64b20945..487266646 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -585,7 +585,7 @@ enum equip_pos {
#define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 )
#define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
#define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
-#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
+#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle_config.idle_no_share )
#define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
diff --git a/src/map/script.c b/src/map/script.c
index 75469a345..8e8f89727 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15044,7 +15044,7 @@ BUILDIN(checkidle) {
sd = script->rid2sd(st);
if (sd)
- script_pushint(st, DIFF_TICK32(last_tick, sd->idletime)); // TODO: change this to int64 when we'll support 64 bit script values
+ script_pushint(st, DIFF_TICK32(sockt->last_tick, sd->idletime)); // TODO: change this to int64 when we'll support 64 bit script values
else
script_pushint(st, 0);
diff --git a/src/map/unit.c b/src/map/unit.c
index d801a72f0..af52e6dfb 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1918,7 +1918,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
if(ud->state.attack_continue) {
if( src->type == BL_PC && battle_config.idletime_criteria & BCIDLE_ATTACK )
- ((TBL_PC*)src)->idletime = last_tick;
+ ((TBL_PC*)src)->idletime = sockt->last_tick;
ud->attacktimer = timer->add(ud->attackabletime,unit->attack_timer,src->id,0);
}