diff options
author | Haruna <haru@dotalux.com> | 2014-01-16 17:21:39 -0800 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-01-16 17:21:39 -0800 |
commit | e9affc57d6a03e0cc860f8364c8a349e22906b4a (patch) | |
tree | cc85d2c1109ce7385bee4c211af5027ae591ebab /src/map/battleground.c | |
parent | 4874a3cf8b107457b703d0ece8d5102b08ef7702 (diff) | |
parent | 0267cad28133b4c245f1cf100a24ab8a14cf2a73 (diff) | |
download | hercules-e9affc57d6a03e0cc860f8364c8a349e22906b4a.tar.gz hercules-e9affc57d6a03e0cc860f8364c8a349e22906b4a.tar.bz2 hercules-e9affc57d6a03e0cc860f8364c8a349e22906b4a.tar.xz hercules-e9affc57d6a03e0cc860f8364c8a349e22906b4a.zip |
Merge pull request #251 from panikon/master
Function types behaviour
Diffstat (limited to 'src/map/battleground.c')
-rw-r--r-- | src/map/battleground.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c index 96d39aa45..ab44b0953 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -42,12 +42,12 @@ struct map_session_data* bg_getavailablesd(struct battleground_data *bgd) { } /// Deletes BG Team from db -int bg_team_delete(int bg_id) { +bool bg_team_delete(int bg_id) { int i; struct map_session_data *sd; struct battleground_data *bgd = bg->team_search(bg_id); - if( bgd == NULL ) return 0; + if( bgd == NULL ) return false; for( i = 0; i < MAX_BG_MEMBERS; i++ ) { if( (sd = bgd->members[i].sd) == NULL ) continue; @@ -56,35 +56,34 @@ int bg_team_delete(int bg_id) { sd->bg_id = 0; } idb_remove(bg->team_db, bg_id); - return 1; + return true; } /// Warps a Team -int bg_team_warp(int bg_id, unsigned short map_index, short x, short y) { +bool bg_team_warp(int bg_id, unsigned short map_index, short x, short y) { int i; struct battleground_data *bgd = bg->team_search(bg_id); - if( bgd == NULL ) return 0; + if( bgd == NULL ) return false; for( i = 0; i < MAX_BG_MEMBERS; i++ ) if( bgd->members[i].sd != NULL ) pc->setpos(bgd->members[i].sd, map_index, x, y, CLR_TELEPORT); - return 1; + return true; } -int bg_send_dot_remove(struct map_session_data *sd) { +void bg_send_dot_remove(struct map_session_data *sd) { if( sd && sd->bg_id ) clif->bg_xy_remove(sd); - return 0; } /// Player joins team -int bg_team_join(int bg_id, struct map_session_data *sd) { +bool bg_team_join(int bg_id, struct map_session_data *sd) { int i; struct battleground_data *bgd = bg->team_search(bg_id); struct map_session_data *pl_sd; - if( bgd == NULL || sd == NULL || sd->bg_id ) return 0; + if( bgd == NULL || sd == NULL || sd->bg_id ) return false; ARR_FIND(0, MAX_BG_MEMBERS, i, bgd->members[i].sd == NULL); - if( i == MAX_BG_MEMBERS ) return 0; // No free slots + if( i == MAX_BG_MEMBERS ) return false; // No free slots sd->bg_id = bg_id; bgd->members[i].sd = sd; @@ -110,7 +109,7 @@ int bg_team_join(int bg_id, struct map_session_data *sd) { clif->bg_hp(sd); clif->bg_xy(sd); - return 1; + return true; } /// Single Player leaves team @@ -156,16 +155,16 @@ int bg_team_leave(struct map_session_data *sd, int flag) { } /// Respawn after killed -int bg_member_respawn(struct map_session_data *sd) { +bool bg_member_respawn(struct map_session_data *sd) { struct battleground_data *bgd; if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bgd = bg->team_search(sd->bg_id)) == NULL ) - return 0; + return false; if( bgd->mapindex == 0 ) - return 0; // Respawn not handled by Core + return false; // Respawn not handled by Core pc->setpos(sd, bgd->mapindex, bgd->x, bgd->y, CLR_OUTSIGHT); status->revive(&sd->bl, 1, 100); - return 1; // Warped + return true; // Warped } int bg_create(unsigned short map_index, short rx, short ry, const char *ev, const char *dev) { @@ -219,14 +218,14 @@ int bg_team_get_id(struct block_list *bl) { return 0; } -int bg_send_message(struct map_session_data *sd, const char *mes, int len) { +bool bg_send_message(struct map_session_data *sd, const char *mes, int len) { struct battleground_data *bgd; nullpo_ret(sd); if( sd->bg_id == 0 || (bgd = bg->team_search(sd->bg_id)) == NULL ) - return 0; + return false; // Couldn't send message clif->bg_message(bgd, sd->bl.id, sd->status.name, mes, len); - return 0; + return true; } /** |