summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-09 01:25:19 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-09 01:25:19 +0000
commit8bd7cb69b1242ac0bf42a6bb3f77afda516d1fe9 (patch)
treee8dbfa89bca142b0813f16392a291dcbccc174bb /src/map
parent5487756030da284dd45d9114e6c820154607af6c (diff)
downloadhercules-8bd7cb69b1242ac0bf42a6bb3f77afda516d1fe9.tar.gz
hercules-8bd7cb69b1242ac0bf42a6bb3f77afda516d1fe9.tar.bz2
hercules-8bd7cb69b1242ac0bf42a6bb3f77afda516d1fe9.tar.xz
hercules-8bd7cb69b1242ac0bf42a6bb3f77afda516d1fe9.zip
* Added const to the return value of get_timer.
* Added a maximum timer interval. Avoids server shutdowns being delayed for ~10 seconds under some circumstances on windows. * Replaced the fake timer heap (ordered array) with a binary min heap. (actually, this is just a merge and has been in use for months) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12926 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/npc.c6
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/unit.c6
4 files changed, 9 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3338a3b04..1bdbf0697 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -4787,8 +4787,8 @@ char* txt_time(unsigned int duration)
*------------------------------------------*/
int atcommand_servertime(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
- struct TimerData * timer_data;
- struct TimerData * timer_data2;
+ const struct TimerData * timer_data;
+ const struct TimerData * timer_data2;
time_t time_server; // variable for number of seconds (used with time() function)
struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ...
char temp[256];
diff --git a/src/map/npc.c b/src/map/npc.c
index c987bd5b8..827ee76f8 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -511,7 +511,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
int npc_timerevent_stop(struct npc_data* nd)
{
struct map_session_data *sd =NULL;
- struct TimerData *td = NULL;
+ const struct TimerData *td = NULL;
int *tid;
nullpo_retr(0, nd);
if (nd->u.scr.rid) {
@@ -541,7 +541,7 @@ int npc_timerevent_stop(struct npc_data* nd)
*------------------------------------------*/
void npc_timerevent_quit(struct map_session_data* sd)
{
- struct TimerData *td;
+ const struct TimerData *td;
struct npc_data* nd;
struct timer_event_data *ted;
if (sd->npc_timer_id == -1)
@@ -1378,7 +1378,7 @@ int npc_unload(struct npc_data* nd)
{
ev_db->foreach(ev_db,npc_unload_ev,nd->exname); //Clean up all events related.
if (nd->u.scr.timerid != -1) {
- struct TimerData *td = NULL;
+ const struct TimerData *td = NULL;
td = get_timer(nd->u.scr.timerid);
if (td && td->data)
ers_free(timer_event_ers, (void*)td->data);
diff --git a/src/map/skill.c b/src/map/skill.c
index ece5ca0af..1ed9b8268 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6907,7 +6907,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
int sec = skill_get_time2(sg->skill_id,sg->skill_lv);
if (status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8))
{
- struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
+ const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
if (td) sec = DIFF_TICK(td->tick, tick);
map_moveblock(bl, src->bl.x, src->bl.y, tick);
clif_fixpos(bl);
diff --git a/src/map/unit.c b/src/map/unit.c
index d836a01e5..8da6ecddd 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -644,7 +644,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,int type)
int unit_stop_walking(struct block_list *bl,int type)
{
struct unit_data *ud;
- struct TimerData *data;
+ const struct TimerData* td;
unsigned int tick;
nullpo_retr(0, bl);
@@ -654,13 +654,13 @@ int unit_stop_walking(struct block_list *bl,int type)
//NOTE: We are using timer data after deleting it because we know the
//delete_timer function does not messes with it. If the function's
//behaviour changes in the future, this code could break!
- data = get_timer(ud->walktimer);
+ td = get_timer(ud->walktimer);
delete_timer(ud->walktimer, unit_walktoxy_timer);
ud->walktimer = -1;
ud->state.change_walk_target = 0;
tick = gettick();
if ((type&0x02 && !ud->walkpath.path_pos) //Force moving at least one cell.
- || (data && DIFF_TICK(data->tick, tick) <= data->data/2)) //Enough time has passed to cover half-cell
+ || (td && DIFF_TICK(td->tick, tick) <= td->data/2)) //Enough time has passed to cover half-cell
{
ud->walkpath.path_len = ud->walkpath.path_pos+1;
unit_walktoxy_timer(-1, tick, bl->id, ud->walkpath.path_pos);