summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
committerSusu <bruant.bastien@gmail.com>2013-06-07 20:03:32 +0200
commitd73783f22b2bb881aab74524d153d89a5932a199 (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02 /src/char
parentdc7f14c7dc9829061f8902354367bdc8467eb841 (diff)
downloadhercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.gz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.bz2
hercules-d73783f22b2bb881aab74524d153d89a5932a199.tar.xz
hercules-d73783f22b2bb881aab74524d153d89a5932a199.zip
Hercules Renewal Phase One : pc, party, map, timer
Added iPc, iParty, iMap, iTimer to HPM exported interfaces
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c44
-rw-r--r--src/char/int_auction.c8
-rw-r--r--src/char/int_guild.c10
-rw-r--r--src/char/inter.c6
4 files changed, 34 insertions, 34 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 97ad493b1..3083876ab 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -188,7 +188,7 @@ static DBData create_online_char_data(DBKey key, va_list args)
character->pincode_enable = -1;
character->fd = -1;
character->waiting_disconnect = INVALID_TIMER;
- return DB->ptr2data(character);
+ return iDB->ptr2data(character);
}
void set_char_charselect(int account_id)
@@ -207,7 +207,7 @@ void set_char_charselect(int account_id)
character->pincode_enable = *pincode->charselect + *pincode->enabled;
if(character->waiting_disconnect != INVALID_TIMER) {
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -248,7 +248,7 @@ void set_char_online(int map_id, int char_id, int account_id)
//Get rid of disconnect timer
if(character->waiting_disconnect != INVALID_TIMER) {
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -293,7 +293,7 @@ void set_char_offline(int char_id, int account_id)
server[character->server].users--;
if(character->waiting_disconnect != INVALID_TIMER){
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -322,13 +322,13 @@ void set_char_offline(int char_id, int account_id)
*/
static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
int server = va_arg(ap, int);
if (server == -1) {
character->char_id = -1;
character->server = -1;
if(character->waiting_disconnect != INVALID_TIMER){
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
} else if (character->server == server)
@@ -341,7 +341,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int char_db_kickoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
int server_id = va_arg(ap, int);
if (server_id > -1 && character->server != server_id)
@@ -393,7 +393,7 @@ static DBData create_charstatus(DBKey key, va_list args)
struct mmo_charstatus *cp;
cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
cp->char_id = key.i;
- return DB->ptr2data(cp);
+ return iDB->ptr2data(cp);
}
int inventory_to_sql(const struct item items[], int max, int id);
@@ -2025,7 +2025,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
{ //Character already online. KICK KICK KICK
mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2);
if (character->waiting_disconnect == INVALID_TIMER)
- character->waiting_disconnect = add_timer(gettick()+20000, chardb_waiting_disconnect, character->account_id, 0);
+ character->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+20000, chardb_waiting_disconnect, character->account_id, 0);
WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = 8;
@@ -2102,7 +2102,7 @@ void loginif_on_ready(void)
loginif_check_shutdown();
//Send online accounts to login server.
- send_accounts_tologin(INVALID_TIMER, gettick(), 0, 0);
+ send_accounts_tologin(INVALID_TIMER, iTimer->gettick(), 0, 0);
// if no map-server already connected, display a message...
ARR_FIND( 0, ARRAYLENGTH(server), i, server[i].fd > 0 && server[i].map[0] );
@@ -2383,7 +2383,7 @@ int parse_fromlogin(int fd) {
{ //Kick it from the map server it is on.
mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2);
if (character->waiting_disconnect == INVALID_TIMER)
- character->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, chardb_waiting_disconnect, character->account_id, 0);
+ character->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, chardb_waiting_disconnect, character->account_id, 0);
}
else
{// Manual kick from char server.
@@ -2452,12 +2452,12 @@ int send_accounts_tologin(int tid, unsigned int tick, int id, intptr_t data);
void do_init_loginif(void)
{
// establish char-login connection if not present
- add_timer_func_list(check_connect_login_server, "check_connect_login_server");
- add_timer_interval(gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000);
+ iTimer->add_timer_func_list(check_connect_login_server, "check_connect_login_server");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000);
// send a list of all online account IDs to login server
- add_timer_func_list(send_accounts_tologin, "send_accounts_tologin");
- add_timer_interval(gettick() + 1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour
+ iTimer->add_timer_func_list(send_accounts_tologin, "send_accounts_tologin");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour
}
void do_final_loginif(void)
@@ -4457,7 +4457,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
*/
static int send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = DB->data2ptr(data);
+ struct online_char_data* character = iDB->data2ptr(data);
int* i = va_arg(ap, int*);
if(character->server > -1)
@@ -4539,7 +4539,7 @@ static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data *character= DB->data2ptr(data);
+ struct online_char_data *character= iDB->data2ptr(data);
if (character->fd != -1)
return 0; //Character still connected
if (character->server == -2) //Unknown server.. set them offline
@@ -4985,15 +4985,15 @@ int do_init(int argc, char **argv) {
do_init_mapif();
// periodically update the overall user count on all mapservers + login server
- add_timer_func_list(broadcast_user_count, "broadcast_user_count");
- add_timer_interval(gettick() + 1000, broadcast_user_count, 0, 0, 5 * 1000);
+ iTimer->add_timer_func_list(broadcast_user_count, "broadcast_user_count");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, broadcast_user_count, 0, 0, 5 * 1000);
// Timer to clear (online_char_db)
- add_timer_func_list(chardb_waiting_disconnect, "chardb_waiting_disconnect");
+ iTimer->add_timer_func_list(chardb_waiting_disconnect, "chardb_waiting_disconnect");
// Online Data timers (checking if char still connected)
- add_timer_func_list(online_data_cleanup, "online_data_cleanup");
- add_timer_interval(gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
+ iTimer->add_timer_func_list(online_data_cleanup, "online_data_cleanup");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
//Cleaning the tables for NULL entrys @ startup [Sirius]
//Chardb clean
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index 977638aad..c9195a380 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -115,7 +115,7 @@ unsigned int auction_create(struct auction_data *auction)
auction->item.expire_time = 0;
auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
- auction->auction_end_timer = add_timer( gettick() + tick , auction_end_timer, auction->auction_id, 0);
+ auction->auction_end_timer = iTimer->add_timer( iTimer->gettick() + tick , auction_end_timer, auction->auction_id, 0);
ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
CREATE(auction_, struct auction_data, 1);
@@ -170,7 +170,7 @@ void auction_delete(struct auction_data *auction)
Sql_ShowDebug(sql_handle);
if( auction->auction_end_timer != INVALID_TIMER )
- delete_timer(auction->auction_end_timer, auction_end_timer);
+ iTimer->delete_timer(auction->auction_end_timer, auction_end_timer);
idb_remove(auction_db_, auction_id);
}
@@ -182,7 +182,7 @@ void inter_auctions_fromsql(void)
struct item *item;
char *data;
StringBuf buf;
- unsigned int tick = gettick(), endtick;
+ unsigned int tick = iTimer->gettick(), endtick;
time_t now = time(NULL);
StrBuf->Init(&buf);
@@ -234,7 +234,7 @@ void inter_auctions_fromsql(void)
else
endtick = tick + 10000; // 10 Second's to process ended auctions
- auction->auction_end_timer = add_timer(endtick, auction_end_timer, auction->auction_id, 0);
+ auction->auction_end_timer = iTimer->add_timer(endtick, auction_end_timer, auction->auction_id, 0);
idb_put(auction_db_, auction->auction_id, auction);
}
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index e1e012725..55f29953f 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -57,7 +57,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
if( last_id == 0 ) //Save the first guild in the list.
state = 1;
- for( g = DB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = DB->data2ptr(iter->next(iter, &key)) )
+ for( g = iDB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = iDB->data2ptr(iter->next(iter, &key)) )
{
if( state == 0 && g->guild_id == last_id )
state++; //Save next guild in the list.
@@ -86,7 +86,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
state = guild_db_->size(guild_db_);
if( state < 1 ) state = 1; //Calculate the time slot for the next save.
- add_timer(tick + autosave_interval/state, guild_save_timer, 0, 0);
+ iTimer->add_timer(tick + autosave_interval/state, guild_save_timer, 0, 0);
return 0;
}
@@ -729,8 +729,8 @@ int inter_guild_sql_init(void)
//Read exp file
sv->readdb("db", DBPATH"exp_guild.txt", ',', 1, 1, 100, exp_guild_parse_row);
- add_timer_func_list(guild_save_timer, "guild_save_timer");
- add_timer(gettick() + 10000, guild_save_timer, 0, 0);
+ iTimer->add_timer_func_list(guild_save_timer, "guild_save_timer");
+ iTimer->add_timer(iTimer->gettick() + 10000, guild_save_timer, 0, 0);
return 0;
}
@@ -739,7 +739,7 @@ int inter_guild_sql_init(void)
*/
static int guild_db_final(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = DB->data2ptr(data);
+ struct guild *g = iDB->data2ptr(data);
if (g->save_flag&GS_MASK) {
inter_guild_tosql(g, g->save_flag&GS_MASK);
return 1;
diff --git a/src/char/inter.c b/src/char/inter.c
index a1b075a14..a9e9dece4 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -935,7 +935,7 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
{
unsigned long tick;
- struct WisData *wd = DB->data2ptr(data);
+ struct WisData *wd = iDB->data2ptr(data);
tick = va_arg(ap, unsigned long);
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
@@ -946,7 +946,7 @@ int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
int check_ttl_wisdata(void)
{
- unsigned long tick = gettick();
+ unsigned long tick = iTimer->gettick();
int i;
do {
@@ -1039,7 +1039,7 @@ int mapif_parse_WisRequest(int fd)
memcpy(wd->src, RFIFOP(fd, 4), NAME_LENGTH);
memcpy(wd->dst, RFIFOP(fd,28), NAME_LENGTH);
memcpy(wd->msg, RFIFOP(fd,52), wd->len);
- wd->tick = gettick();
+ wd->tick = iTimer->gettick();
idb_put(wis_db, wd->id, wd);
mapif_wis_message(wd);
}