Convert s_map_zone_data storage to shared_ptr
This commit is contained in:
parent
941085e826
commit
c178f03a26
@ -4422,7 +4422,7 @@ ACMD_FUNC(mapinfo) {
|
||||
|
||||
struct map_data *mapdata = map_getmapdata(m_id);
|
||||
|
||||
sprintf(atcmd_output, msg_txt(sd,1040), mapname, script_get_constant_str("MAPTYPE_", mapdata->zone.id), mapdata->users, mapdata->npc_num, chat_num, vend_num); // Map: %s (Zone: %s) | Players: %d | NPCs: %d | Chats: %d | Vendings: %d
|
||||
sprintf(atcmd_output, msg_txt(sd,1040), mapname, script_get_constant_str("MAPTYPE_", mapdata->zone->id), mapdata->users, mapdata->npc_num, chat_num, vend_num); // Map: %s (Zone: %s) | Players: %d | NPCs: %d | Chats: %d | Vendings: %d
|
||||
clif_displaymessage(fd, atcmd_output);
|
||||
clif_displaymessage(fd, msg_txt(sd,1041)); // ------ Map Flags ------
|
||||
|
||||
@ -11573,7 +11573,7 @@ bool is_atcommand(const int fd, map_session_data* sd, const char* message, int t
|
||||
|
||||
struct map_data *mapdata = map_getmapdata(sd->bl.m);
|
||||
|
||||
if (mapdata->zone.isCommandDisabled(info->command, pc_get_group_level(sd))) {
|
||||
if (mapdata->zone->isCommandDisabled(info->command, pc_get_group_level(sd))) {
|
||||
clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 832), false, SELF); // This command is disabled on this map.
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4207,7 +4207,7 @@ bool itemdb_isNoEquip(map_session_data &sd, t_itemid nameid) {
|
||||
if (!mapdata)
|
||||
return true;
|
||||
|
||||
if (mapdata->zone.isItemDisabled(nameid, pc_get_group_level(&sd)))
|
||||
if (mapdata->zone->isItemDisabled(nameid, pc_get_group_level(&sd)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -515,17 +515,13 @@ void MapZoneDatabase::loadingFinished() {
|
||||
if (mapdata == nullptr)
|
||||
continue;
|
||||
|
||||
mapdata->zone.id = zone.second->id;
|
||||
mapdata->zone.disabled_commands = zone.second->disabled_commands;
|
||||
mapdata->zone.disabled_items = zone.second->disabled_items;
|
||||
mapdata->zone.disabled_skills = zone.second->disabled_skills;
|
||||
mapdata->zone.disabled_statuses = zone.second->disabled_statuses;
|
||||
mapdata->zone.restricted_jobs = zone.second->restricted_jobs;
|
||||
|
||||
// Clear previous mapflags
|
||||
mapdata->initMapFlags();
|
||||
mapdata->skill_damage.clear();
|
||||
mapdata->skill_duration.clear();
|
||||
mapdata->zone = std::make_shared<s_map_zone_data>();
|
||||
mapdata->zone->id = zone.second->id;
|
||||
mapdata->zone->disabled_commands = zone.second->disabled_commands;
|
||||
mapdata->zone->disabled_items = zone.second->disabled_items;
|
||||
mapdata->zone->disabled_skills = zone.second->disabled_skills;
|
||||
mapdata->zone->disabled_statuses = zone.second->disabled_statuses;
|
||||
mapdata->zone->restricted_jobs = zone.second->restricted_jobs;
|
||||
|
||||
// Apply mapflags from Map Zone DB
|
||||
for (const auto &flag : zone.second->mapflags) {
|
||||
|
||||
@ -845,7 +845,7 @@ struct map_data {
|
||||
std::unordered_map<uint16, s_skill_damage> skill_damage; // Used for single skill damage adjustment
|
||||
std::unordered_map<uint16, int> skill_duration;
|
||||
|
||||
s_map_zone_data zone;
|
||||
std::shared_ptr<s_map_zone_data> zone;
|
||||
|
||||
struct npc_data *npc[MAX_NPC_PER_MAP];
|
||||
struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer]
|
||||
|
||||
@ -15144,7 +15144,7 @@ bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv) {
|
||||
|
||||
map_data *mapdata = map_getmapdata(m);
|
||||
|
||||
if (mapdata != nullptr && mapdata->zone.isJobRestricted(jobid, group_lv))
|
||||
if (mapdata != nullptr && mapdata->zone->isJobRestricted(jobid, group_lv))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@ -869,7 +869,7 @@ bool skill_isNotOk(uint16 skill_id, map_session_data *sd)
|
||||
|
||||
uint32 skill_nocast = skill_get_nocast(skill_id);
|
||||
// Check skill restrictions [Celest]
|
||||
if (mapdata != nullptr && mapdata->zone.isSkillDisabled(skill_id, sd->bl.type, pc_get_group_level(sd))) {
|
||||
if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, sd->bl.type, pc_get_group_level(sd))) {
|
||||
clif_msg(sd, SKILL_CANT_USE_AREA); // This skill cannot be used within this area
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1944,7 +1944,7 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
|
||||
map_data *mapdata = map_getmapdata(src->m);
|
||||
map_session_data *sd = (TBL_PC *)src;
|
||||
|
||||
if (mapdata != nullptr && mapdata->zone.isSkillDisabled(skill_id, src->type, (sd != nullptr) ? pc_get_group_level(sd) : 0 )) {
|
||||
if (mapdata != nullptr && mapdata->zone->isSkillDisabled(skill_id, src->type, (sd != nullptr) ? pc_get_group_level(sd) : 0 )) {
|
||||
if (sd != nullptr)
|
||||
clif_msg(sd, SKILL_CANT_USE_AREA); // This skill cannot be used within this area
|
||||
return false;
|
||||
@ -9981,7 +9981,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
|
||||
map_data *mapdata = map_getmapdata(bl->m);
|
||||
map_session_data *sd = BL_CAST(BL_PC, bl);
|
||||
|
||||
if (mapdata != nullptr && mapdata->zone.isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0))
|
||||
if (mapdata != nullptr && mapdata->zone->isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0))
|
||||
return 0;
|
||||
|
||||
if (sc->getSCE(SC_GRAVITYCONTROL))
|
||||
@ -15372,7 +15372,7 @@ void status_change_clear_onChangeMap(block_list *bl)
|
||||
|
||||
map_session_data *sd = (TBL_PC *)bl;
|
||||
|
||||
if (mapdata->zone.isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0))
|
||||
if (mapdata->zone->isStatusDisabled(type, bl->type, (sd != nullptr) ? pc_get_group_level(sd) : 0))
|
||||
status_change_end(bl, type);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user