diff options
author | Haru <haru@dotalux.com> | 2015-09-14 17:18:03 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-11-14 17:55:17 +0100 |
commit | 71e868683b766633952e501a9cecf705bdc3e334 (patch) | |
tree | 3aea3fb052b93941a0e623d9de7b20210cfcd478 /src/map | |
parent | e29a4597121e047c98cd6e75cfd365794c4b67a4 (diff) | |
download | hercules-71e868683b766633952e501a9cecf705bdc3e334.tar.gz hercules-71e868683b766633952e501a9cecf705bdc3e334.tar.bz2 hercules-71e868683b766633952e501a9cecf705bdc3e334.tar.xz hercules-71e868683b766633952e501a9cecf705bdc3e334.zip |
Fixed some direct accesses to script->hq[] from other modules.
- script->hq[] should only be accessed through the provided interface,
script->queue().
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battleground.c | 28 | ||||
-rw-r--r-- | src/map/clif.c | 2 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c index cc5384d21..cbf859b80 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -496,7 +496,7 @@ void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bo if( !response ) bg->queue_pc_cleanup(sd); else { - struct hQueue *queue = &script->hq[arena->queue_id]; + struct hQueue *queue = script->queue(arena->queue_id); int i, count = 0; sd->bg_queue.ready = 1; @@ -531,7 +531,7 @@ void bg_queue_player_cleanup(struct map_session_data *sd) { sd->bg_queue.type = 0; } void bg_match_over(struct bg_arena *arena, bool canceled) { - struct hQueue *queue = &script->hq[arena->queue_id]; + struct hQueue *queue = script->queue(arena->queue_id); int i; nullpo_retv(arena); @@ -560,7 +560,7 @@ void bg_match_over(struct bg_arena *arena, bool canceled) { script->queue_clear(arena->queue_id); } void bg_begin(struct bg_arena *arena) { - struct hQueue *queue = &script->hq[arena->queue_id]; + struct hQueue *queue = script->queue(arena->queue_id); int i, count = 0; nullpo_retv(arena); @@ -647,9 +647,9 @@ int bg_afk_timer(int tid, int64 tick, int id, intptr_t data) { void bg_queue_pregame(struct bg_arena *arena) { struct hQueue *queue; int i; - nullpo_retv(arena); - queue = &script->hq[arena->queue_id]; + + queue = script->queue(arena->queue_id); for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; @@ -667,9 +667,11 @@ int bg_fillup_timer(int tid, int64 tick, int id, intptr_t data) { void bg_queue_check(struct bg_arena *arena) { int count; - + struct hQueue *queue; nullpo_retv(arena); - count = script->hq[arena->queue_id].items; + + queue = script->queue(arena->queue_id); + count = queue->items; if( count == arena->max_players ) { if( arena->fillup_timer != INVALID_TIMER ) { timer->delete(arena->fillup_timer,bg->fillup_timer); @@ -729,8 +731,8 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q sd->bg_queue.arena = arena; sd->bg_queue.ready = 0; script->queue_add(arena->queue_id,sd->status.account_id); - clif->bgqueue_joined(sd,script->hq[arena->queue_id].items); - clif->bgqueue_update_info(sd,arena->id,script->hq[arena->queue_id].items); + clif->bgqueue_joined(sd, queue->items); + clif->bgqueue_update_info(sd,arena->id, queue->items); break; case BGQT_PARTY: { struct party_data *p = party->search(sd->status.party_id); @@ -740,8 +742,8 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q p->data[i].sd->bg_queue.arena = arena; p->data[i].sd->bg_queue.ready = 0; script->queue_add(arena->queue_id,p->data[i].sd->status.account_id); - clif->bgqueue_joined(p->data[i].sd,script->hq[arena->queue_id].items); - clif->bgqueue_update_info(p->data[i].sd,arena->id,script->hq[arena->queue_id].items); + clif->bgqueue_joined(p->data[i].sd, queue->items); + clif->bgqueue_update_info(p->data[i].sd,arena->id, queue->items); } } break; @@ -753,8 +755,8 @@ void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_q sd->guild->member[i].sd->bg_queue.arena = arena; sd->guild->member[i].sd->bg_queue.ready = 0; script->queue_add(arena->queue_id,sd->guild->member[i].sd->status.account_id); - clif->bgqueue_joined(sd->guild->member[i].sd,script->hq[arena->queue_id].items); - clif->bgqueue_update_info(sd->guild->member[i].sd,arena->id,script->hq[arena->queue_id].items); + clif->bgqueue_joined(sd->guild->member[i].sd, queue->items); + clif->bgqueue_update_info(sd->guild->member[i].sd,arena->id, queue->items); } break; } diff --git a/src/map/clif.c b/src/map/clif.c index 80703fa12..bc4313f46 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -610,7 +610,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target case BG_QUEUE: if( sd && sd->bg_queue.arena ) { - struct hQueue *queue = &script->hq[sd->bg_queue.arena->queue_id]; + struct hQueue *queue = script->queue(sd->bg_queue.arena->queue_id); for( i = 0; i < queue->size; i++ ) { struct map_session_data *qsd = NULL; |