diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-16 12:18:24 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-16 12:18:24 +0000 |
commit | eae90264e5ec4170f716cdf6eed706d3d784233e (patch) | |
tree | 33d56947c216ad4e105707592faedd2e826e9e74 /src/map/battleground.c | |
parent | de678dc8a2d4450a91f9b4c2a205b294a8b678eb (diff) | |
download | hercules-eae90264e5ec4170f716cdf6eed706d3d784233e.tar.gz hercules-eae90264e5ec4170f716cdf6eed706d3d784233e.tar.bz2 hercules-eae90264e5ec4170f716cdf6eed706d3d784233e.tar.xz hercules-eae90264e5ec4170f716cdf6eed706d3d784233e.zip |
* Some cleanups related to player and monster states.
- Moved user_font and bg_id out of states as they are data, not states.
- Reordered members of state structs so that bitfields are packed together (less memory gets wasted).
- Other insignificant code tweaks.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14795 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battleground.c')
-rw-r--r-- | src/map/battleground.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/map/battleground.c b/src/map/battleground.c index 58e3b469c..13f62a042 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -52,7 +52,7 @@ int bg_team_delete(int bg_id) continue; bg_send_dot_remove(sd); - sd->state.bg_id = 0; + sd->bg_id = 0; } idb_remove(bg_team_db, bg_id); return 1; @@ -70,7 +70,7 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y) int bg_send_dot_remove(struct map_session_data *sd) { - if( sd && sd->state.bg_id ) + if( sd && sd->bg_id ) clif_bg_xy_remove(sd); return 0; } @@ -81,12 +81,12 @@ int bg_team_join(int bg_id, struct map_session_data *sd) struct battleground_data *bg = bg_team_search(bg_id); struct map_session_data *pl_sd; - if( bg == NULL || sd == NULL || sd->state.bg_id ) return 0; + if( bg == NULL || sd == NULL || sd->bg_id ) return 0; ARR_FIND(0, MAX_BG_MEMBERS, i, bg->members[i].sd == NULL); if( i == MAX_BG_MEMBERS ) return 0; // No free slots - sd->state.bg_id = bg_id; + sd->bg_id = bg_id; bg->members[i].sd = sd; bg->members[i].x = sd->bl.x; bg->members[i].y = sd->bl.y; @@ -111,12 +111,12 @@ int bg_team_leave(struct map_session_data *sd, int flag) struct battleground_data *bg; char output[128]; - if( sd == NULL || !sd->state.bg_id ) + if( sd == NULL || !sd->bg_id ) return 0; bg_send_dot_remove(sd); - bg_id = sd->state.bg_id; - sd->state.bg_id = 0; + bg_id = sd->bg_id; + sd->bg_id = 0; if( (bg = bg_team_search(bg_id)) == NULL ) return 0; @@ -141,7 +141,7 @@ 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->state.bg_id || (bg = bg_team_search(sd->state.bg_id)) == NULL ) + if( sd == NULL || !pc_isdead(sd) || !sd->bg_id || (bg = bg_team_search(sd->bg_id)) == NULL ) return 0; if( bg->mapindex == 0 ) return 0; // Respawn not handled by Core @@ -177,26 +177,26 @@ int bg_team_get_id(struct block_list *bl) switch( bl->type ) { case BL_PC: - return ((TBL_PC*)bl)->state.bg_id; + return ((TBL_PC*)bl)->bg_id; case BL_PET: if( ((TBL_PET*)bl)->msd ) - return ((TBL_PET*)bl)->msd->state.bg_id; + return ((TBL_PET*)bl)->msd->bg_id; break; case BL_MOB: { struct map_session_data *msd; struct mob_data *md = (TBL_MOB*)bl; if( md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL ) - return msd->state.bg_id; - return md->state.bg_id; + return msd->bg_id; + return md->bg_id; } case BL_HOM: if( ((TBL_HOM*)bl)->master ) - return ((TBL_HOM*)bl)->master->state.bg_id; + return ((TBL_HOM*)bl)->master->bg_id; break; case BL_MER: if( ((TBL_MER*)bl)->master ) - return ((TBL_MER*)bl)->master->state.bg_id; + return ((TBL_MER*)bl)->master->bg_id; break; case BL_SKILL: return ((TBL_SKILL*)bl)->group->bg_id; @@ -210,7 +210,7 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len) struct battleground_data *bg; nullpo_ret(sd); - if( sd->state.bg_id == 0 || (bg = bg_team_search(sd->state.bg_id)) == NULL ) + if( sd->bg_id == 0 || (bg = bg_team_search(sd->bg_id)) == NULL ) return 0; clif_bg_message(bg, sd->bl.id, sd->status.name, mes, len); return 0; |