diff options
-rw-r--r-- | Changelog-Trunk.txt | 5 | ||||
-rw-r--r-- | src/map/atcommand.c | 8 | ||||
-rw-r--r-- | src/map/battleground.c | 30 | ||||
-rw-r--r-- | src/map/clif.c | 47 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/mob.h | 24 | ||||
-rw-r--r-- | src/map/pc.c | 10 | ||||
-rw-r--r-- | src/map/pc.h | 103 | ||||
-rw-r--r-- | src/map/script.c | 12 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
11 files changed, 127 insertions, 120 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 1788841ee..d6d67176f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,10 @@ Date Added +2011/04/16 + * Some cleanups related to player and monster states. [Ai4rei] + - 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. 2011/04/13 * Added missing 0x369 packet.(info provided by Yommy) [Inkfish] 2011/04/10 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b51e7ce95..44c341cab 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8568,9 +8568,9 @@ ACMD_FUNC(font) font_id = atoi(message); if( font_id == 0 ) { - if( sd->state.user_font ) + if( sd->user_font ) { - sd->state.user_font = 0; + sd->user_font = 0; clif_displaymessage(fd, "Returning to normal font."); clif_font(sd); } @@ -8582,9 +8582,9 @@ ACMD_FUNC(font) } else if( font_id < 0 || font_id > 9 ) clif_displaymessage(fd, "Invalid font. Use a Value from 0 to 9."); - else if( font_id != sd->state.user_font ) + else if( font_id != sd->user_font ) { - sd->state.user_font = font_id; + sd->user_font = font_id; clif_font(sd); clif_displaymessage(fd, "Font changed."); } 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; diff --git a/src/map/clif.c b/src/map/clif.c index e4105c170..d1338314f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -451,7 +451,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target if( !(fd=sd->fd) ) continue; - if( type == GUILD_NOBG && sd->state.bg_id ) + if( type == GUILD_NOBG && sd->bg_id ) continue; if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) @@ -498,7 +498,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target case BG_SAMEMAP_WOS: case BG: case BG_WOS: - if( sd && sd->state.bg_id && (bg = bg_team_search(sd->state.bg_id)) != NULL ) + if( sd && sd->bg_id && (bg = bg_team_search(sd->bg_id)) != NULL ) { for( i = 0; i < MAX_BG_MEMBERS; i++ ) { @@ -910,7 +910,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool return packet_len(WBUFW(buffer,0)); #endif #if PACKETVER >= 20080102 - WBUFW(buf,53) = sd?sd->state.user_font:0; + WBUFW(buf,53) = sd?sd->user_font:0; #endif #if PACKETVER >= 20091103 strcpy((char*)WBUFP(buf,55), name); @@ -1006,7 +1006,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un WBUFB(buf,57) = (sd)? 5 : 0; WBUFW(buf,58) = clif_setlevel(status_get_lv(bl)); #if PACKETVER >= 20080102 - WBUFW(buf,60) = sd?sd->state.user_font:0; + WBUFW(buf,60) = sd?sd->user_font:0; #endif #if PACKETVER >= 20091103 strcpy((char*)WBUFP(buf,62), name); @@ -1144,7 +1144,7 @@ int clif_spawn(struct block_list *bl) clif_specialeffect(bl,423,AREA); else if(sd->state.size==1) clif_specialeffect(bl,421,AREA); - if( sd->state.bg_id && map[sd->bl.m].flag.battleground ) + if( sd->bg_id && map[sd->bl.m].flag.battleground ) clif_sendbgemblem_area(sd); } break; @@ -2350,7 +2350,7 @@ int clif_guild_xy(struct map_session_data *sd) *------------------------------------------*/ int clif_guild_xy_single(int fd, struct map_session_data *sd) { - if( sd->state.bg_id ) + if( sd->bg_id ) return 0; WFIFOHEAD(fd,packet_len(0x1eb)); @@ -2449,7 +2449,7 @@ int clif_updatestatus(struct map_session_data *sd,int type) clif_hpmeter(sd); if( !battle_config.party_hp_mode && sd->status.party_id ) clif_party_hp(sd); - if( sd->state.bg_id ) + if( sd->bg_id ) clif_bg_hp(sd); break; case SP_SP: @@ -3649,7 +3649,7 @@ static void clif_getareachar_pc(struct map_session_data* sd,struct map_session_d clif_spiritball_single(sd->fd, dstsd); if( (sd->status.party_id && dstsd->status.party_id == sd->status.party_id) || //Party-mate, or hpdisp setting. - (sd->state.bg_id && sd->state.bg_id == dstsd->state.bg_id) || //BattleGround + (sd->bg_id && sd->bg_id == dstsd->bg_id) || //BattleGround (battle_config.disp_hpmeter && (gmlvl = pc_isGM(sd)) >= battle_config.disp_hpmeter && gmlvl >= pc_isGM(dstsd)) ) clif_hpmeter_single(sd->fd, dstsd->bl.id, dstsd->battle_status.hp, dstsd->battle_status.max_hp); @@ -3692,7 +3692,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) clif_specialeffect_single(bl,423,sd->fd); else if(tsd->state.size==1) clif_specialeffect_single(bl,421,sd->fd); - if( tsd->state.bg_id && map[tsd->bl.m].flag.battleground ) + if( tsd->bg_id && map[tsd->bl.m].flag.battleground ) clif_sendbgemblem_single(sd->fd,tsd); } break; @@ -8443,13 +8443,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_party_hp(sd); // Show hp after displacement [LuzZza] } - if( sd->state.bg_id ) clif_bg_hp(sd); // BattleGround System - if( sd->state.changemap && map[sd->bl.m].flag.battleground ) - { - clif_map_type(sd, MAPTYPE_BATTLEFIELD); // Battleground Mode - if( map[sd->bl.m].flag.battleground == 2 ) - clif_bg_updatescore_single(sd); - } + if( sd->bg_id ) clif_bg_hp(sd); // BattleGround System if(map[sd->bl.m].flag.pvp) { if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] @@ -8606,6 +8600,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_status_load(&sd->bl, SI_NIGHT, 0); } + if( map[sd->bl.m].flag.battleground ) + { + clif_map_type(sd, MAPTYPE_BATTLEFIELD); // Battleground Mode + if( map[sd->bl.m].flag.battleground == 2 ) + clif_bg_updatescore_single(sd); + } + if( map[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) ) { char output[128]; @@ -10928,7 +10929,7 @@ void clif_parse_GuildCheckMaster(int fd, struct map_session_data *sd) *------------------------------------------*/ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) { - if( !sd->status.guild_id && !sd->state.bg_id ) + if( !sd->status.guild_id && !sd->bg_id ) return; switch( RFIFOL(fd,2) ) @@ -11076,7 +11077,7 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) clif_displaymessage(fd, msg_txt(228)); return; } - if( sd->state.bg_id ) + if( sd->bg_id ) { clif_displaymessage(fd, "You can't leave battleground guilds."); return; @@ -11091,7 +11092,7 @@ void clif_parse_GuildLeave(int fd,struct map_session_data *sd) *------------------------------------------*/ void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) { - if( map[sd->bl.m].flag.guildlock || sd->state.bg_id ) + if( map[sd->bl.m].flag.guildlock || sd->bg_id ) { // Guild locked. clif_displaymessage(fd, msg_txt(228)); return; @@ -11128,7 +11129,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) sd->cantalk_tick = gettick() + battle_config.min_chat_delay; } - if( sd->state.bg_id ) + if( sd->bg_id ) bg_send_message(sd, text, textlen); else guild_send_message(sd, text, textlen); @@ -13859,7 +13860,7 @@ int clif_sendbgemblem_area(struct map_session_data *sd) WBUFW(buf, 0) = 0x2dd; WBUFL(buf,2) = sd->bl.id; safestrncpy((char*)WBUFP(buf,6), sd->status.name, NAME_LENGTH); // name don't show in screen. - WBUFW(buf,30) = sd->state.bg_id; + WBUFW(buf,30) = sd->bg_id; clif_send(buf,packet_len(0x2dd), &sd->bl, AREA); return 0; } @@ -13871,7 +13872,7 @@ int clif_sendbgemblem_single(int fd, struct map_session_data *sd) WFIFOW(fd,0) = 0x2dd; WFIFOL(fd,2) = sd->bl.id; safestrncpy((char*)WFIFOP(fd,6), sd->status.name, NAME_LENGTH); - WFIFOW(fd,30) = sd->state.bg_id; + WFIFOW(fd,30) = sd->bg_id; WFIFOSET(fd,packet_len(0x2dd)); return 0; } @@ -13886,7 +13887,7 @@ int clif_font(struct map_session_data *sd) nullpo_ret(sd); WBUFW(buf,0) = 0x2ef; WBUFL(buf,2) = sd->bl.id; - WBUFW(buf,6) = sd->state.user_font; + WBUFW(buf,6) = sd->user_font; clif_send(buf, packet_len(0x2ef), &sd->bl, AREA); return 1; } diff --git a/src/map/guild.c b/src/map/guild.c index 7eb572660..47abf3cac 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -325,7 +325,7 @@ int guild_send_xy_timer_sub(DBKey key,void *data,va_list ap) for(i=0;i<g->max_member;i++){ //struct map_session_data* sd = g->member[i].sd; struct map_session_data* sd = map_charid2sd(g->member[i].char_id); // temporary crashfix - if( sd != NULL && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->state.bg_id ) + if( sd != NULL && (sd->guild_x != sd->bl.x || sd->guild_y != sd->bl.y) && !sd->bg_id ) { clif_guild_xy(sd); sd->guild_x = sd->bl.x; diff --git a/src/map/mob.c b/src/map/mob.c index 1626f49a0..892ad269a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -667,7 +667,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam /*========================================== * Summoning BattleGround [Zephyrus] *------------------------------------------*/ -int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int bg_id) +int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, unsigned int bg_id) { struct mob_data *md = NULL; struct spawn_data data; @@ -704,7 +704,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int md = mob_spawn_dataset(&data); mob_spawn(md); - md->state.bg_id = bg_id; // BG Team ID + md->bg_id = bg_id; // BG Team ID return md->bl.id; } diff --git a/src/map/mob.h b/src/map/mob.h index ce896646c..6978d7ebc 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -113,32 +113,31 @@ struct mob_data { struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex] char name[NAME_LENGTH]; struct { - unsigned size : 2; //Small/Big monsters. - unsigned ai : 2; //Special ai for summoned monsters. + unsigned int size : 2; //Small/Big monsters. + unsigned int ai : 2; //Special ai for summoned monsters. //0: Normal mob. //1: Standard summon, attacks mobs. //2: Alchemist Marine Sphere //3: Alchemist Summon Flora } special_state; //Special mob information that does not needs to be zero'ed on mob respawn. struct { + unsigned int aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex] + unsigned int steal_coin_flag : 1; + unsigned int soul_change_flag : 1; // Celest + unsigned int alchemist: 1; + unsigned int spotted: 1; + unsigned int npc_killmonster: 1; //for new killmonster behavior + unsigned int rebirth: 1; // NPC_Rebirth used enum MobSkillState skillstate; - unsigned aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex] unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus] - unsigned steal_coin_flag : 1; - unsigned soul_change_flag : 1; // Celest - unsigned alchemist: 1; - unsigned spotted: 1; unsigned char attacked_count; //For rude attacked. int provoke_flag; // Celest - unsigned npc_killmonster: 1; //for new killmonster behavior - unsigned rebirth: 1; // NPC_Rebirth used - unsigned int bg_id; // BattleGround System } state; struct guardian_data* guardian_data; struct { int id; unsigned int dmg; - unsigned flag : 2; //0: Normal. 1: Homunc exp. 2: Pet exp + unsigned int flag : 2; //0: Normal. 1: Homunc exp. 2: Pet exp } dmglog[DAMAGELOG_SIZE]; struct spawn_data *spawn; //Spawn data. int spawn_timer; //Required for Convex Mirror @@ -149,6 +148,7 @@ struct mob_data { int level; int target_id,attacked_id; int areanpc_id; //Required in OnTouchNPC (to avoid multiple area touchs) + unsigned int bg_id; // BattleGround System unsigned int next_walktime,last_thinktime,last_linktime,last_pcneartime; short move_fail_count; @@ -230,7 +230,7 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i bool mob_ksprotected (struct block_list *src, struct block_list *target); int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian, bool has_index); // Spawning Guardians [Valaris] -int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int bg_id); +int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, unsigned int bg_id); int mob_guardian_guildchange(struct block_list *bl,va_list ap); //Change Guardian's ownership. [Skotlex] int mob_randomwalk(struct mob_data *md,unsigned int tick); diff --git a/src/map/pc.c b/src/map/pc.c index a63bd4d87..4cfec2de8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5580,7 +5580,7 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype) { if( !pc_isdead(sd) ) return; // not applicable - if( sd->state.bg_id && bg_member_respawn(sd) ) + if( sd->bg_id && bg_member_respawn(sd) ) return; // member revived by battleground pc_setstand(sd); @@ -5671,10 +5671,10 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) pc_setglobalreg(sd,"PC_DIE_COUNTER",sd->die_counter+1); pc_setparam(sd, SP_KILLERRID, src?src->id:0); - if( sd->state.bg_id ) + if( sd->bg_id ) { struct battleground_data *bg; - if( (bg = bg_team_search(sd->state.bg_id)) != NULL && bg->die_event[0] ) + if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] ) npc_event(sd, bg->die_event, 0); } npc_script_event(sd,NPCE_DIE); @@ -5918,9 +5918,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0); return 1|8; } - else if( sd->state.bg_id ) + else if( sd->bg_id ) { - struct battleground_data *bg = bg_team_search(sd->state.bg_id); + struct battleground_data *bg = bg_team_search(sd->bg_id); if( bg && bg->mapindex > 0 ) { // Respawn by BG add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0); diff --git a/src/map/pc.h b/src/map/pc.h index 2221dfe3a..7b14d45d8 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -96,63 +96,61 @@ struct map_session_data { //NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in //status_calc_pc, while special_state is recalculated in each call. [Skotlex] struct { - unsigned active : 1; //Marks active player (not active is logging in/out, or changing map servers) - unsigned menu_or_input : 1;// if a script is waiting for feedback from the player - unsigned dead_sit : 2; - unsigned lr_flag : 2; - unsigned connect_new : 1; - unsigned arrow_atk : 1; - unsigned combo : 2; // 1:Asura, 2:Kick [Inkfish] - unsigned gangsterparadise : 1; - unsigned rest : 1; - unsigned storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] - unsigned snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used. - unsigned abra_flag : 1; // Abracadabra bugfix by Aru - unsigned autocast : 1; // Autospell flag [Inkfish] - unsigned autotrade : 1; //By Fantik - unsigned reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet) - unsigned showdelay :1; - unsigned showexp :1; - unsigned showzeny :1; - unsigned mainchat :1; //[LuzZza] - unsigned noask :1; // [LuzZza] - unsigned trading :1; //[Skotlex] is 1 only after a trade has started. - unsigned deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE - unsigned monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] - unsigned size :2; // for tiny/large types - unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] - unsigned blockedmove :1; - unsigned using_fake_npc :1; - unsigned rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] - unsigned killer : 1; - unsigned killable : 1; - unsigned doridori : 1; - unsigned ignoreAll : 1; - unsigned debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS] - unsigned buyingstore : 1; - unsigned lesseffect : 1; - unsigned vending : 1; + unsigned int active : 1; //Marks active player (not active is logging in/out, or changing map servers) + unsigned int menu_or_input : 1;// if a script is waiting for feedback from the player + unsigned int dead_sit : 2; + unsigned int lr_flag : 2; + unsigned int connect_new : 1; + unsigned int arrow_atk : 1; + unsigned int combo : 2; // 1:Asura, 2:Kick [Inkfish] + unsigned int gangsterparadise : 1; + unsigned int rest : 1; + unsigned int storage_flag : 2; //0: closed, 1: Normal Storage open, 2: guild storage open [Skotlex] + unsigned int snovice_dead_flag : 1; //Explosion spirits on death: 0 off, 1 used. + unsigned int abra_flag : 1; // Abracadabra bugfix by Aru + unsigned int autocast : 1; // Autospell flag [Inkfish] + unsigned int autotrade : 1; //By Fantik + unsigned int reg_dirty : 3; //By Skotlex (marks whether registry variables have been saved or not yet) + unsigned int showdelay :1; + unsigned int showexp :1; + unsigned int showzeny :1; + unsigned int mainchat :1; //[LuzZza] + unsigned int noask :1; // [LuzZza] + unsigned int trading :1; //[Skotlex] is 1 only after a trade has started. + unsigned int deal_locked :2; //1: Clicked on OK. 2: Clicked on TRADE + unsigned int monster_ignore :1; // for monsters to ignore a character [Valaris] [zzo] + unsigned int size :2; // for tiny/large types + unsigned int night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] + unsigned int blockedmove :1; + unsigned int using_fake_npc :1; + unsigned int rewarp :1; //Signals that a player should warp as soon as he is done loading a map. [Skotlex] + unsigned int killer : 1; + unsigned int killable : 1; + unsigned int doridori : 1; + unsigned int ignoreAll : 1; + unsigned int debug_remove_map : 1; // temporary state to track double remove_map's [FlavioJS] + unsigned int buyingstore : 1; + unsigned int lesseffect : 1; + unsigned int vending : 1; + unsigned int noks : 3; // [Zeph Kill Steal Protection] + unsigned int changemap : 1; + short pmap; // Previous map on Map Change unsigned short autoloot; unsigned short autolootid; // [Zephyrus] - unsigned noks : 3; // [Zeph Kill Steal Protection] - bool changemap; - short pmap; // Previous map on Map Change - struct guild *gmaster_flag; - unsigned int bg_id; - unsigned short user_font; unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] + struct guild *gmaster_flag; } state; struct { unsigned char no_weapon_damage, no_magic_damage, no_misc_damage; - unsigned restart_full_recover : 1; - unsigned no_castcancel : 1; - unsigned no_castcancel2 : 1; - unsigned no_sizefix : 1; - unsigned no_gemstone : 1; - unsigned intravision : 1; // Maya Purple Card effect [DracoRPG] - unsigned perfect_hiding : 1; // [Valaris] - unsigned no_knockback : 1; - unsigned bonus_coma : 1; + unsigned int restart_full_recover : 1; + unsigned int no_castcancel : 1; + unsigned int no_castcancel2 : 1; + unsigned int no_sizefix : 1; + unsigned int no_gemstone : 1; + unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG] + unsigned int perfect_hiding : 1; // [Valaris] + unsigned int no_knockback : 1; + unsigned int bonus_coma : 1; } special_state; int login_id1, login_id2; unsigned short class_; //This is the internal job ID used by the map server to simplify comparisons/queries/etc. [Skotlex] @@ -420,6 +418,9 @@ struct map_session_data { const char* debug_file; int debug_line; const char* debug_func; + + unsigned int bg_id; + unsigned short user_font; }; //Update this max as necessary. 55 is the value needed for Super Baby currently diff --git a/src/map/script.c b/src/map/script.c index 4e874b5f0..4f565b9ed 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6316,7 +6316,7 @@ BUILDIN_FUNC(getcharid) case 1: script_pushint(st,sd->status.party_id); break; case 2: script_pushint(st,sd->status.guild_id); break; case 3: script_pushint(st,sd->status.account_id); break; - case 4: script_pushint(st,sd->state.bg_id); break; + case 4: script_pushint(st,sd->bg_id); break; default: ShowError("buildin_getcharid: invalid parameter (%d).\n", num); script_pushint(st,0); @@ -14239,7 +14239,7 @@ BUILDIN_FUNC(bg_monster_set_team) if( (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB ) return 0; md = (TBL_MOB *)mbl; - md->state.bg_id = bg_id; + md->bg_id = bg_id; mob_stop_attack(md); mob_stop_walking(md, 0); @@ -14252,7 +14252,7 @@ BUILDIN_FUNC(bg_monster_set_team) BUILDIN_FUNC(bg_leave) { struct map_session_data *sd = script_rid2sd(st); - if( sd == NULL || !sd->state.bg_id ) + if( sd == NULL || !sd->bg_id ) return 0; bg_team_leave(sd,0); @@ -14658,10 +14658,10 @@ BUILDIN_FUNC(setfont) if( sd == NULL ) return 0; - if( sd->state.user_font != font ) - sd->state.user_font = font; + if( sd->user_font != font ) + sd->user_font = font; else - sd->state.user_font = 0; + sd->user_font = 0; clif_font(sd); return 0; diff --git a/src/map/unit.c b/src/map/unit.c index 0c2c20c80..3cec43f70 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2068,7 +2068,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) guild_send_memberinfoshort(sd,0); pc_cleareventtimer(sd); pc_inventory_rental_clear(sd); - if( sd->state.bg_id ) bg_team_leave(sd,1); + if( sd->bg_id ) bg_team_leave(sd,1); pc_delspiritball(sd,sd->spiritball,1); if( sd->reg ) |