summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c4
-rw-r--r--src/map/battleground.c119
-rw-r--r--src/map/battleground.h36
-rw-r--r--src/map/clif.c14
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/pc.c14
-rw-r--r--src/map/script.c36
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/unit.c2
10 files changed, 127 insertions, 108 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index e2be5b520..85fa2cb98 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6028,8 +6028,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
int sbg_id = 0, tbg_id = 0;
if( map[m].flag.battleground )
{
- sbg_id = bg_team_get_id(s_bl);
- tbg_id = bg_team_get_id(t_bl);
+ sbg_id = bg->team_get_id(s_bl);
+ tbg_id = bg->team_get_id(t_bl);
}
if( flag&(BCT_PARTY|BCT_ENEMY) )
{
diff --git a/src/map/battleground.c b/src/map/battleground.c
index eb91f0066..e72683880 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -26,13 +26,11 @@
#include <string.h>
#include <stdio.h>
-static DBMap* bg_team_db; // int bg_id -> struct battleground_data*
-static unsigned int bg_team_counter = 0; // Next bg_id
struct battleground_interface bg_s;
struct battleground_data* bg_team_search(int bg_id) { // Search a BG Team using bg_id
if( !bg_id ) return NULL;
- return (struct battleground_data *)idb_get(bg_team_db, bg_id);
+ return (struct battleground_data *)idb_get(bg->team_db, bg_id);
}
struct map_session_data* bg_getavailablesd(struct battleground_data *bg) {
@@ -46,28 +44,28 @@ int bg_team_delete(int bg_id)
{ // Deletes BG Team from db
int i;
struct map_session_data *sd;
- struct battleground_data *bg = bg_team_search(bg_id);
+ struct battleground_data *bgd = bg->team_search(bg_id);
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
{
- if( (sd = bg->members[i].sd) == NULL )
+ if( (sd = bgd->members[i].sd) == NULL )
continue;
- bg_send_dot_remove(sd);
+ bg->send_dot_remove(sd);
sd->bg_id = 0;
}
- idb_remove(bg_team_db, bg_id);
+ idb_remove(bg->team_db, bg_id);
return 1;
}
int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
{ // Warps a Team
int i;
- struct battleground_data *bg = bg_team_search(bg_id);
+ struct battleground_data *bgd = bg->team_search(bg_id);
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
- if( bg->members[i].sd != NULL ) pc->setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
+ if( bgd->members[i].sd != NULL ) pc->setpos(bgd->members[i].sd, mapindex, x, y, CLR_TELEPORT);
return 1;
}
@@ -81,33 +79,33 @@ int bg_send_dot_remove(struct map_session_data *sd)
int bg_team_join(int bg_id, struct map_session_data *sd)
{ // Player joins team
int i;
- struct battleground_data *bg = bg_team_search(bg_id);
+ struct battleground_data *bgd = bg->team_search(bg_id);
struct map_session_data *pl_sd;
if( bg == NULL || sd == NULL || sd->bg_id ) return 0;
- ARR_FIND(0, MAX_BG_MEMBERS, i, bg->members[i].sd == NULL);
+ ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == NULL);
if( i == MAX_BG_MEMBERS ) return 0; // No free slots
sd->bg_id = bg_id;
- bg->members[i].sd = sd;
- bg->members[i].x = sd->bl.x;
- bg->members[i].y = sd->bl.y;
+ bgd->members[i].sd = sd;
+ bgd->members[i].x = sd->bl.x;
+ bgd->members[i].y = sd->bl.y;
/* populate 'where i came from' */
if(map[sd->bl.m].flag.nosave || map[sd->bl.m].instance_id >= 0){
struct map_data *m=&map[sd->bl.m];
if(m->save.map)
- memcpy(&bg->members[i].source,&m->save,sizeof(struct point));
+ memcpy(&bgd->members[i].source,&m->save,sizeof(struct point));
else
- memcpy(&bg->members[i].source,&sd->status.save_point,sizeof(struct point));
+ memcpy(&bgd->members[i].source,&sd->status.save_point,sizeof(struct point));
} else
- memcpy(&bg->members[i].source,&sd->status.last_point,sizeof(struct point));
- bg->count++;
+ memcpy(&bgd->members[i].source,&sd->status.last_point,sizeof(struct point));
+ bgd->count++;
guild->send_dot_remove(sd);
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
- if( (pl_sd = bg->members[i].sd) != NULL && pl_sd != sd )
+ if( (pl_sd = bgd->members[i].sd) != NULL && pl_sd != sd )
clif->hpmeter_single(sd->fd, pl_sd->bl.id, pl_sd->battle_status.hp, pl_sd->battle_status.max_hp);
}
@@ -124,11 +122,11 @@ int bg_team_leave(struct map_session_data *sd, int flag)
if( sd == NULL || !sd->bg_id )
return 0;
- bg_send_dot_remove(sd);
+ bg->send_dot_remove(sd);
bg_id = sd->bg_id;
sd->bg_id = 0;
- if( (bg_data = bg_team_search(bg_id)) == NULL )
+ if( (bg_data = bg->team_search(bg_id)) == NULL )
return 0;
ARR_FIND(0, MAX_BG_MEMBERS, i, bg_data->members[i].sd == sd);
@@ -160,34 +158,34 @@ int bg_team_leave(struct map_session_data *sd, int flag)
int bg_member_respawn(struct map_session_data *sd)
{ // Respawn after killed
- struct battleground_data *bg;
- if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bg = bg_team_search(sd->bg_id)) == NULL )
+ struct battleground_data *bgd;
+ if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bgd = bg->team_search(sd->bg_id)) == NULL )
return 0;
- if( bg->mapindex == 0 )
+ if( bgd->mapindex == 0 )
return 0; // Respawn not handled by Core
- pc->setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
+ pc->setpos(sd, bgd->mapindex, bgd->x, bgd->y, CLR_OUTSIGHT);
iStatus->revive(&sd->bl, 1, 100);
return 1; // Warped
}
int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev) {
- struct battleground_data *bg;
- bg_team_counter++;
-
- CREATE(bg, struct battleground_data, 1);
- bg->bg_id = bg_team_counter;
- bg->count = 0;
- bg->mapindex = mapindex;
- bg->x = rx;
- bg->y = ry;
- safestrncpy(bg->logout_event, ev, sizeof(bg->logout_event));
- safestrncpy(bg->die_event, dev, sizeof(bg->die_event));
-
- memset(&bg->members, 0, sizeof(bg->members));
- idb_put(bg_team_db, bg_team_counter, bg);
-
- return bg->bg_id;
+ struct battleground_data *bgd;
+ bg->team_counter++;
+
+ CREATE(bgd, struct battleground_data, 1);
+ bgd->bg_id = bg->team_counter;
+ bgd->count = 0;
+ bgd->mapindex = mapindex;
+ bgd->x = rx;
+ bgd->y = ry;
+ safestrncpy(bgd->logout_event, ev, sizeof(bgd->logout_event));
+ safestrncpy(bgd->die_event, dev, sizeof(bgd->die_event));
+
+ memset(&bgd->members, 0, sizeof(bgd->members));
+ idb_put(bg->team_db, bg->team_counter, bg);
+
+ return bgd->bg_id;
}
int bg_team_get_id(struct block_list *bl)
@@ -226,12 +224,12 @@ int bg_team_get_id(struct block_list *bl)
int bg_send_message(struct map_session_data *sd, const char *mes, int len)
{
- struct battleground_data *bg;
+ struct battleground_data *bgd;
nullpo_ret(sd);
- if( sd->bg_id == 0 || (bg = bg_team_search(sd->bg_id)) == NULL )
+ if( sd->bg_id == 0 || (bgd = bg->team_search(sd->bg_id)) == NULL )
return 0;
- clif->bg_message(bg, sd->bl.id, sd->status.name, mes, len);
+ clif->bg_message(bgd, sd->bl.id, sd->status.name, mes, len);
return 0;
}
@@ -257,7 +255,7 @@ int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
}
int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data) {
- bg_team_db->foreach(bg_team_db, bg_send_xy_timer_sub, tick);
+ bg->team_db->foreach(bg->team_db, bg->send_xy_timer_sub, tick);
return 0;
}
void bg_config_read(void) {
@@ -497,7 +495,7 @@ void bg_match_over(struct bg_arena *arena, bool canceled) {
if( queue->item[i] > 0 && ( sd = iMap->id2sd(queue->item[i]) ) ) {
if( sd->bg_queue.arena ) {
- bg_team_leave(sd, 0);
+ bg->team_leave(sd, 0);
bg->queue_pc_cleanup(sd);
}
if( canceled )
@@ -570,7 +568,7 @@ void bg_queue_check(struct bg_arena *arena) {
int count = script->hq[arena->queue_id].items;
if( count == arena->max_players ) {
if( arena->fillup_timer != INVALID_TIMER ) {
- iTimer->delete_timer(arena->fillup_timer,bg_fillup_timer);
+ iTimer->delete_timer(arena->fillup_timer,bg->fillup_timer);
arena->fillup_timer = INVALID_TIMER;
}
bg->queue_pregame(arena);
@@ -765,16 +763,16 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_
return BGQA_SUCCESS;
}
void do_init_battleground(void) {
- bg_team_db = idb_alloc(DB_OPT_RELEASE_DATA);
- iTimer->add_timer_func_list(bg_send_xy_timer, "bg_send_xy_timer");
- iTimer->add_timer_interval(iTimer->gettick() + battle_config.bg_update_interval, bg_send_xy_timer, 0, 0, battle_config.bg_update_interval);
+ bg->team_db = idb_alloc(DB_OPT_RELEASE_DATA);
+ iTimer->add_timer_func_list(bg->send_xy_timer, "bg_send_xy_timer");
+ iTimer->add_timer_interval(iTimer->gettick() + battle_config.bg_update_interval, bg->send_xy_timer, 0, 0, battle_config.bg_update_interval);
bg->config_read();
}
void do_final_battleground(void) {
int i;
- bg_team_db->destroy(bg_team_db, NULL);
+ db_destroy(bg->team_db);
for( i = 0; i < bg->arenas; i++ ) {
if( bg->arena[i] )
@@ -793,6 +791,12 @@ void battleground_defaults(void) {
bg->arena = NULL;
bg->arenas = 0;
/* */
+ bg->team_db = NULL;
+ bg->team_counter = 0;
+ /* */
+ bg->init = do_init_battleground;
+ bg->final = do_final_battleground;
+ /* */
bg->name2arena = bg_name2arena;
bg->queue_add = bg_queue_add;
bg->can_queue = bg_canqueue;
@@ -805,6 +809,19 @@ void battleground_defaults(void) {
bg->queue_ready_ack = bg_queue_ready_ack;
bg->match_over = bg_match_over;
bg->queue_check = bg_queue_check;
+ bg->team_search = bg_team_search;
+ bg->getavailablesd = bg_getavailablesd;
+ bg->team_delete = bg_team_delete;
+ bg->team_warp = bg_team_warp;
+ bg->send_dot_remove = bg_send_dot_remove;
+ bg->team_join = bg_team_join;
+ bg->team_leave = bg_team_leave;
+ bg->member_respawn = bg_member_respawn;
+ bg->create = bg_create;
+ bg->team_get_id = bg_team_get_id;
+ bg->send_message = bg_send_message;
+ bg->send_xy_timer_sub = bg_send_xy_timer_sub;
+ bg->send_xy_timer = bg_send_xy_timer;
/* */
bg->config_read = bg_config_read;
}
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 1566e92b8..3edecf902 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -43,22 +43,6 @@ struct battleground_data {
char die_event[EVENT_NAME_LENGTH];
};
-void do_init_battleground(void);
-void do_final_battleground(void);
-
-struct battleground_data* bg_team_search(int bg_id);
-int bg_send_dot_remove(struct map_session_data *sd);
-int bg_team_get_id(struct block_list *bl);
-struct map_session_data* bg_getavailablesd(struct battleground_data *bg);
-
-int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev);
-int bg_team_join(int bg_id, struct map_session_data *sd);
-int bg_team_delete(int bg_id);
-int bg_team_leave(struct map_session_data *sd, int flag);
-int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y);
-int bg_member_respawn(struct map_session_data *sd);
-int bg_send_message(struct map_session_data *sd, const char *mes, int len);
-
struct bg_arena {
char name[NAME_LENGTH];
unsigned char id;
@@ -79,7 +63,6 @@ struct bg_arena {
bool ongoing;
};
-/* battleground.c interface (incomplete) */
struct battleground_interface {
bool queue_on;
/* */
@@ -89,6 +72,12 @@ struct battleground_interface {
struct bg_arena **arena;
unsigned char arenas;
/* */
+ DBMap *team_db; // int bg_id -> struct battleground_data*
+ unsigned int team_counter; // Next bg_id
+ /* */
+ void (*init) (void);
+ void (*final) (void);
+ /* */
struct bg_arena *(*name2arena) (char *name);
void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
enum BATTLEGROUNDS_QUEUE_ACK (*can_queue) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
@@ -101,6 +90,19 @@ struct battleground_interface {
void (*queue_ready_ack) (struct bg_arena *arena, struct map_session_data *sd, bool response);
void (*match_over) (struct bg_arena *arena, bool canceled);
void (*queue_check) (struct bg_arena *arena);
+ struct battleground_data* (*team_search) (int bg_id);
+ struct map_session_data* (*getavailablesd) (struct battleground_data *bg);
+ int (*team_delete) (int bg_id);
+ int (*team_warp) (int bg_id, unsigned short mapindex, short x, short y);
+ int (*send_dot_remove) (struct map_session_data *sd);
+ int (*team_join) (int bg_id, struct map_session_data *sd);
+ int (*team_leave) (struct map_session_data *sd, int flag);
+ int (*member_respawn) (struct map_session_data *sd);
+ int (*create) (unsigned short mapindex, short rx, short ry, const char *ev, const char *dev);
+ int (*team_get_id) (struct block_list *bl);
+ int (*send_message) (struct map_session_data *sd, const char *mes, int len);
+ int (*send_xy_timer_sub) (DBKey key, DBData *data, va_list ap);
+ int (*send_xy_timer) (int tid, unsigned int tick, int id, intptr_t data);
/* */
void (*config_read) (void);
};
diff --git a/src/map/clif.c b/src/map/clif.c
index bdb7eefc7..f55dcdf08 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -339,7 +339,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
struct map_session_data *sd, *tsd;
struct party_data *p = NULL;
struct guild *g = NULL;
- struct battleground_data *bg = NULL;
+ struct battleground_data *bgd = NULL;
int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd;
struct s_mapiterator* iter;
@@ -545,9 +545,9 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
case BG_SAMEMAP_WOS:
case BG:
case BG_WOS:
- if( sd && sd->bg_id && (bg = bg_team_search(sd->bg_id)) != NULL ) {
+ if( sd && sd->bg_id && (bgd = bg->team_search(sd->bg_id)) != NULL ) {
for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
- if( (sd = bg->members[i].sd) == NULL || !(fd = sd->fd) )
+ if( (sd = bgd->members[i].sd) == NULL || !(fd = sd->fd) )
continue;
if( sd->bl.id == bl->id && (type == BG_WOS || type == BG_SAMEMAP_WOS || type == BG_AREA_WOS) )
continue;
@@ -13047,7 +13047,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
}
if( sd->bg_id )
- bg_send_message(sd, text, textlen);
+ bg->send_message(sd, text, textlen);
else
guild->send_message(sd, text, textlen);
}
@@ -15920,11 +15920,11 @@ void clif_bg_xy_remove(struct map_session_data *sd)
/// Notifies clients of a battleground message (ZC_BATTLEFIELD_CHAT).
/// 02dc <packet len>.W <account id>.L <name>.24B <message>.?B
-void clif_bg_message(struct battleground_data *bg, int src_id, const char *name, const char *mes, int len)
+void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, int len)
{
struct map_session_data *sd;
unsigned char *buf;
- if( !bg->count || (sd = bg_getavailablesd(bg)) == NULL )
+ if( !bgd->count || (sd = bg->getavailablesd(bgd)) == NULL )
return;
buf = (unsigned char*)aMalloc((len + NAME_LENGTH + 8)*sizeof(unsigned char));
@@ -15966,7 +15966,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
- bg_send_message(sd, text, textlen);
+ bg->send_message(sd, text, textlen);
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 73d3611a2..35e3e75f3 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -826,7 +826,7 @@ struct clif_interface {
void (*bg_hp) (struct map_session_data *sd);
void (*bg_xy) (struct map_session_data *sd);
void (*bg_xy_remove) (struct map_session_data *sd);
- void (*bg_message) (struct battleground_data *bg, int src_id, const char *name, const char *mes, int len);
+ void (*bg_message) (struct battleground_data *bgd, int src_id, const char *name, const char *mes, int len);
void (*bg_updatescore) (int16 m);
void (*bg_updatescore_single) (struct map_session_data *sd);
void (*sendbgemblem_area) (struct map_session_data *sd);
diff --git a/src/map/map.c b/src/map/map.c
index 5cc475ad7..a1c78f35b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1540,7 +1540,7 @@ int map_quit(struct map_session_data *sd) {
npc->event_dequeue(sd);
if( sd->bg_id && !sd->bg_queue.arena ) /* TODO: dump this chunk after bg_queue is fully enabled */
- bg_team_leave(sd,1);
+ bg->team_leave(sd,1);
skill->cooldown_save(sd);
pc->itemcd_do(sd,false);
@@ -4951,7 +4951,7 @@ void do_final(void)
skill->final();
iStatus->do_final_status();
unit->final();
- do_final_battleground();
+ bg->final();
iDuel->do_final_duel();
elemental->do_final_elemental();
do_final_maps();
@@ -5427,7 +5427,7 @@ int do_init(int argc, char *argv[])
quest->init();
npc->init();
unit->init();
- do_init_battleground();
+ bg->init();
iDuel->do_init_duel();
vending->init();
diff --git a/src/map/pc.c b/src/map/pc.c
index 6399d9f25..b8380a840 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4908,7 +4908,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
skill->clear_unitgroup(&sd->bl);
party->send_dot_remove(sd); //minimap dot fix [Kevin]
guild->send_dot_remove(sd);
- bg_send_dot_remove(sd);
+ bg->send_dot_remove(sd);
if (sd->regen.state.gc)
sd->regen.state.gc = 0;
// make sure vending is allowed here
@@ -6656,7 +6656,7 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype)
{
if( !pc_isdead(sd) )
return; // not applicable
- if( sd->bg_id && bg_member_respawn(sd) )
+ if( sd->bg_id && bg->member_respawn(sd) )
return; // member revived by battleground
pc->setstand(sd);
@@ -6761,9 +6761,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
pc->setparam(sd, SP_KILLERRID, src?src->id:0);
if( sd->bg_id ) {/* TODO: purge when bgqueue is deemed ok */
- struct battleground_data *bg;
- if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] )
- npc->event(sd, bg->die_event, 0);
+ struct battleground_data *bgd;
+ if( (bgd = bg->team_search(sd->bg_id)) != NULL && bgd->die_event[0] )
+ npc->event(sd, bgd->die_event, 0);
}
for( i = 0; i < sd->queues_count; i++ ) {
@@ -7036,8 +7036,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
iTimer->add_timer(tick+1, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
} else if( sd->bg_id ) {
- struct battleground_data *bg = bg_team_search(sd->bg_id);
- if( bg && bg->mapindex > 0 ) { // Respawn by BG
+ struct battleground_data *bgd = bg->team_search(sd->bg_id);
+ if( bgd && bgd->mapindex > 0 ) { // Respawn by BG
iTimer->add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
}
diff --git a/src/map/script.c b/src/map/script.c
index efd743d13..547d1e87e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15747,7 +15747,7 @@ BUILDIN(waitingroom2bg)
ev = script_getstr(st,5); // Logout Event
dev = script_getstr(st,6); // Die Event
- if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 )
+ if( (bg_id = bg->create(mapindex, x, y, ev, dev)) == 0 )
{ // Creation failed
script_pushint(st,0);
return true;
@@ -15756,7 +15756,7 @@ BUILDIN(waitingroom2bg)
n = cd->users;
for( i = 0; i < n && i < MAX_BG_MEMBERS; i++ )
{
- if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) )
+ if( (sd = cd->usersd[i]) != NULL && bg->team_join(bg_id, sd) )
mapreg->setreg(reference_uid(script->add_str("$@arenamembers"), i), sd->bl.id);
else
mapreg->setreg(reference_uid(script->add_str("$@arenamembers"), i), 0);
@@ -15790,7 +15790,7 @@ BUILDIN(waitingroom2bg_single)
if( (sd = cd->usersd[0]) == NULL )
return true;
- if( bg_team_join(bg_id, sd) )
+ if( bg->team_join(bg_id, sd) )
{
pc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
script_pushint(st,1);
@@ -15803,15 +15803,15 @@ BUILDIN(waitingroom2bg_single)
BUILDIN(bg_team_setxy)
{
- struct battleground_data *bg;
+ struct battleground_data *bgd;
int bg_id;
bg_id = script_getnum(st,2);
- if( (bg = bg_team_search(bg_id)) == NULL )
+ if( (bgd = bg->team_search(bg_id)) == NULL )
return true;
- bg->x = script_getnum(st,3);
- bg->y = script_getnum(st,4);
+ bgd->x = script_getnum(st,3);
+ bgd->y = script_getnum(st,4);
return true;
}
@@ -15826,7 +15826,7 @@ BUILDIN(bg_warp)
return true; // Invalid Map
x = script_getnum(st,4);
y = script_getnum(st,5);
- bg_team_warp(bg_id, mapindex, x, y);
+ bg->team_warp(bg_id, mapindex, x, y);
return true;
}
@@ -15873,14 +15873,14 @@ BUILDIN(bg_leave)
if( sd == NULL || !sd->bg_id )
return true;
- bg_team_leave(sd,0);
+ bg->team_leave(sd,0);
return true;
}
BUILDIN(bg_destroy)
{
int bg_id = script_getnum(st,2);
- bg_team_delete(bg_id);
+ bg->team_delete(bg_id);
return true;
}
@@ -15890,13 +15890,13 @@ BUILDIN(bg_getareausers)
int16 m, x0, y0, x1, y1;
int bg_id;
int i = 0, c = 0;
- struct battleground_data *bg = NULL;
+ struct battleground_data *bgd = NULL;
struct map_session_data *sd;
bg_id = script_getnum(st,2);
str = script_getstr(st,3);
- if( (bg = bg_team_search(bg_id)) == NULL || (m = iMap->mapname2mapid(str)) < 0 )
+ if( (bgd = bg->team_search(bg_id)) == NULL || (m = iMap->mapname2mapid(str)) < 0 )
{
script_pushint(st,0);
return true;
@@ -15909,7 +15909,7 @@ BUILDIN(bg_getareausers)
for( i = 0; i < MAX_BG_MEMBERS; i++ )
{
- if( (sd = bg->members[i].sd) == NULL )
+ if( (sd = bgd->members[i].sd) == NULL )
continue;
if( sd->bl.m != m || sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1 )
continue;
@@ -15938,11 +15938,11 @@ BUILDIN(bg_updatescore)
BUILDIN(bg_get_data)
{
- struct battleground_data *bg;
+ struct battleground_data *bgd;
int bg_id = script_getnum(st,2),
type = script_getnum(st,3);
- if( (bg = bg_team_search(bg_id)) == NULL )
+ if( (bgd = bg->team_search(bg_id)) == NULL )
{
script_pushint(st,0);
return true;
@@ -15950,7 +15950,7 @@ BUILDIN(bg_get_data)
switch( type )
{
- case 0: script_pushint(st, bg->count); break;
+ case 0: script_pushint(st, bgd->count); break;
default:
ShowError("script:bg_get_data: unknown data identifier %d\n", type);
break;
@@ -17545,7 +17545,7 @@ BUILDIN(bg_create_team) {
x = script_getnum(st,3);
y = script_getnum(st,4);
- if( (bg_id = bg_create(mapindex, x, y, ev, dev)) == 0 ) { // Creation failed
+ if( (bg_id = bg->create(mapindex, x, y, ev, dev)) == 0 ) { // Creation failed
script_pushint(st,-1);
} else
script_pushint(st,bg_id);
@@ -17568,7 +17568,7 @@ BUILDIN(bg_join_team) {
if( !sd )
script_pushint(st, 1);
else
- script_pushint(st,bg_team_join(team_id, sd)?0:1);
+ script_pushint(st,bg->team_join(team_id, sd)?0:1);
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index ded169677..6ec9d2fec 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -15276,7 +15276,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
group->src_id = src->id;
group->party_id = iStatus->get_party_id(src);
group->guild_id = iStatus->get_guild_id(src);
- group->bg_id = bg_team_get_id(src);
+ group->bg_id = bg->team_get_id(src);
group->group_id = skill_get_new_group_id();
group->unit = (struct skill_unit *)aCalloc(count,sizeof(struct skill_unit));
group->unit_count = count;
diff --git a/src/map/unit.c b/src/map/unit.c
index ee9920e4b..0551baaea 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2185,7 +2185,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
}
party->send_dot_remove(sd);//minimap dot fix [Kevin]
guild->send_dot_remove(sd);
- bg_send_dot_remove(sd);
+ bg->send_dot_remove(sd);
if( map[bl->m].users <= 0 || sd->state.debug_remove_map )
{// this is only place where map users is decreased, if the mobs were removed too soon then this function was executed too many times [FlavioJS]