Refactor MapFlag accessors (#7783)
Use methods instead of direct member access.
This commit is contained in:
@@ -1340,7 +1340,7 @@ void pc_makesavestatus(map_session_data *sd) {
|
||||
struct map_data* mapdata = map_getmapdata( sd->bl.m );
|
||||
|
||||
// If saving is not allowed on the map, we return the player to the designated point
|
||||
if( mapdata->flag[MF_NOSAVE] ){
|
||||
if( mapdata->getMapFlag(MF_NOSAVE) ){
|
||||
// The map has a specific return point
|
||||
if( mapdata->save.map ){
|
||||
safestrncpy( sd->status.last_point.map, mapindex_id2name( mapdata->save.map ), sizeof( sd->status.last_point.map ) );
|
||||
@@ -1927,7 +1927,7 @@ bool pc_lastpoint_special( map_session_data& sd ){
|
||||
}
|
||||
|
||||
// Maybe since the player's logout the nosave mapflag was added to the map
|
||||
if( mapdata->flag[MF_NOSAVE] ){
|
||||
if( mapdata->getMapFlag(MF_NOSAVE) ){
|
||||
// The map has a specific return point
|
||||
if( mapdata->save.map ){
|
||||
safestrncpy( sd.status.last_point.map, mapindex_id2name( mapdata->save.map ), sizeof( sd.status.last_point.map ) );
|
||||
@@ -6156,7 +6156,7 @@ bool pc_isUseitem(map_session_data *sd,int n)
|
||||
|
||||
struct map_data *mapdata = map_getmapdata(sd->bl.m);
|
||||
|
||||
if(mapdata->flag[MF_NOITEMCONSUMPTION]) //consumable but mapflag prevent it
|
||||
if(mapdata->getMapFlag(MF_NOITEMCONSUMPTION)) //consumable but mapflag prevent it
|
||||
return false;
|
||||
//Prevent mass item usage. [Skotlex]
|
||||
if( DIFF_TICK(sd->canuseitem_tick,gettick()) > 0 ||
|
||||
@@ -6174,11 +6174,11 @@ bool pc_isUseitem(map_session_data *sd,int n)
|
||||
return false; // You cannot use this item while storage is open.
|
||||
}
|
||||
|
||||
if (item->flag.dead_branch && (mapdata->flag[MF_NOBRANCH] || mapdata_flag_gvg2(mapdata)))
|
||||
if (item->flag.dead_branch && (mapdata->getMapFlag(MF_NOBRANCH) || mapdata_flag_gvg2(mapdata)))
|
||||
return false;
|
||||
|
||||
if( itemdb_group.item_exists( IG_MF_NOTELEPORT, nameid ) ){
|
||||
if( ( mapdata->flag[MF_NOTELEPORT] || mapdata_flag_gvg2( mapdata ) ) ){
|
||||
if( ( mapdata->getMapFlag(MF_NOTELEPORT) || mapdata_flag_gvg2( mapdata ) ) ){
|
||||
clif_skill_teleportmessage( sd, 0 );
|
||||
return false;
|
||||
}
|
||||
@@ -6190,7 +6190,7 @@ bool pc_isUseitem(map_session_data *sd,int n)
|
||||
}
|
||||
|
||||
if( itemdb_group.item_exists( IG_MF_NORETURN, nameid ) ){
|
||||
if( mapdata->flag[MF_NORETURN] ){
|
||||
if( mapdata->getMapFlag(MF_NORETURN) ){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6244,7 +6244,7 @@ bool pc_isUseitem(map_session_data *sd,int n)
|
||||
break;
|
||||
|
||||
case ITEMID_NEURALIZER:
|
||||
if( !mapdata->flag[MF_RESET] )
|
||||
if( !mapdata->getMapFlag(MF_RESET) )
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -6809,7 +6809,7 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in
|
||||
instance_addusers(new_map_instance_id);
|
||||
}
|
||||
|
||||
if (sd->bg_id && mapdata && !mapdata->flag[MF_BATTLEGROUND]) // Moving to a map that isn't a Battlegrounds
|
||||
if (sd->bg_id && mapdata && !mapdata->getMapFlag(MF_BATTLEGROUND)) // Moving to a map that isn't a Battlegrounds
|
||||
bg_team_leave(sd, false, true);
|
||||
|
||||
sd->state.pmap = sd->bl.m;
|
||||
@@ -6850,12 +6850,12 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in
|
||||
|
||||
if (mapdata) {
|
||||
// make sure vending is allowed here
|
||||
if (sd->state.vending && mapdata->flag[MF_NOVENDING]) {
|
||||
if (sd->state.vending && mapdata->getMapFlag(MF_NOVENDING)) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd, 276)); // "You can't open a shop on this map"
|
||||
vending_closevending(sd);
|
||||
}
|
||||
// make sure buyingstore is allowed here
|
||||
if (sd->state.buyingstore && mapdata->flag[MF_NOBUYINGSTORE]) {
|
||||
if (sd->state.buyingstore && mapdata->getMapFlag(MF_NOBUYINGSTORE)) {
|
||||
clif_displaymessage(sd->fd, msg_txt(sd, 276)); // "You can't open a shop on this map"
|
||||
buyingstore_close(sd);
|
||||
}
|
||||
@@ -6954,7 +6954,7 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in
|
||||
sd->bl.x = sd->ud.to_x = x;
|
||||
sd->bl.y = sd->ud.to_y = y;
|
||||
|
||||
if( sd->status.guild_id > 0 && mapdata->flag[MF_GVG_CASTLE] )
|
||||
if( sd->status.guild_id > 0 && mapdata->getMapFlag(MF_GVG_CASTLE) )
|
||||
{ // Increased guild castle regen [Valaris]
|
||||
std::shared_ptr<guild_castle> gc = castle_db.mapindex2gc(sd->mapindex);
|
||||
if(gc && gc->guild_id == sd->status.guild_id)
|
||||
@@ -7012,7 +7012,7 @@ enum e_setpos pc_setpos(map_session_data* sd, unsigned short mapindex, int x, in
|
||||
enum e_setpos pc_setpos_savepoint( map_session_data& sd, clr_type clrtype ){
|
||||
struct map_data *mapdata = map_getmapdata( sd.bl.m );
|
||||
|
||||
if( mapdata != nullptr && mapdata->flag[MF_NOSAVE] && mapdata->save.map ){
|
||||
if( mapdata != nullptr && mapdata->getMapFlag(MF_NOSAVE) && mapdata->save.map ){
|
||||
return pc_setpos( &sd, mapdata->save.map, mapdata->save.x, mapdata->save.y, clrtype );
|
||||
}else{
|
||||
return pc_setpos( &sd, mapindex_name2id( sd.status.save_point.map ), sd.status.save_point.x, sd.status.save_point.y, clrtype );
|
||||
@@ -7034,7 +7034,7 @@ char pc_randomwarp(map_session_data *sd, clr_type type, bool ignore_mapflag)
|
||||
|
||||
struct map_data *mapdata = map_getmapdata(sd->bl.m);
|
||||
|
||||
if (mapdata->flag[MF_NOTELEPORT] && !ignore_mapflag) //Teleport forbidden
|
||||
if (mapdata->getMapFlag(MF_NOTELEPORT) && !ignore_mapflag) //Teleport forbidden
|
||||
return 3;
|
||||
|
||||
do {
|
||||
@@ -9649,7 +9649,7 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
|
||||
if(sd->status.pet_id > 0 && sd->pd) {
|
||||
struct pet_data *pd = sd->pd;
|
||||
if( !mapdata->flag[MF_NOEXPPENALTY] ) {
|
||||
if( !mapdata->getMapFlag(MF_NOEXPPENALTY) ) {
|
||||
pet_set_intimate(pd, pd->pet.intimate + pd->get_pet_db()->die);
|
||||
clif_send_petdata(sd,sd->pd,1,pd->pet.intimate);
|
||||
}
|
||||
@@ -9783,7 +9783,7 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
}
|
||||
|
||||
if(battle_config.bone_drop==2
|
||||
|| (battle_config.bone_drop==1 && mapdata->flag[MF_PVP]))
|
||||
|| (battle_config.bone_drop==1 && mapdata->getMapFlag(MF_PVP)))
|
||||
{
|
||||
struct item item_tmp;
|
||||
memset(&item_tmp,0,sizeof(item_tmp));
|
||||
@@ -9803,7 +9803,7 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
if(battle_config.death_penalty_type
|
||||
&& (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty
|
||||
&& !sd->sc.cant.deathpenalty
|
||||
&& !mapdata->flag[MF_NOEXPPENALTY] && !mapdata_flag_gvg2(mapdata))
|
||||
&& !mapdata->getMapFlag(MF_NOEXPPENALTY) && !mapdata_flag_gvg2(mapdata))
|
||||
{
|
||||
t_exp base_penalty = 0;
|
||||
t_exp job_penalty = 0;
|
||||
@@ -9853,14 +9853,14 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
pc_lostexp(sd, base_penalty, job_penalty);
|
||||
}
|
||||
|
||||
if( zeny_penalty > 0 && !mapdata->flag[MF_NOZENYPENALTY]) {
|
||||
if( zeny_penalty > 0 && !mapdata->getMapFlag(MF_NOZENYPENALTY)) {
|
||||
zeny_penalty = (uint32)( sd->status.zeny * ( zeny_penalty / 10000. ) );
|
||||
if(zeny_penalty)
|
||||
pc_payzeny(sd, zeny_penalty, LOG_TYPE_PICKDROP_PLAYER);
|
||||
}
|
||||
}
|
||||
|
||||
if( mapdata->flag[MF_PVP_NIGHTMAREDROP] ) { // Moved this outside so it works when PVP isn't enabled and during pk mode [Ancyker]
|
||||
if( mapdata->getMapFlag(MF_PVP_NIGHTMAREDROP) ) { // Moved this outside so it works when PVP isn't enabled and during pk mode [Ancyker]
|
||||
for (const auto &it : mapdata->drop_list) {
|
||||
int id = it.drop_id, per = it.drop_per;
|
||||
enum e_nightmare_drop_type type = it.drop_type;
|
||||
@@ -9910,7 +9910,7 @@ int pc_dead(map_session_data *sd,struct block_list *src)
|
||||
}
|
||||
// pvp
|
||||
// disable certain pvp functions on pk_mode [Valaris]
|
||||
if( !battle_config.pk_mode && mapdata->flag[MF_PVP] && !mapdata->flag[MF_PVP_NOCALCRANK] ) {
|
||||
if( !battle_config.pk_mode && mapdata->getMapFlag(MF_PVP) && !mapdata->getMapFlag(MF_PVP_NOCALCRANK) ) {
|
||||
sd->pvp_point -= 5;
|
||||
sd->pvp_lost++;
|
||||
if( src && src->type == BL_PC ) {
|
||||
@@ -15189,11 +15189,11 @@ bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv) {
|
||||
return true;
|
||||
|
||||
if ((job->noenter_map.zone&1 && !mapdata_flag_vs2(mapdata)) || // Normal
|
||||
(job->noenter_map.zone&2 && mapdata->flag[MF_PVP]) || // PVP
|
||||
(job->noenter_map.zone&2 && mapdata->getMapFlag(MF_PVP)) || // PVP
|
||||
(job->noenter_map.zone&4 && mapdata_flag_gvg2_no_te(mapdata)) || // GVG
|
||||
(job->noenter_map.zone&8 && mapdata->flag[MF_BATTLEGROUND]) || // Battleground
|
||||
(job->noenter_map.zone&8 && mapdata->getMapFlag(MF_BATTLEGROUND)) || // Battleground
|
||||
(job->noenter_map.zone&16 && mapdata_flag_gvg2_te(mapdata)) || // WOE:TE
|
||||
(job->noenter_map.zone&(mapdata->zone) && mapdata->flag[MF_RESTRICTED]) // Zone restriction
|
||||
(job->noenter_map.zone&(mapdata->zone) && mapdata->getMapFlag(MF_RESTRICTED)) // Zone restriction
|
||||
)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user