diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-05-23 15:14:29 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-05-23 19:12:48 -0700 |
commit | 87218e07b2bc89593eae1cb4abe859cd1a7eaa0f (patch) | |
tree | 9343c393ddebf50086fdef8f2a4668781e4afd66 | |
parent | 543e4b419239f37321bc5a224d56773d1fe6ebfe (diff) | |
download | tmwa-87218e07b2bc89593eae1cb4abe859cd1a7eaa0f.tar.gz tmwa-87218e07b2bc89593eae1cb4abe859cd1a7eaa0f.tar.bz2 tmwa-87218e07b2bc89593eae1cb4abe859cd1a7eaa0f.tar.xz tmwa-87218e07b2bc89593eae1cb4abe859cd1a7eaa0f.zip |
Make block_list a base class
-rw-r--r-- | src/map/atcommand.cpp | 206 | ||||
-rw-r--r-- | src/map/battle.cpp | 4 | ||||
-rw-r--r-- | src/map/chrif.cpp | 14 | ||||
-rw-r--r-- | src/map/clif.cpp | 266 | ||||
-rw-r--r-- | src/map/intif.cpp | 10 | ||||
-rw-r--r-- | src/map/magic-interpreter-base.cpp | 28 | ||||
-rw-r--r-- | src/map/magic-interpreter.hpp | 7 | ||||
-rw-r--r-- | src/map/magic-stmt.cpp | 72 | ||||
-rw-r--r-- | src/map/map.cpp | 52 | ||||
-rw-r--r-- | src/map/map.hpp | 17 | ||||
-rw-r--r-- | src/map/mob.cpp | 480 | ||||
-rw-r--r-- | src/map/npc.cpp | 164 | ||||
-rw-r--r-- | src/map/party.cpp | 26 | ||||
-rw-r--r-- | src/map/pc.cpp | 292 | ||||
-rw-r--r-- | src/map/script.cpp | 56 | ||||
-rw-r--r-- | src/map/skill-pools.cpp | 2 | ||||
-rw-r--r-- | src/map/skill.cpp | 10 | ||||
-rw-r--r-- | src/map/trade.cpp | 10 |
18 files changed, 857 insertions, 859 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index fe12acf..207ce25 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -371,7 +371,7 @@ void log_atcommand(struct map_session_data *sd, const_string cmd) stamp_time(tmpstr); fprintf(fp, "[%s] %s(%d,%d) %s(%d) : ", tmpstr, - map[sd->bl.bl_m].name, sd->bl.bl_x, sd->bl.bl_y, + map[sd->bl_m].name, sd->bl_x, sd->bl_y, sd->status.name, sd->status.account_id); fwrite(cmd.data(), 1, cmd.size(), fp); } @@ -676,7 +676,7 @@ int atcommand_charwarp(const int fd, struct map_session_data *sd, "You are not authorised to warp someone to this map."); return -1; } - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -754,7 +754,7 @@ int atcommand_warp(const int fd, struct map_session_data *sd, "You are not authorised to warp you to this map."); return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -800,7 +800,7 @@ int atcommand_where(const int fd, struct map_session_data *sd, { // you can look only lower or same level std::string output = STRPRINTF("%s: %s (%d,%d)", pl_sd->status.name, - pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->mapname, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); } else @@ -833,21 +833,21 @@ int atcommand_goto(const int fd, struct map_session_data *sd, if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarpto + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); return -1; } - pc_setpos(sd, pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y, BeingRemoveWhy::WARPED); + pc_setpos(sd, pl_sd->mapname, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED); std::string output = STRPRINTF("Jump to %s", character); clif_displaymessage(fd, output); } @@ -876,14 +876,14 @@ int atcommand_jump(const int fd, struct map_session_data *sd, y = random_::in(1, 399); if (x > 0 && x < 800 && y > 0 && y < 800) { - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarpto + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you to your actual map."); return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -950,12 +950,12 @@ int atcommand_who(const int fd, struct map_session_data *sd, output = STRPRINTF( "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, - pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->mapname, pl_sd->bl_x, pl_sd->bl_y); else output = STRPRINTF( "Name: %s | Location: %s %d %d", pl_sd->status.name, pl_sd->mapname, - pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); count++; } @@ -1061,14 +1061,14 @@ int atcommand_whomap(const int fd, struct map_session_data *sd, memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; else { sscanf(message, "%99s", map_name); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; } count = 0; @@ -1086,19 +1086,19 @@ int atcommand_whomap(const int fd, struct map_session_data *sd, || bool(pl_sd->status.option & Option::HIDE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level - if (pl_sd->bl.bl_m == map_id) + if (pl_sd->bl_m == map_id) { std::string output; if (pl_GM_level > 0) output = STRPRINTF( "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, - pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->mapname, pl_sd->bl_x, pl_sd->bl_y); else output = STRPRINTF( "Name: %s | Location: %s %d %d", pl_sd->status.name, pl_sd->mapname, - pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); count++; } @@ -1129,14 +1129,14 @@ int atcommand_whomapgroup(const int fd, struct map_session_data *sd, memset(map_name, '\0', sizeof(map_name)); if (!message || !*message) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; else { sscanf(message, "%99s", map_name); if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; } count = 0; @@ -1155,7 +1155,7 @@ int atcommand_whomapgroup(const int fd, struct map_session_data *sd, && (pl_GM_level > GM_level))) { // you can look only lower or same level - if (pl_sd->bl.bl_m == map_id) + if (pl_sd->bl_m == map_id) { p = party_search(pl_sd->status.party_id); const char *temp0 = p ? p->name : "None"; @@ -1236,7 +1236,7 @@ int atcommand_whogm(const int fd, struct map_session_data *sd, output = STRPRINTF( "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, - pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->mapname, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); output = STRPRINTF( " BLvl: %d | Job: %s (Lvl: %d)", @@ -1279,7 +1279,7 @@ int atcommand_save(const int fd, struct map_session_data *sd, { nullpo_retr(-1, sd); - pc_setsavepoint(sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y); + pc_setsavepoint(sd, sd->mapname, sd->bl_x, sd->bl_y); pc_makesavestatus(sd); chrif_save(sd); clif_displaymessage(fd, "Character data respawn point saved."); @@ -1304,7 +1304,7 @@ int atcommand_load(const int fd, struct map_session_data *sd, "You are not authorised to warp you to your save map."); return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -1413,7 +1413,7 @@ int atcommand_option(const int fd, struct map_session_data *sd, sd->opt2 = param2; sd->status.option = param3; - clif_changeoption(&sd->bl); + clif_changeoption(sd); pc_calcstatus(sd, 0); clif_displaymessage(fd, "Options changed."); @@ -1437,7 +1437,7 @@ int atcommand_hide(const int fd, struct map_session_data *sd, sd->status.option |= Option::HIDE; clif_displaymessage(fd, "Invisible: On."); // Invisible: On } - clif_changeoption(&sd->bl); + clif_changeoption(sd); return 0; } @@ -1510,7 +1510,7 @@ int atcommand_alive(const int fd, struct map_session_data *sd, pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time)); clif_updatestatus(sd, SP::HP); clif_updatestatus(sd, SP::SP); - clif_resurrection(&sd->bl, 1); + clif_resurrection(sd, 1); clif_displaymessage(fd, "You've been revived! It's a miracle!"); return 0; @@ -1564,7 +1564,7 @@ int atcommand_heal(const int fd, struct map_session_data *sd, } if (hp < 0) // display like damage - clif_damage(&sd->bl, &sd->bl, gettick(), interval_t::zero(), interval_t::zero(), -hp, 0, DamageType::RETURNED, 0); + clif_damage(sd, sd, gettick(), interval_t::zero(), interval_t::zero(), -hp, 0, DamageType::RETURNED, 0); if (hp != 0 || sp != 0) { @@ -1710,7 +1710,7 @@ int atcommand_baselevelup(const int fd, struct map_session_data *sd, clif_updatestatus(sd, SP::STATUSPOINT); pc_calcstatus(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); - clif_misceffect(&sd->bl, 0); + clif_misceffect(sd, 0); clif_displaymessage(fd, "Base level raised."); } else @@ -1776,7 +1776,7 @@ int atcommand_joblevelup(const int fd, struct map_session_data *sd, sd->status.skill_point += level; clif_updatestatus(sd, SP::SKILLPOINT); pc_calcstatus(sd, 0); - clif_misceffect(&sd->bl, 1); + clif_misceffect(sd, 1); clif_displaymessage(fd, "Job level raised."); } else @@ -1893,9 +1893,9 @@ int atcommand_pvpoff(const int fd, struct map_session_data *sd, return -1; } - if (map[sd->bl.bl_m].flag.pvp) + if (map[sd->bl_m].flag.pvp) { - map[sd->bl.bl_m].flag.pvp = 0; + map[sd->bl_m].flag.pvp = 0; for (int i = 0; i < fd_max; i++) { if (!session[i]) @@ -1903,7 +1903,7 @@ int atcommand_pvpoff(const int fd, struct map_session_data *sd, map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd && pl_sd->state.auth) { - if (sd->bl.bl_m == pl_sd->bl.bl_m) + if (sd->bl_m == pl_sd->bl_m) { pl_sd->pvp_timer.cancel(); } @@ -1933,9 +1933,9 @@ int atcommand_pvpon(const int fd, struct map_session_data *sd, return -1; } - if (!map[sd->bl.bl_m].flag.pvp && !map[sd->bl.bl_m].flag.nopvp) + if (!map[sd->bl_m].flag.pvp && !map[sd->bl_m].flag.nopvp) { - map[sd->bl.bl_m].flag.pvp = 1; + map[sd->bl_m].flag.pvp = 1; for (int i = 0; i < fd_max; i++) { if (!session[i]) @@ -1943,10 +1943,10 @@ int atcommand_pvpon(const int fd, struct map_session_data *sd, map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd && pl_sd->state.auth) { - if (sd->bl.bl_m == pl_sd->bl.bl_m && !pl_sd->pvp_timer) + if (sd->bl_m == pl_sd->bl_m && !pl_sd->pvp_timer) { pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200), - std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl.bl_id)); + std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl_id)); pl_sd->pvp_rank = 0; pl_sd->pvp_lastusers = 0; pl_sd->pvp_point = 5; @@ -2171,11 +2171,11 @@ int atcommand_spawn(const int fd, struct map_session_data *sd, { // try 8 times to spawn the monster (needed for close area) if (x <= 0) - mx = sd->bl.bl_x + random_::in(-range / 2, range / 2 ); + mx = sd->bl_x + random_::in(-range / 2, range / 2 ); else mx = x; if (y <= 0) - my = sd->bl.bl_y + random_::in(-range / 2, range / 2); + my = sd->bl_y + random_::in(-range / 2, range / 2); else my = y; k = mob_once_spawn(sd, "this", mx, my, "", mob_id, 1, ""); @@ -2215,13 +2215,13 @@ void atcommand_killmonster_sub(const int fd, struct map_session_data *sd, memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || sscanf(message, "%99s", map_name) < 1) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; else { if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) strcat(map_name, ".gat"); if ((map_id = map_mapname2mapid(map_name)) < 0) - map_id = sd->bl.bl_m; + map_id = sd->bl_m; } map_foreachinarea(std::bind(atkillmonster_sub, ph::_1, drop), map_id, 0, 0, map[map_id].xs, @@ -2267,8 +2267,8 @@ int atcommand_list_nearby(const int fd, struct map_session_data *sd, { clif_displaymessage(fd, "Nearby players:"); map_foreachinarea(std::bind(atlist_nearby_sub, ph::_1, fd), - sd->bl.bl_m, sd->bl.bl_x - 1, sd->bl.bl_y - 1, - sd->bl.bl_x + 1, sd->bl.bl_x + 1, BL::PC); + sd->bl_m, sd->bl_x - 1, sd->bl_y - 1, + sd->bl_x + 1, sd->bl_x + 1, BL::PC); return 0; } @@ -2298,12 +2298,12 @@ int atcommand_gat(const int fd, struct map_session_data *sd, { std::string output = STRPRINTF( "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", - map[sd->bl.bl_m].name, sd->bl.bl_x - 2, sd->bl.bl_y + y, - map_getcell(sd->bl.bl_m, sd->bl.bl_x - 2, sd->bl.bl_y + y), - map_getcell(sd->bl.bl_m, sd->bl.bl_x - 1, sd->bl.bl_y + y), - map_getcell(sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y + y), - map_getcell(sd->bl.bl_m, sd->bl.bl_x + 1, sd->bl.bl_y + y), - map_getcell(sd->bl.bl_m, sd->bl.bl_x + 2, sd->bl.bl_y + y)); + map[sd->bl_m].name, sd->bl_x - 2, sd->bl_y + y, + map_getcell(sd->bl_m, sd->bl_x - 2, sd->bl_y + y), + map_getcell(sd->bl_m, sd->bl_x - 1, sd->bl_y + y), + map_getcell(sd->bl_m, sd->bl_x, sd->bl_y + y), + map_getcell(sd->bl_m, sd->bl_x + 1, sd->bl_y + y), + map_getcell(sd->bl_m, sd->bl_x + 2, sd->bl_y + y)); clif_displaymessage(fd, output); } @@ -2326,7 +2326,7 @@ int atcommand_packet(const int fd, struct map_session_data *sd, return -1; } - clif_status_change(&sd->bl, StatusChange(type), flag); + clif_status_change(sd, StatusChange(type), flag); return 0; } @@ -2568,21 +2568,21 @@ int atcommand_recall(const int fd, struct map_session_data *sd, { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can recall only lower or same level - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarpto + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp somenone to your actual map."); return -1; } - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp this player from its actual map."); return -1; } - pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); std::string output = STRPRINTF("%s recalled!", character); clif_displaymessage(fd, output); } @@ -2628,7 +2628,7 @@ int atcommand_revive(const int fd, struct map_session_data *sd, pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time)); clif_updatestatus(pl_sd, SP::HP); clif_updatestatus(pl_sd, SP::SP); - clif_resurrection(&pl_sd->bl, 1); + clif_resurrection(pl_sd, 1); clif_displaymessage(fd, "Character revived."); } else @@ -2795,7 +2795,7 @@ int atcommand_character_option(const int fd, struct map_session_data *sd, pl_sd->opt2 = opt2; pl_sd->status.option = opt3; - clif_changeoption(&pl_sd->bl); + clif_changeoption(pl_sd); pc_calcstatus(pl_sd, 0); clif_displaymessage(fd, "Character's options changed."); } @@ -3186,7 +3186,7 @@ int atcommand_doommap(const int fd, struct map_session_data *sd, continue; map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd - && pl_sd->state.auth && i != fd && sd->bl.bl_m == pl_sd->bl.bl_m + && pl_sd->state.auth && i != fd && sd->bl_m == pl_sd->bl_m && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can doom only lower or same gm level pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); @@ -3212,7 +3212,7 @@ void atcommand_raise_sub(struct map_session_data *sd) pc_setstand(sd); clif_updatestatus(sd, SP::HP); clif_updatestatus(sd, SP::SP); - clif_resurrection(&sd->bl, 1); + clif_resurrection(sd, 1); clif_displaymessage(sd->fd, "Mercy has been shown."); } } @@ -3249,7 +3249,7 @@ int atcommand_raisemap(const int fd, struct map_session_data *sd, continue; map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd - && pl_sd->state.auth && sd->bl.bl_m == pl_sd->bl.bl_m) + && pl_sd->state.auth && sd->bl_m == pl_sd->bl_m) atcommand_raise_sub(pl_sd); } clif_displaymessage(fd, "Mercy has been granted."); @@ -3304,7 +3304,7 @@ int atcommand_character_baselevel(const int fd, struct map_session_data *sd, clif_updatestatus(pl_sd, SP::STATUSPOINT); pc_calcstatus(pl_sd, 0); pc_heal(pl_sd, pl_sd->status.max_hp, pl_sd->status.max_sp); - clif_misceffect(&pl_sd->bl, 0); + clif_misceffect(pl_sd, 0); clif_displaymessage(fd, "Character's base level raised."); } else @@ -3395,7 +3395,7 @@ int atcommand_character_joblevel(const int fd, struct map_session_data *sd, pl_sd->status.skill_point += level; clif_updatestatus(pl_sd, SP::SKILLPOINT); pc_calcstatus(pl_sd, 0); - clif_misceffect(&pl_sd->bl, 1); + clif_misceffect(pl_sd, 1); clif_displaymessage(fd, "character's job level raised."); } else @@ -4256,7 +4256,7 @@ int atcommand_recallall(const int fd, struct map_session_data *sd, { int count; - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarpto + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -4276,11 +4276,11 @@ int atcommand_recallall(const int fd, struct map_session_data *sd, && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can recall only lower or same level - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) count++; else - pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); } } @@ -4316,7 +4316,7 @@ int atcommand_partyrecall(const int fd, struct map_session_data *sd, return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarpto + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -4337,11 +4337,11 @@ int atcommand_partyrecall(const int fd, struct map_session_data *sd, && sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party_id) { - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) count++; else - pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); } } std::string output = STRPRINTF("All online characters of the %s party are near you.", p->name); @@ -4525,7 +4525,7 @@ int atcommand_mapinfo(const int fd, struct map_session_data *sd, { output = STRPRINTF( "Player '%s' (session #%d) | Location: %d,%d", - pl_sd->status.name, i, pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->status.name, i, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); } } @@ -4572,8 +4572,8 @@ int atcommand_mapinfo(const int fd, struct map_session_data *sd, } output = STRPRINTF( "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d", - ++i, nd->name, direction, nd->npc_class, nd->bl.bl_x, - nd->bl.bl_y); + ++i, nd->name, direction, nd->npc_class, nd->bl_x, + nd->bl_y); clif_displaymessage(fd, output); } break; @@ -4838,7 +4838,7 @@ int atcommand_localbroadcast(const int fd, struct map_session_data *sd, std::string output = STRPRINTF("%s : %s", sd->status.name, message); - clif_GMmessage(&sd->bl, output, 1); // 1: ALL_SAMEMAP + clif_GMmessage(sd, output, 1); // 1: ALL_SAMEMAP return 0; } @@ -5153,7 +5153,7 @@ int atcommand_effect(const int fd, struct map_session_data *sd, } if (flag <= 0) { - clif_specialeffect(&sd->bl, type, flag); + clif_specialeffect(sd, type, flag); clif_displaymessage(fd, "Your Effect Has Changed."); // Your effect has changed. } else @@ -5165,7 +5165,7 @@ int atcommand_effect(const int fd, struct map_session_data *sd, map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd && pl_sd->state.auth) { - clif_specialeffect(&pl_sd->bl, type, flag); + clif_specialeffect(pl_sd, type, flag); clif_displaymessage(pl_sd->fd, "Your Effect Has Changed."); // Your effect has changed. } } @@ -5681,8 +5681,8 @@ int atcommand_npcmove(const int, struct map_session_data *sd, return -1; npc_enable(character, 0); - nd->bl.bl_x = x; - nd->bl.bl_y = y; + nd->bl_x = x; + nd->bl_y = y; npc_enable(character, 1); return 0; @@ -5706,8 +5706,8 @@ int atcommand_addwarp(const int fd, struct map_session_data *sd, if (sscanf(message, "%29s %d %d[^\n]", mapname, &x, &y) < 3) return -1; - std::string w1 = STRPRINTF("%s,%d,%d", sd->mapname, sd->bl.bl_x, sd->bl.bl_y); - std::string w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl.bl_x, sd->bl.bl_y, x, y); + std::string w1 = STRPRINTF("%s,%d,%d", sd->mapname, sd->bl_x, sd->bl_y); + std::string w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl_x, sd->bl_y, x, y); std::string w4 = STRPRINTF("1,1,%s.gat,%d,%d", mapname, x, y); ret = npc_parse_warp(w1.c_str(), "warp", w3.c_str(), w4.c_str()); @@ -5741,7 +5741,7 @@ int atcommand_chareffect(const int fd, struct map_session_data *, if ((pl_sd = map_nick2sd(target)) == NULL) return -1; - clif_specialeffect(&pl_sd->bl, type, 0); + clif_specialeffect(pl_sd, type, 0); clif_displaymessage(fd, "Your Effect Has Changed."); // Your effect has changed. return 0; @@ -5900,11 +5900,11 @@ int atcommand_rain(const int, struct map_session_data *sd, int effno = 0; effno = 161; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.bl_m].flag.rain) + if (effno < 0 || map[sd->bl_m].flag.rain) return -1; - map[sd->bl.bl_m].flag.rain = 1; - clif_specialeffect(&sd->bl, effno, 2); + map[sd->bl_m].flag.rain = 1; + clif_specialeffect(sd, effno, 2); return 0; } @@ -5918,11 +5918,11 @@ int atcommand_snow(const int, struct map_session_data *sd, int effno = 0; effno = 162; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.bl_m].flag.snow) + if (effno < 0 || map[sd->bl_m].flag.snow) return -1; - map[sd->bl.bl_m].flag.snow = 1; - clif_specialeffect(&sd->bl, effno, 2); + map[sd->bl_m].flag.snow = 1; + clif_specialeffect(sd, effno, 2); return 0; } @@ -5936,11 +5936,11 @@ int atcommand_sakura(const int, struct map_session_data *sd, int effno = 0; effno = 163; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.bl_m].flag.sakura) + if (effno < 0 || map[sd->bl_m].flag.sakura) return -1; - map[sd->bl.bl_m].flag.sakura = 1; - clif_specialeffect(&sd->bl, effno, 2); + map[sd->bl_m].flag.sakura = 1; + clif_specialeffect(sd, effno, 2); return 0; } @@ -5954,11 +5954,11 @@ int atcommand_fog(const int, struct map_session_data *sd, int effno = 0; effno = 233; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.bl_m].flag.fog) + if (effno < 0 || map[sd->bl_m].flag.fog) return -1; - map[sd->bl.bl_m].flag.fog = 1; - clif_specialeffect(&sd->bl, effno, 2); + map[sd->bl_m].flag.fog = 1; + clif_specialeffect(sd, effno, 2); return 0; } @@ -5973,11 +5973,11 @@ int atcommand_leaves(const int, struct map_session_data *sd, int effno = 0; effno = 333; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.bl_m].flag.leaves) + if (effno < 0 || map[sd->bl_m].flag.leaves) return -1; - map[sd->bl.bl_m].flag.leaves = 1; - clif_specialeffect(&sd->bl, effno, 2); + map[sd->bl_m].flag.leaves = 1; + clif_specialeffect(sd, effno, 2); return 0; } @@ -6008,19 +6008,19 @@ int atcommand_summon(const int, struct map_session_data *sd, if (mob_id == 0) return -1; - x = sd->bl.bl_x + random_::in(-5, 4); - y = sd->bl.bl_y + random_::in(-5, 4); + x = sd->bl_x + random_::in(-5, 4); + y = sd->bl_y + random_::in(-5, 4); id = mob_once_spawn(sd, "this", x, y, "--ja--", mob_id, 1, ""); if ((md = (struct mob_data *) map_id2bl(id))) { - md->master_id = sd->bl.bl_id; + md->master_id = sd->bl_id; md->state.special_mob_ai = 1; md->mode = mob_db[md->mob_class].mode | MobMode::AGGRESSIVE; md->deletetimer = Timer(tick + std::chrono::minutes(1), std::bind(mob_timer_delete, ph::_1, ph::_2, id)); - clif_misceffect(&md->bl, 344); + clif_misceffect(md, 344); } return 0; @@ -6108,7 +6108,7 @@ int atcommand_trade(const int, struct map_session_data *sd, return -1; if ((pl_sd = map_nick2sd(message)) != NULL) { - trade_traderequest(sd, pl_sd->bl.bl_id); + trade_traderequest(sd, pl_sd->bl_id); return 0; } return -1; @@ -6259,7 +6259,7 @@ int atcommand_tee(const int, struct map_session_data *sd, strcpy(data, sd->status.name); strcat(data, " : "); strcat(data, message); - clif_message(&sd->bl, data); + clif_message(sd, data); return 0; } @@ -6300,25 +6300,25 @@ int atcommand_jump_iterate(const int fd, struct map_session_data *sd, pl_sd = get_start(); } - if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarpto + if (pl_sd->bl_m >= 0 && map[pl_sd->bl_m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); return -1; } - if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp + if (sd->bl_m >= 0 && map[sd->bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); return -1; } - pc_setpos(sd, map[pl_sd->bl.bl_m].name, pl_sd->bl.bl_x, pl_sd->bl.bl_y, BeingRemoveWhy::WARPED); + pc_setpos(sd, map[pl_sd->bl_m].name, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED); std::string output = STRPRINTF("Jump to %s", pl_sd->status.name); clif_displaymessage(fd, output); - sd->followtarget = pl_sd->bl.bl_id; + sd->followtarget = pl_sd->bl_id; return 0; } @@ -6549,7 +6549,7 @@ int atcommand_ipcheck(const int fd, struct map_session_data *, std::string output = STRPRINTF( "Name: %s | Location: %s %d %d", pl_sd->status.name, pl_sd->mapname, - pl_sd->bl.bl_x, pl_sd->bl.bl_y); + pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(fd, output); } } @@ -6568,8 +6568,8 @@ int atcommand_doomspot(const int fd, struct map_session_data *sd, continue; map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd - && pl_sd->state.auth && i != fd && sd->bl.bl_m == pl_sd->bl.bl_m - && sd->bl.bl_x == pl_sd->bl.bl_x && sd->bl.bl_y == pl_sd->bl.bl_y + && pl_sd->state.auth && i != fd && sd->bl_m == pl_sd->bl_m + && sd->bl_x == pl_sd->bl_x && sd->bl_y == pl_sd->bl_y && pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can doom only lower or same gm level pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); diff --git a/src/map/battle.cpp b/src/map/battle.cpp index e0706dc..34d4751 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -785,7 +785,7 @@ int battle_get_party_id(struct block_list *bl) struct mob_data *md = (struct mob_data *) bl; if (md->master_id > 0) return -md->master_id; - return -md->bl.bl_id; + return -md->bl_id; } return 0; } @@ -1396,7 +1396,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, div_ = 1; // single attack { - damage = damage2 = battle_get_baseatk(&sd->bl); //damega,damega2初登場、base_atkの取得 + damage = damage2 = battle_get_baseatk(sd); //damega,damega2初登場、base_atkの取得 } if (sd->attackrange > 2) { // [fate] ranged weapon? diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index a015b3c..51736e4 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -108,7 +108,7 @@ int chrif_save(struct map_session_data *sd) WFIFOW(char_fd, 0) = 0x2b01; WFIFOW(char_fd, 2) = sizeof(sd->status) + 12; - WFIFOL(char_fd, 4) = sd->bl.bl_id; + WFIFOL(char_fd, 4) = sd->bl_id; WFIFOL(char_fd, 8) = sd->char_id; memcpy(WFIFOP(char_fd, 12), &sd->status, sizeof(sd->status)); WFIFOSET(char_fd, WFIFOW(char_fd, 2)); @@ -206,7 +206,7 @@ int chrif_changemapserver(struct map_session_data *sd, char *name, int x, } WFIFOW(char_fd, 0) = 0x2b05; - WFIFOL(char_fd, 2) = sd->bl.bl_id; + WFIFOL(char_fd, 2) = sd->bl_id; WFIFOL(char_fd, 6) = sd->login_id1; WFIFOL(char_fd, 10) = sd->login_id2; WFIFOL(char_fd, 14) = sd->status.char_id; @@ -306,14 +306,14 @@ int chrif_authreq(struct map_session_data *sd) nullpo_retr(-1, sd); - if (!sd || !char_fd || !sd->bl.bl_id || !sd->login_id1) + if (!sd || !char_fd || !sd->bl_id || !sd->login_id1) return -1; for (i = 0; i < fd_max; i++) if (session[i] && session[i]->session_data.get() == sd) { WFIFOW(char_fd, 0) = 0x2afc; - WFIFOL(char_fd, 2) = sd->bl.bl_id; + WFIFOL(char_fd, 2) = sd->bl_id; WFIFOL(char_fd, 6) = sd->char_id; WFIFOL(char_fd, 10) = sd->login_id1; WFIFOL(char_fd, 14) = sd->login_id2; @@ -335,7 +335,7 @@ int chrif_charselectreq(struct map_session_data *sd) nullpo_retr(-1, sd); - if (!sd || !char_fd || !sd->bl.bl_id || !sd->login_id1) + if (!sd || !char_fd || !sd->bl_id || !sd->login_id1) return -1; s_ip = 0; @@ -347,7 +347,7 @@ int chrif_charselectreq(struct map_session_data *sd) } WFIFOW(char_fd, 0) = 0x2b02; - WFIFOL(char_fd, 2) = sd->bl.bl_id; + WFIFOL(char_fd, 2) = sd->bl_id; WFIFOL(char_fd, 6) = sd->login_id1; WFIFOL(char_fd, 10) = sd->login_id2; WFIFOL(char_fd, 14) = s_ip; @@ -696,7 +696,7 @@ int chrif_saveaccountreg2(struct map_session_data *sd) } WFIFOW(char_fd, 0) = 0x2b10; WFIFOW(char_fd, 2) = p; - WFIFOL(char_fd, 4) = sd->bl.bl_id; + WFIFOL(char_fd, 4) = sd->bl_id; WFIFOSET(char_fd, p); return 0; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index fadb216..8419c7d 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -323,7 +323,7 @@ int clif_send(const uint8_t *buf, int len, struct block_list *bl, SendWho type) if (!session[i]) continue; map_session_data *sd = static_cast<map_session_data *>(session[i]->session_data.get()); - if (sd && sd->state.auth && sd->bl.bl_m == bl->bl_m) + if (sd && sd->state.auth && sd->bl_m == bl->bl_m) { if (clif_parse_func_table[RBUFW(buf, 0)].len) { @@ -377,15 +377,15 @@ int clif_send(const uint8_t *buf, int len, struct block_list *bl, SendWho type) struct map_session_data *sd = p->member[i].sd; if (sd) { - if (sd->bl.bl_id == bl->bl_id && (type == SendWho::PARTY_WOS || + if (sd->bl_id == bl->bl_id && (type == SendWho::PARTY_WOS || type == SendWho::PARTY_SAMEMAP_WOS || type == SendWho::PARTY_AREA_WOS)) continue; - if (type != SendWho::PARTY && type != SendWho::PARTY_WOS && bl->bl_m != sd->bl.bl_m) // マップチェック + if (type != SendWho::PARTY && type != SendWho::PARTY_WOS && bl->bl_m != sd->bl_m) // マップチェック continue; if ((type == SendWho::PARTY_AREA || type == SendWho::PARTY_AREA_WOS) && - (sd->bl.bl_x < x0 || sd->bl.bl_y < y0 || - sd->bl.bl_x > x1 || sd->bl.bl_y > y1)) + (sd->bl_x < x0 || sd->bl_y < y0 || + sd->bl_x > x1 || sd->bl_y > y1)) continue; if (clif_parse_func_table[RBUFW(buf, 0)].len) { @@ -459,7 +459,7 @@ int clif_authok(struct map_session_data *sd) WFIFOW(fd, 0) = 0x73; WFIFOL(fd, 2) = gettick().time_since_epoch().count(); - WFIFOPOS(fd, 6, sd->bl.bl_x, sd->bl.bl_y); + WFIFOPOS(fd, 6, sd->bl_x, sd->bl_y); WFIFOB(fd, 9) = 5; WFIFOB(fd, 10) = 5; WFIFOSET(fd, clif_parse_func_table[0x73].len); @@ -521,14 +521,14 @@ int clif_set009e(struct flooritem_data *fitem, uint8_t *buf) //009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w WBUFW(buf, 0) = 0x9e; - WBUFL(buf, 2) = fitem->bl.bl_id; + WBUFL(buf, 2) = fitem->bl_id; if ((view = itemdb_viewid(fitem->item_data.nameid)) > 0) WBUFW(buf, 6) = view; else WBUFW(buf, 6) = fitem->item_data.nameid; WBUFB(buf, 8) = fitem->item_data.identify; - WBUFW(buf, 9) = fitem->bl.bl_x; - WBUFW(buf, 11) = fitem->bl.bl_y; + WBUFW(buf, 9) = fitem->bl_x; + WBUFW(buf, 11) = fitem->bl_y; WBUFB(buf, 13) = fitem->subx; WBUFB(buf, 14) = fitem->suby; WBUFW(buf, 15) = fitem->item_data.amount; @@ -549,7 +549,7 @@ int clif_dropflooritem(struct flooritem_data *fitem) if (fitem->item_data.nameid <= 0) return 0; clif_set009e(fitem, buf); - clif_send(buf, clif_parse_func_table[0x9e].len, &fitem->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0x9e].len, fitem, SendWho::AREA); return 0; } @@ -565,11 +565,11 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) nullpo_ret(fitem); WBUFW(buf, 0) = 0xa1; - WBUFL(buf, 2) = fitem->bl.bl_id; + WBUFL(buf, 2) = fitem->bl_id; if (fd == 0) { - clif_send(buf, clif_parse_func_table[0xa1].len, &fitem->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0xa1].len, fitem, SendWho::AREA); } else { @@ -657,7 +657,7 @@ int clif_set0078(struct map_session_data *sd, unsigned char *buf) nullpo_ret(sd); WBUFW(buf, 0) = 0x1d8; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(sd->speed.count()); WBUFW(buf, 8) = static_cast<uint16_t>(sd->opt1); WBUFW(buf, 10) = static_cast<uint16_t>(sd->opt2); @@ -704,7 +704,7 @@ int clif_set0078(struct map_session_data *sd, unsigned char *buf) WBUFW(buf, 42) = uint16_t(sd->opt3); WBUFB(buf, 44) = sd->status.karma; WBUFB(buf, 45) = sd->sex; - WBUFPOS(buf, 46, sd->bl.bl_x, sd->bl.bl_y); + WBUFPOS(buf, 46, sd->bl_x, sd->bl_y); // work around ICE in gcc 4.6 uint8_t dir = static_cast<uint8_t>(sd->dir); WBUFB(buf, 48) |= dir; @@ -725,7 +725,7 @@ int clif_set007b(struct map_session_data *sd, unsigned char *buf) nullpo_ret(sd); WBUFW(buf, 0) = 0x1da; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(sd->speed.count()); WBUFW(buf, 8) = static_cast<uint16_t>(sd->opt1); WBUFW(buf, 10) = static_cast<uint16_t>(sd->opt2); @@ -766,7 +766,7 @@ int clif_set007b(struct map_session_data *sd, unsigned char *buf) WBUFW(buf, 46) = uint16_t(sd->opt3); WBUFB(buf, 48) = sd->status.karma; WBUFB(buf, 49) = sd->sex; - WBUFPOS2(buf, 50, sd->bl.bl_x, sd->bl.bl_y, sd->to_x, sd->to_y); + WBUFPOS2(buf, 50, sd->bl_x, sd->bl_y, sd->to_x, sd->to_y); WBUFW(buf, 55) = pc_isGM(sd) == 60 ? 0x80 : 0; WBUFB(buf, 57) = 5; WBUFW(buf, 58) = 0; @@ -788,14 +788,14 @@ int clif_mob0078(struct mob_data *md, unsigned char *buf) nullpo_ret(md); WBUFW(buf, 0) = 0x78; - WBUFL(buf, 2) = md->bl.bl_id; - WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(&md->bl).count()); + WBUFL(buf, 2) = md->bl_id; + WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(md).count()); WBUFW(buf, 8) = static_cast<uint16_t>(md->opt1); WBUFW(buf, 10) = static_cast<uint16_t>(md->opt2); WBUFW(buf, 12) = static_cast<uint16_t>(md->option); WBUFW(buf, 14) = md->mob_class; // snip: stuff do do with disguise as a PC - WBUFPOS(buf, 46, md->bl.bl_x, md->bl.bl_y); + WBUFPOS(buf, 46, md->bl_x, md->bl_y); // work around ICE in gcc 4.6 uint8_t dir = static_cast<uint8_t>(md->dir); WBUFB(buf, 48) |= dir; @@ -803,7 +803,7 @@ int clif_mob0078(struct mob_data *md, unsigned char *buf) WBUFB(buf, 50) = 5; WBUFW(buf, 52) = ((level = - battle_get_lv(&md->bl)) > + battle_get_lv(md)) > battle_config.max_lv) ? battle_config.max_lv : level; return clif_parse_func_table[0x78].len; @@ -823,8 +823,8 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf) nullpo_ret(md); WBUFW(buf, 0) = 0x7b; - WBUFL(buf, 2) = md->bl.bl_id; - WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(&md->bl).count()); + WBUFL(buf, 2) = md->bl_id; + WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(md).count()); WBUFW(buf, 8) = static_cast<uint16_t>(md->opt1); WBUFW(buf, 10) = static_cast<uint16_t>(md->opt2); WBUFW(buf, 12) = static_cast<uint16_t>(md->option); @@ -832,12 +832,12 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf) // snip: stuff for monsters disguised as PCs WBUFL(buf, 22) = gettick().time_since_epoch().count(); - WBUFPOS2(buf, 50, md->bl.bl_x, md->bl.bl_y, md->to_x, md->to_y); + WBUFPOS2(buf, 50, md->bl_x, md->bl_y, md->to_x, md->to_y); WBUFB(buf, 56) = 5; WBUFB(buf, 57) = 5; WBUFW(buf, 58) = ((level = - battle_get_lv(&md->bl)) > + battle_get_lv(md)) > battle_config.max_lv) ? battle_config.max_lv : level; return clif_parse_func_table[0x7b].len; @@ -855,10 +855,10 @@ int clif_npc0078(struct npc_data *nd, unsigned char *buf) memset(buf, 0, clif_parse_func_table[0x78].len); WBUFW(buf, 0) = 0x78; - WBUFL(buf, 2) = nd->bl.bl_id; + WBUFL(buf, 2) = nd->bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(nd->speed.count()); WBUFW(buf, 14) = nd->npc_class; - WBUFPOS(buf, 46, nd->bl.bl_x, nd->bl.bl_y); + WBUFPOS(buf, 46, nd->bl_x, nd->bl_y); // work around ICE in gcc 4.6 uint8_t dir = static_cast<uint8_t>(nd->dir); WBUFB(buf, 48) |= dir; @@ -902,20 +902,20 @@ int clif_spawnpc(struct map_session_data *sd) WBUFW(buf, 0) = 0x1d9; WBUFW(buf, 51) = 0; - clif_send(buf, clif_parse_func_table[0x1d9].len, &sd->bl, SendWho::AREA_WOS); + clif_send(buf, clif_parse_func_table[0x1d9].len, sd, SendWho::AREA_WOS); + + if (map[sd->bl_m].flag.snow) + clif_specialeffect(sd, 162, 1); + if (map[sd->bl_m].flag.fog) + clif_specialeffect(sd, 233, 1); + if (map[sd->bl_m].flag.sakura) + clif_specialeffect(sd, 163, 1); + if (map[sd->bl_m].flag.leaves) + clif_specialeffect(sd, 333, 1); + if (map[sd->bl_m].flag.rain) + clif_specialeffect(sd, 161, 1); - if (map[sd->bl.bl_m].flag.snow) - clif_specialeffect(&sd->bl, 162, 1); - if (map[sd->bl.bl_m].flag.fog) - clif_specialeffect(&sd->bl, 233, 1); - if (map[sd->bl.bl_m].flag.sakura) - clif_specialeffect(&sd->bl, 163, 1); - if (map[sd->bl.bl_m].flag.leaves) - clif_specialeffect(&sd->bl, 333, 1); - if (map[sd->bl.bl_m].flag.rain) - clif_specialeffect(&sd->bl, 161, 1); - -// clif_changelook_accessories(&sd->bl, NULL); +// clif_changelook_accessories(sd, NULL); return 0; } @@ -937,15 +937,15 @@ int clif_spawnnpc(struct npc_data *nd) memset(buf, 0, clif_parse_func_table[0x7c].len); WBUFW(buf, 0) = 0x7c; - WBUFL(buf, 2) = nd->bl.bl_id; + WBUFL(buf, 2) = nd->bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(nd->speed.count()); WBUFW(buf, 20) = nd->npc_class; - WBUFPOS(buf, 36, nd->bl.bl_x, nd->bl.bl_y); + WBUFPOS(buf, 36, nd->bl_x, nd->bl_y); - clif_send(buf, clif_parse_func_table[0x7c].len, &nd->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0x7c].len, nd, SendWho::AREA); len = clif_npc0078(nd, buf); - clif_send(buf, len, &nd->bl, SendWho::AREA); + clif_send(buf, len, nd, SendWho::AREA); return 0; } @@ -967,7 +967,7 @@ int clif_spawn_fake_npc_for_player(struct map_session_data *sd, int fake_npc_id) WFIFOW(fd, 10) = 0; WFIFOW(fd, 12) = 0; WFIFOW(fd, 20) = 127; - WFIFOPOS(fd, 36, sd->bl.bl_x, sd->bl.bl_y); + WFIFOPOS(fd, 36, sd->bl_x, sd->bl_y); WFIFOSET(fd, clif_parse_func_table[0x7c].len); WFIFOW(fd, 0) = 0x78; @@ -978,8 +978,8 @@ int clif_spawn_fake_npc_for_player(struct map_session_data *sd, int fake_npc_id) WFIFOW(fd, 12) = 0; WFIFOW(fd, 14) = 127; // identifies as NPC WFIFOW(fd, 20) = 127; - WFIFOPOS(fd, 46, sd->bl.bl_x, sd->bl.bl_y); - WFIFOPOS(fd, 36, sd->bl.bl_x, sd->bl.bl_y); + WFIFOPOS(fd, 46, sd->bl_x, sd->bl_y); + WFIFOPOS(fd, 36, sd->bl_x, sd->bl_y); WFIFOB(fd, 49) = 5; WFIFOB(fd, 50) = 5; WFIFOSET(fd, clif_parse_func_table[0x78].len); @@ -1002,18 +1002,18 @@ int clif_spawnmob(struct mob_data *md) memset(buf, 0, clif_parse_func_table[0x7c].len); WBUFW(buf, 0) = 0x7c; - WBUFL(buf, 2) = md->bl.bl_id; + WBUFL(buf, 2) = md->bl_id; WBUFW(buf, 6) = md->stats[mob_stat::SPEED]; WBUFW(buf, 8) = uint16_t(md->opt1); WBUFW(buf, 10) = uint16_t(md->opt2); WBUFW(buf, 12) = uint16_t(md->option); WBUFW(buf, 20) = md->mob_class; - WBUFPOS(buf, 36, md->bl.bl_x, md->bl.bl_y); - clif_send(buf, clif_parse_func_table[0x7c].len, &md->bl, SendWho::AREA); + WBUFPOS(buf, 36, md->bl_x, md->bl_y); + clif_send(buf, clif_parse_func_table[0x7c].len, md, SendWho::AREA); } len = clif_mob0078(md, buf); - clif_send(buf, len, &md->bl, SendWho::AREA); + clif_send(buf, len, md, SendWho::AREA); return 0; } @@ -1050,7 +1050,7 @@ int clif_walkok(struct map_session_data *sd) fd = sd->fd; WFIFOW(fd, 0) = 0x87; WFIFOL(fd, 2) = gettick().time_since_epoch().count(); - WFIFOPOS2(fd, 6, sd->bl.bl_x, sd->bl.bl_y, sd->to_x, sd->to_y); + WFIFOPOS2(fd, 6, sd->bl_x, sd->bl_y, sd->to_x, sd->to_y); WFIFOB(fd, 11) = 0; WFIFOSET(fd, clif_parse_func_table[0x87].len); @@ -1070,10 +1070,10 @@ int clif_movechar(struct map_session_data *sd) len = clif_set007b(sd, buf); - clif_send(buf, len, &sd->bl, SendWho::AREA_WOS); + clif_send(buf, len, sd, SendWho::AREA_WOS); if (battle_config.save_clothcolor == 1 && sd->status.clothes_color > 0) - clif_changelook(&sd->bl, LOOK::CLOTHES_COLOR, + clif_changelook(sd, LOOK::CLOTHES_COLOR, sd->status.clothes_color); return 0; @@ -2032,7 +2032,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, WBUFW(buf, 9) = 0; } if (dstsd) - clif_send(buf, clif_parse_func_table[0x1d7].len, &dstsd->bl, SendWho::SELF); + clif_send(buf, clif_parse_func_table[0x1d7].len, dstsd, SendWho::SELF); else clif_send(buf, clif_parse_func_table[0x1d7].len, bl, SendWho::AREA); } @@ -2044,7 +2044,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, WBUFW(buf, 7) = val; WBUFW(buf, 9) = 0; if (dstsd) - clif_send(buf, clif_parse_func_table[0x1d7].len, &dstsd->bl, SendWho::SELF); + clif_send(buf, clif_parse_func_table[0x1d7].len, dstsd, SendWho::SELF); else clif_send(buf, clif_parse_func_table[0x1d7].len, bl, SendWho::AREA); } @@ -2283,10 +2283,10 @@ int clif_useitemack(struct map_session_data *sd, int index, int amount, WBUFW(buf, 4) = sd->inventory_data[index]->view_id; else WBUFW(buf, 4) = sd->status.inventory[index].nameid; - WBUFL(buf, 6) = sd->bl.bl_id; + WBUFL(buf, 6) = sd->bl_id; WBUFW(buf, 10) = amount; WBUFB(buf, 12) = ok; - clif_send(buf, clif_parse_func_table[0x1c8].len, &sd->bl, SendWho::SELF); + clif_send(buf, clif_parse_func_table[0x1c8].len, sd, SendWho::SELF); } return 0; @@ -2643,11 +2643,11 @@ void clif_getareachar_pc(struct map_session_data *sd, } if (battle_config.save_clothcolor == 1 && dstsd->status.clothes_color > 0) - clif_changelook(&dstsd->bl, LOOK::CLOTHES_COLOR, + clif_changelook(dstsd, LOOK::CLOTHES_COLOR, dstsd->status.clothes_color); - clif_changelook_accessories(&sd->bl, dstsd); - clif_changelook_accessories(&dstsd->bl, sd); + clif_changelook_accessories(sd, dstsd); + clif_changelook_accessories(dstsd, sd); } /*========================================== @@ -2681,7 +2681,7 @@ int clif_movemob(struct mob_data *md) nullpo_ret(md); len = clif_mob007b(md, buf); - clif_send(buf, len, &md->bl, SendWho::AREA); + clif_send(buf, len, md, SendWho::AREA); return 0; } @@ -2700,12 +2700,12 @@ int clif_fixmobpos(struct mob_data *md) if (md->state.state == MS::WALK) { len = clif_mob007b(md, buf); - clif_send(buf, len, &md->bl, SendWho::AREA); + clif_send(buf, len, md, SendWho::AREA); } else { len = clif_mob0078(md, buf); - clif_send(buf, len, &md->bl, SendWho::AREA); + clif_send(buf, len, md, SendWho::AREA); } return 0; @@ -2725,14 +2725,14 @@ int clif_fixpcpos(struct map_session_data *sd) if (sd->walktimer) { len = clif_set007b(sd, buf); - clif_send(buf, len, &sd->bl, SendWho::AREA); + clif_send(buf, len, sd, SendWho::AREA); } else { len = clif_set0078(sd, buf); - clif_send(buf, len, &sd->bl, SendWho::AREA); + clif_send(buf, len, sd, SendWho::AREA); } - clif_changelook_accessories(&sd->bl, NULL); + clif_changelook_accessories(sd, NULL); return 0; } @@ -2807,14 +2807,14 @@ void clif_getareachar_item(struct map_session_data *sd, fd = sd->fd; //009d <ID>.l <item ID>.w <identify flag>.B <X>.w <Y>.w <amount>.w <subX>.B <subY>.B WFIFOW(fd, 0) = 0x9d; - WFIFOL(fd, 2) = fitem->bl.bl_id; + WFIFOL(fd, 2) = fitem->bl_id; if ((view = itemdb_viewid(fitem->item_data.nameid)) > 0) WFIFOW(fd, 6) = view; else WFIFOW(fd, 6) = fitem->item_data.nameid; WFIFOB(fd, 8) = fitem->item_data.identify; - WFIFOW(fd, 9) = fitem->bl.bl_x; - WFIFOW(fd, 11) = fitem->bl.bl_y; + WFIFOW(fd, 9) = fitem->bl_x; + WFIFOW(fd, 11) = fitem->bl_y; WFIFOW(fd, 13) = fitem->item_data.amount; WFIFOB(fd, 15) = fitem->subx; WFIFOB(fd, 16) = fitem->suby; @@ -2872,8 +2872,8 @@ void clif_pcoutsight(struct block_list *bl, struct map_session_data *sd) dstsd = (struct map_session_data *) bl; if (sd != dstsd) { - clif_clearchar_id(dstsd->bl.bl_id, BeingRemoveWhy::GONE, sd->fd); - clif_clearchar_id(sd->bl.bl_id, BeingRemoveWhy::GONE, dstsd->fd); + clif_clearchar_id(dstsd->bl_id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(sd->bl_id, BeingRemoveWhy::GONE, dstsd->fd); } break; case BL::NPC: @@ -2935,7 +2935,7 @@ void clif_moboutsight(struct block_list *bl, struct mob_data *md) if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { - clif_clearchar_id(md->bl.bl_id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(md->bl_id, BeingRemoveWhy::GONE, sd->fd); } } @@ -2983,7 +2983,7 @@ int clif_skillinfo(struct map_session_data *sd, SkillID skillid, int type, { range = skill_get_range(skillid, sd->status.skill[skillid].lv); if (range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = battle_get_range(sd) - (range + 1); WFIFOW(fd, 12) = range; } else @@ -3022,7 +3022,7 @@ int clif_skillinfoblock(struct map_session_data *sd) WFIFOW(fd, len + 8) = skill_get_sp(i, sd->status.skill[i].lv); range = skill_get_range(i, sd->status.skill[i].lv); if (range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = battle_get_range(sd) - (range + 1); WFIFOW(fd, len + 10) = range; memset(WFIFOP(fd, len + 12), 0, 24); WFIFOB(fd, len + 36) = sd->status.skill[i].lv < skill_get_max_raise(i); @@ -3052,7 +3052,7 @@ int clif_skillup(struct map_session_data *sd, SkillID skill_num) WFIFOW(fd, 6) = skill_get_sp(skill_num, sd->status.skill[skill_num].lv); range = skill_get_range(skill_num, sd->status.skill[skill_num].lv); if (range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = battle_get_range(sd) - (range + 1); WFIFOW(fd, 8) = range; WFIFOB(fd, 10) = sd->status.skill[skill_num].lv < skill_get_max_raise(skill_num); WFIFOSET(fd, clif_parse_func_table[0x10e].len); @@ -3302,7 +3302,7 @@ int clif_party_info(struct party *p, int fd) return 9; } if (sd != NULL) - clif_send(buf, WBUFW(buf, 2), &sd->bl, SendWho::PARTY); + clif_send(buf, WBUFW(buf, 2), sd, SendWho::PARTY); return 0; } @@ -3390,7 +3390,7 @@ int clif_party_option(struct party *p, struct map_session_data *sd, int flag) WBUFW(buf, 2) = ((flag & 0x01) ? 2 : p->exp); WBUFW(buf, 4) = ((flag & 0x10) ? 2 : p->item); if (flag == 0) - clif_send(buf, clif_parse_func_table[0x101].len, &sd->bl, SendWho::PARTY); + clif_send(buf, clif_parse_func_table[0x101].len, sd, SendWho::PARTY); else { memcpy(WFIFOP(sd->fd, 0), buf, clif_parse_func_table[0x101].len); @@ -3423,7 +3423,7 @@ int clif_party_leaved(struct party *p, struct map_session_data *sd, if ((sd = p->member[i].sd) != NULL) break; if (sd != NULL) - clif_send(buf, clif_parse_func_table[0x105].len, &sd->bl, SendWho::PARTY); + clif_send(buf, clif_parse_func_table[0x105].len, sd, SendWho::PARTY); } else if (sd != NULL) { @@ -3457,7 +3457,7 @@ int clif_party_message(struct party *p, int account_id, const char *mes, int len WBUFW(buf, 2) = len + 8; WBUFL(buf, 4) = account_id; memcpy(WBUFP(buf, 8), mes, len); - clif_send(buf, len + 8, &sd->bl, SendWho::PARTY); + clif_send(buf, len + 8, sd, SendWho::PARTY); } return 0; } @@ -3474,9 +3474,9 @@ int clif_party_xy(struct party *, struct map_session_data *sd) WBUFW(buf, 0) = 0x107; WBUFL(buf, 2) = sd->status.account_id; - WBUFW(buf, 6) = sd->bl.bl_x; - WBUFW(buf, 8) = sd->bl.bl_y; - clif_send(buf, clif_parse_func_table[0x107].len, &sd->bl, SendWho::PARTY_SAMEMAP_WOS); + WBUFW(buf, 6) = sd->bl_x; + WBUFW(buf, 8) = sd->bl_y; + clif_send(buf, clif_parse_func_table[0x107].len, sd, SendWho::PARTY_SAMEMAP_WOS); // if(battle_config.etc_log) // PRINTF("clif_party_xy %d\n",sd->status.account_id); return 0; @@ -3497,7 +3497,7 @@ int clif_party_hp(struct party *, struct map_session_data *sd) WBUFW(buf, 6) = (sd->status.hp > 0x7fff) ? 0x7fff : sd->status.hp; WBUFW(buf, 8) = (sd->status.max_hp > 0x7fff) ? 0x7fff : sd->status.max_hp; - clif_send(buf, clif_parse_func_table[0x106].len, &sd->bl, SendWho::PARTY_AREA_WOS); + clif_send(buf, clif_parse_func_table[0x106].len, sd, SendWho::PARTY_AREA_WOS); // if(battle_config.etc_log) // PRINTF("clif_party_hp %d\n",sd->status.account_id); return 0; @@ -3519,8 +3519,8 @@ int clif_movetoattack(struct map_session_data *sd, struct block_list *bl) WFIFOL(fd, 2) = bl->bl_id; WFIFOW(fd, 6) = bl->bl_x; WFIFOW(fd, 8) = bl->bl_y; - WFIFOW(fd, 10) = sd->bl.bl_x; - WFIFOW(fd, 12) = sd->bl.bl_y; + WFIFOW(fd, 10) = sd->bl_x; + WFIFOW(fd, 12) = sd->bl_y; WFIFOW(fd, 14) = sd->attackrange; WFIFOSET(fd, clif_parse_func_table[0x139].len); return 0; @@ -3537,8 +3537,8 @@ int clif_mvp_effect(struct map_session_data *sd) nullpo_ret(sd); WBUFW(buf, 0) = 0x10c; - WBUFL(buf, 2) = sd->bl.bl_id; - clif_send(buf, clif_parse_func_table[0x10c].len, &sd->bl, SendWho::AREA); + WBUFL(buf, 2) = sd->bl_id; + clif_send(buf, clif_parse_func_table[0x10c].len, sd, SendWho::AREA); return 0; } @@ -3591,9 +3591,9 @@ void clif_sitting(int, struct map_session_data *sd) nullpo_retv(sd); WBUFW(buf, 0) = 0x8a; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFB(buf, 26) = 2; - clif_send(buf, clif_parse_func_table[0x8a].len, &sd->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0x8a].len, sd, SendWho::AREA); } /*========================================== @@ -3651,8 +3651,8 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) if (!session[i]) continue; struct map_session_data *sd = static_cast<map_session_data *>(session[i]->session_data.get()); - if (sd && sd->state.auth && sd->bl.bl_m == bl->bl_m) - clif_specialeffect(&sd->bl, type, 1); + if (sd && sd->state.auth && sd->bl_m == bl->bl_m) + clif_specialeffect(sd, type, 1); } } else if (flag == 1) @@ -3713,7 +3713,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) tick_t(static_cast<interval_t>(RFIFOL(fd, 14))), RFIFOB(fd, 18)); - map_addiddb(&sd->bl); + map_addiddb(sd); chrif_authreq(sd); } @@ -3733,7 +3733,7 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) int i; nullpo_retv(sd); - if (sd->bl.bl_prev != NULL) + if (sd->bl_prev != NULL) return; // 接続ok時 @@ -3765,7 +3765,7 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time)); } - map_addblock(&sd->bl); // ブロック登録 + map_addblock(sd); // ブロック登録 clif_spawnpc(sd); // spawn // weight max , now @@ -3776,14 +3776,14 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) if (!battle_config.pk_mode) sd->pvp_timer.cancel(); - if (map[sd->bl.bl_m].flag.pvp) + if (map[sd->bl_m].flag.pvp) { if (!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200), std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, - sd->bl.bl_id)); + sd->bl_id)); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; @@ -3797,30 +3797,30 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) sd->state.connect_new = 0; // view equipment item - clif_changelook(&sd->bl, LOOK::WEAPON, static_cast<uint16_t>(ItemLook::NONE)); + clif_changelook(sd, LOOK::WEAPON, static_cast<uint16_t>(ItemLook::NONE)); if (battle_config.save_clothcolor == 1 && sd->status.clothes_color > 0) - clif_changelook(&sd->bl, LOOK::CLOTHES_COLOR, + clif_changelook(sd, LOOK::CLOTHES_COLOR, sd->status.clothes_color); // option - clif_changeoption(&sd->bl); + clif_changeoption(sd); for (i = 0; i < MAX_INVENTORY; i++) { if (bool(sd->status.inventory[i].equip) && bool(sd->status.inventory[i].equip & EPOS::WEAPON) && sd->status.inventory[i].broken == 1) - skill_status_change_start(&sd->bl, StatusChange::SC_BROKNWEAPON, 0, interval_t::zero()); + skill_status_change_start(sd, StatusChange::SC_BROKNWEAPON, 0, interval_t::zero()); if (bool(sd->status.inventory[i].equip) && bool(sd->status.inventory[i].equip & EPOS::MISC1) && sd->status.inventory[i].broken == 1) - skill_status_change_start(&sd->bl, StatusChange::SC_BROKNARMOR, 0, interval_t::zero()); + skill_status_change_start(sd, StatusChange::SC_BROKNARMOR, 0, interval_t::zero()); } // clif_changelook_accessories(sd, NULL); - map_foreachinarea(std::bind(clif_getareachar, ph::_1, sd), sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE, - sd->bl.bl_y - AREA_SIZE, sd->bl.bl_x + AREA_SIZE, - sd->bl.bl_y + AREA_SIZE, BL::NUL); + map_foreachinarea(std::bind(clif_getareachar, ph::_1, sd), sd->bl_m, sd->bl_x - AREA_SIZE, + sd->bl_y - AREA_SIZE, sd->bl_x + AREA_SIZE, + sd->bl_y + AREA_SIZE, BL::NUL); } /*========================================== @@ -3850,7 +3850,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } @@ -4057,10 +4057,10 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) /* It's not a spell/magic message, so send the message to others. */ WBUFW(reinterpret_cast<uint8_t *>(buf), 0) = 0x8d; WBUFW(reinterpret_cast<uint8_t *>(buf), 2) = msg_len + 8; /* Header(2) + length(2) + ID(4). */ - WBUFL(reinterpret_cast<uint8_t *>(buf), 4) = sd->bl.bl_id; + WBUFL(reinterpret_cast<uint8_t *>(buf), 4) = sd->bl_id; // evil multiuse buffer! - clif_send((const uint8_t *)buf, msg_len + 8, &sd->bl, SendWho::AREA_CHAT_WOC); + clif_send((const uint8_t *)buf, msg_len + 8, sd, SendWho::AREA_CHAT_WOC); } /* Send the message back to the speaker. */ @@ -4114,11 +4114,11 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) pc_setdir(sd, dir); WBUFW(buf, 0) = 0x9c; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFW(buf, 6) = 0; WBUFB(buf, 8) = static_cast<uint8_t>(dir); - clif_send(buf, clif_parse_func_table[0x9c].len, &sd->bl, SendWho::AREA_WOS); + clif_send(buf, clif_parse_func_table[0x9c].len, sd, SendWho::AREA_WOS); } @@ -4137,9 +4137,9 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) || pc_checkskill(sd, SkillID::NV_EMOTE) >= 1) { WBUFW(buf, 0) = 0xc0; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFB(buf, 6) = RFIFOB(fd, 2); - clif_send(buf, clif_parse_func_table[0xc0].len, &sd->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0xc0].len, sd, SendWho::AREA); } else clif_skill_fail(sd, SkillID::ONE, 0, 1); @@ -4171,7 +4171,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } if (sd->npc_id != 0 @@ -4217,9 +4217,9 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) skill_gangsterparadise(sd, 0); // ギャングスターパラダイス解除 pc_setstand(sd); WBUFW(buf, 0) = 0x8a; - WBUFL(buf, 2) = sd->bl.bl_id; + WBUFL(buf, 2) = sd->bl_id; WBUFB(buf, 26) = 3; - clif_send(buf, clif_parse_func_table[0x8a].len, &sd->bl, SendWho::AREA); + clif_send(buf, clif_parse_func_table[0x8a].len, sd, SendWho::AREA); break; } } @@ -4372,7 +4372,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } @@ -4380,11 +4380,11 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) || sd->opt1 != Opt1::ZERO) //会話禁止 return; - if (fitem == NULL || fitem->bl.bl_m != sd->bl.bl_m) + if (fitem == NULL || fitem->bl_m != sd->bl_m) return; - if (abs(sd->bl.bl_x - fitem->bl.bl_x) >= 2 - || abs(sd->bl.bl_y - fitem->bl.bl_y) >= 2) + if (abs(sd->bl_x - fitem->bl_x) >= 2 + || abs(sd->bl_y - fitem->bl_y) >= 2) return; // too far away to pick up if (sd->state.shroud_active && sd->state.shroud_disappears_on_pickup) @@ -4406,10 +4406,10 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } - if (map[sd->bl.bl_m].flag.no_player_drops) + if (map[sd->bl_m].flag.no_player_drops) { clif_displaymessage(sd->fd, "Can't drop items here."); return; @@ -4438,7 +4438,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } if (sd->npc_id != 0 @@ -4464,7 +4464,7 @@ void clif_parse_EquipItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } index = RFIFOW(fd, 2) - 2; @@ -4505,14 +4505,14 @@ void clif_parse_UnequipItem(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } index = RFIFOW(fd, 2) - 2; if (sd->status.inventory[index].broken == 1 && sd->sc_data[StatusChange::SC_BROKNWEAPON].timer) - skill_status_change_end(&sd->bl, StatusChange::SC_BROKNWEAPON, nullptr); + skill_status_change_end(sd, StatusChange::SC_BROKNWEAPON, nullptr); if (sd->status.inventory[index].broken == 1 && sd->sc_data[StatusChange::SC_BROKNARMOR].timer) - skill_status_change_end(&sd->bl, StatusChange::SC_BROKNARMOR, nullptr); + skill_status_change_end(sd, StatusChange::SC_BROKNARMOR, nullptr); if (sd->npc_id != 0 || sd->opt1 != Opt1::ZERO) @@ -4531,7 +4531,7 @@ void clif_parse_NpcClicked(int fd, struct map_session_data *sd) if (pc_isdead(sd)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + clif_clearchar(sd, BeingRemoveWhy::DEAD); return; } if (sd->npc_id != 0) @@ -5789,12 +5789,12 @@ void clif_parse(int fd) if (sd->status.name != NULL) PRINTF("Player [%s] has logged off your server.\n", sd->status.name); // Player logout display [Valaris] else - PRINTF("Player with account [%d] has logged off your server.\n", sd->bl.bl_id); // Player logout display [Yor] + PRINTF("Player with account [%d] has logged off your server.\n", sd->bl_id); // Player logout display [Yor] } else if (sd) { // not authentified! (refused by char-server or disconnect before to be authentified) - PRINTF("Player with account [%d] has logged off your server (not auth account).\n", sd->bl.bl_id); // Player logout display [Yor] - map_deliddb(&sd->bl); // account_id has been included in the DB before auth answer + PRINTF("Player with account [%d] has logged off your server (not auth account).\n", sd->bl_id); // Player logout display [Yor] + map_deliddb(sd); // account_id has been included in the DB before auth answer } if (fd) delete_session(fd); @@ -5895,10 +5895,10 @@ void clif_parse(int fd) sd->status.account_id, sd->status.char_id, sd->status.name); else - PRINTF("\nAccount ID %d.\n", sd->bl.bl_id); + PRINTF("\nAccount ID %d.\n", sd->bl_id); } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified) - PRINTF("\nAccount ID %d.\n", sd->bl.bl_id); + PRINTF("\nAccount ID %d.\n", sd->bl_id); if ((fp = fopen_(packet_txt, "a")) == NULL) { @@ -5921,12 +5921,12 @@ void clif_parse(int fd) else FPRINTF(fp, "%s\nPlayer with account ID %d sent wrong packet:\n", - now, sd->bl.bl_id); + now, sd->bl_id); } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified) FPRINTF(fp, "%s\nPlayer with account ID %d sent wrong packet:\n", - now, sd->bl.bl_id); + now, sd->bl_id); FPRINTF(fp, "\t---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F"); diff --git a/src/map/intif.cpp b/src/map/intif.cpp index 6fcdf68..c5d3c90 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -107,7 +107,7 @@ int intif_saveaccountreg(struct map_session_data *sd) nullpo_ret(sd); WFIFOW(char_fd, 0) = 0x3004; - WFIFOL(char_fd, 4) = sd->bl.bl_id; + WFIFOL(char_fd, 4) = sd->bl_id; for (j = 0, p = 8; j < sd->status.account_reg_num; j++, p += 36) { memcpy(WFIFOP(char_fd, p), sd->status.account_reg[j].str, 32); @@ -124,7 +124,7 @@ int intif_request_accountreg(struct map_session_data *sd) nullpo_ret(sd); WFIFOW(char_fd, 0) = 0x3005; - WFIFOL(char_fd, 2) = sd->bl.bl_id; + WFIFOL(char_fd, 2) = sd->bl_id; WFIFOSET(char_fd, 6); return 0; } @@ -159,7 +159,7 @@ int intif_create_party(struct map_session_data *sd, const char *name) WFIFOL(char_fd, 2) = sd->status.account_id; memcpy(WFIFOP(char_fd, 6), name, 24); memcpy(WFIFOP(char_fd, 30), sd->status.name, 24); - memcpy(WFIFOP(char_fd, 54), map[sd->bl.bl_m].name, 16); + memcpy(WFIFOP(char_fd, 54), map[sd->bl_m].name, 16); WFIFOW(char_fd, 70) = sd->status.base_level; WFIFOSET(char_fd, 72); // if(battle_config.etc_log) @@ -191,7 +191,7 @@ int intif_party_addmember(int party_id, int account_id) WFIFOL(char_fd, 2) = party_id; WFIFOL(char_fd, 6) = account_id; memcpy(WFIFOP(char_fd, 10), sd->status.name, 24); - memcpy(WFIFOP(char_fd, 34), map[sd->bl.bl_m].name, 16); + memcpy(WFIFOP(char_fd, 34), map[sd->bl_m].name, 16); WFIFOW(char_fd, 50) = sd->status.base_level; WFIFOSET(char_fd, 52); } @@ -230,7 +230,7 @@ int intif_party_changemap(struct map_session_data *sd, int online) WFIFOW(char_fd, 0) = 0x3025; WFIFOL(char_fd, 2) = sd->status.party_id; WFIFOL(char_fd, 6) = sd->status.account_id; - memcpy(WFIFOP(char_fd, 10), map[sd->bl.bl_m].name, 16); + memcpy(WFIFOP(char_fd, 10), map[sd->bl_m].name, 16); WFIFOB(char_fd, 26) = online; WFIFOW(char_fd, 27) = sd->status.base_level; WFIFOSET(char_fd, 29); diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp index 1cdfd75..f9832b5 100644 --- a/src/map/magic-interpreter-base.cpp +++ b/src/map/magic-interpreter-base.cpp @@ -39,7 +39,7 @@ static void set_invocation(val_t *v, invocation_t *i) { v->ty = TYPE::INVOCATION; - v->v.v_int = i->bl.bl_id; + v->v.v_int = i->bl_id; } static @@ -208,7 +208,7 @@ env_t *spell_create_env(magic_conf_t *conf, spell_t *spell, character_t *subject = map_nick2sd(param); if (!subject) subject = caster; - set_env_entity(spell->arg, &subject->bl); + set_env_entity(spell->arg, subject); free(param); break; } @@ -223,7 +223,7 @@ env_t *spell_create_env(magic_conf_t *conf, spell_t *spell, spell->spellarg_ty); } - set_env_entity(VAR_CASTER, &caster->bl); + set_env_entity(VAR_CASTER, caster); set_env_int(VAR_SPELLPOWER, spellpower); set_env_spell(VAR_SPELL, spell); @@ -492,13 +492,13 @@ invocation_t *spell_instantiate(effect_set_t *effect_set, env_t *env) retval->end_effect = effect_set->at_end; caster = map_id2bl(retval->caster); // must still exist - retval->bl.bl_id = map_addobject(&retval->bl); - retval->bl.bl_type = BL::SPELL; - retval->bl.bl_m = caster->bl_m; - retval->bl.bl_x = caster->bl_x; - retval->bl.bl_y = caster->bl_y; + retval->bl_id = map_addobject(retval); + retval->bl_type = BL::SPELL; + retval->bl_m = caster->bl_m; + retval->bl_x = caster->bl_x; + retval->bl_y = caster->bl_y; - map_addblock(&retval->bl); + map_addblock(retval); set_env_invocation(VAR_INVOCATION, retval); return retval; @@ -524,11 +524,11 @@ invocation_t *spell_clone_effect(invocation_t *base) retval->status_change_refs = NULL; retval->flags = INVOCATION_FLAG::ZERO; - retval->bl.bl_id = 0; - retval->bl.bl_prev = NULL; - retval->bl.bl_next = NULL; + retval->bl_id = 0; + retval->bl_prev = NULL; + retval->bl_next = NULL; - retval->bl.bl_id = map_addobject(&retval->bl); + retval->bl_id = map_addobject(retval); set_env_invocation(VAR_INVOCATION, retval); return retval; @@ -554,7 +554,7 @@ void spell_bind(character_t *subject, invocation_t *invocation) invocation->next_invocation = subject->active_spells; subject->active_spells = invocation; invocation->flags |= INVOCATION_FLAG::BOUND; - invocation->subject = subject->bl.bl_id; + invocation->subject = subject->bl_id; } spell_set_location(invocation, (entity_t *) subject); diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp index 22223ec..5d3d389 100644 --- a/src/map/magic-interpreter.hpp +++ b/src/map/magic-interpreter.hpp @@ -308,10 +308,9 @@ typedef struct status_change_ref int bl_id; } status_change_ref_t; -typedef struct invocation +typedef struct invocation invocation_t; +struct invocation : block_list { - struct block_list bl; - struct invocation *next_invocation; /* used for spells directly associated with a caster: they form a singly-linked list */ INVOCATION_FLAG flags; @@ -334,7 +333,7 @@ typedef struct invocation int status_change_refs_nr; status_change_ref_t *status_change_refs; -} invocation_t; +}; extern magic_conf_t magic_conf; /* Global magic conf */ extern env_t magic_default_env; /* Fake default environment */ diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp index 607b6b2..3b56cbd 100644 --- a/src/map/magic-stmt.cpp +++ b/src/map/magic-stmt.cpp @@ -124,8 +124,8 @@ void spell_free_invocation(invocation_t *invocation) magic_free_env(invocation->env); - map_delblock(&invocation->bl); - map_delobject(invocation->bl.bl_id, BL::SPELL); // also frees the object + map_delblock(invocation); + map_delobject(invocation->bl_id, BL::SPELL); // also frees the object // free(invocation); } @@ -139,19 +139,19 @@ void char_set_weapon_icon(character_t *subject, int count, subject->attack_spell_look_override = look; if (old_icon != StatusChange::ZERO && old_icon != icon) - clif_status_change(&subject->bl, old_icon, 0); + clif_status_change(subject, old_icon, 0); clif_fixpcpos(subject); if (count) { - clif_changelook(&subject->bl, LOOK::WEAPON, look); + clif_changelook(subject, LOOK::WEAPON, look); if (icon != StatusChange::ZERO) - clif_status_change(&subject->bl, icon, 1); + clif_status_change(subject, icon, 1); } else { /* Set it to `normal' */ - clif_changelook(&subject->bl, LOOK::WEAPON, + clif_changelook(subject, LOOK::WEAPON, static_cast<uint16_t>(subject->status.weapon)); } } @@ -230,7 +230,7 @@ int trigger_spell(int subject, int spell) invocation->env->vars[VAR_CASTER].ty = TYPE::ENTITY; invocation->env->vars[VAR_CASTER].v.v_int = subject; - return invocation->bl.bl_id; + return invocation->bl_id; } static @@ -239,8 +239,8 @@ void entity_warp(entity_t *target, int destm, int destx, int desty); static void char_update(character_t *character) { - entity_warp((entity_t *) character, character->bl.bl_m, character->bl.bl_x, - character->bl.bl_y); + entity_warp((entity_t *) character, character->bl_m, character->bl_x, + character->bl_y); } static @@ -266,7 +266,7 @@ void magic_unshroud(character_t *other_char) // Now warp the caster out of and back into here to refresh everyone's display char_update(other_char); clif_displaymessage(other_char->fd, "Your shroud has been dispelled!"); -// entity_effect(&other_char->bl, MAGIC_EFFECT_REVEAL); +// entity_effect(other_char, MAGIC_EFFECT_REVEAL); } static @@ -284,9 +284,9 @@ struct npc_data *local_spell_effect(int m, int x, int y, int effect, std::chrono::seconds delay = std::chrono::seconds(30); struct npc_data *effect_npc = npc_spawn_text(m, x, y, INVISIBLE_NPC, "", "?"); - int effect_npc_id = effect_npc->bl.bl_id; + int effect_npc_id = effect_npc->bl_id; - entity_effect(&effect_npc->bl, effect, tdelay); + entity_effect(effect_npc, effect, tdelay); Timer(gettick() + delay, std::bind(timer_callback_effect_npc_delete, ph::_1, ph::_2, effect_npc_id) @@ -427,7 +427,7 @@ int op_messenger_npc(env_t *, int, val_t *args) Timer(gettick() + static_cast<interval_t>(ARGINT(4)), std::bind(timer_callback_kill_npc, ph::_1, ph::_2, - npc->bl.bl_id) + npc->bl_id) ).detach(); return 0; @@ -445,22 +445,22 @@ void entity_warp(entity_t *target, int destm, int destx, int desty) { character_t *character = (character_t *) target; char *map_name; - clif_clearchar(&character->bl, BeingRemoveWhy::WARPED); - map_delblock(&character->bl); - character->bl.bl_x = destx; - character->bl.bl_y = desty; - character->bl.bl_m = destm; + clif_clearchar(character, BeingRemoveWhy::WARPED); + map_delblock(character); + character->bl_x = destx; + character->bl_y = desty; + character->bl_m = destm; pc_touch_all_relevant_npcs(character); // Note that touching NPCs may have triggered warping and thereby updated x and y: - map_name = map[character->bl.bl_m].name; + map_name = map[character->bl_m].name; // Warp part #1: update relevant data, interrupt trading etc.: - pc_setpos(character, map_name, character->bl.bl_x, character->bl.bl_y, BeingRemoveWhy::GONE); + pc_setpos(character, map_name, character->bl_x, character->bl_y, BeingRemoveWhy::GONE); // Warp part #2: now notify the client clif_changemap(character, map_name, - character->bl.bl_x, character->bl.bl_y); + character->bl_x, character->bl_y); break; } case BL::MOB: @@ -588,7 +588,7 @@ int op_override_attack(env_t *env, int, val_t *args) } subject->attack_spell_override = - trigger_spell(subject->bl.bl_id, VAR(VAR_INVOCATION).v.v_int); + trigger_spell(subject->bl_id, VAR(VAR_INVOCATION).v.v_int); subject->attack_spell_charges = charges; if (subject->attack_spell_override) @@ -726,8 +726,8 @@ int op_spawn(env_t *, int, val_t *args) mob->mode = MobMode::CAN_ATTACK | MobMode::AGGRESSIVE | (mob->mode & MobMode::CAN_MOVE); if (owner) { - mob->target_id = owner->bl.bl_id; - mob->attacked_id = owner->bl.bl_id; + mob->target_id = owner->bl_id; + mob->attacked_id = owner->bl_id; } break; @@ -745,7 +745,7 @@ int op_spawn(env_t *, int, val_t *args) if (owner) { - mob->master_id = owner->bl.bl_id; + mob->master_id = owner->bl_id; mob->master_dist = 6; } } @@ -810,7 +810,7 @@ int op_injure(env_t *env, int, val_t *args) struct mob_data *mob = (struct mob_data *) target; MAP_LOG_PC(caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s", - mob->bl.bl_id, mob->mob_class, damage_caused, + mob->bl_id, mob->mob_class, damage_caused, get_invocation_name(env)); } } @@ -982,7 +982,7 @@ void spell_effect_report_termination(int invocation_id, int bl_id, int index = -1; invocation_t *invocation = (invocation_t *) map_id2bl(invocation_id); - if (!invocation || invocation->bl.bl_type != BL::SPELL) + if (!invocation || invocation->bl_type != BL::SPELL) return; for (i = 0; i < invocation->status_change_refs_nr; i++) @@ -1150,7 +1150,7 @@ void find_entities_in_area_c(entity_t *target, while (invoc) { - ADD_ENTITY(invoc->bl.bl_id); + ADD_ENTITY(invoc->bl_id); invoc = invoc->next_invocation; } } @@ -1408,7 +1408,7 @@ void print_cfg(int i, effect_t *e) static interval_t spell_run(invocation_t *invocation, int allow_delete) { - const int invocation_id = invocation->bl.bl_id; + const int invocation_id = invocation->bl_id; #define REFRESH_INVOCATION invocation = (invocation_t *) map_id2bl(invocation_id); if (!invocation) return interval_t::zero(); #ifdef DEBUG @@ -1496,31 +1496,31 @@ interval_t spell_run(invocation_t *invocation, int allow_delete) (character_t *) map_id2bl(message_recipient); if (recipient->npc_id - && recipient->npc_id != invocation->bl.bl_id) + && recipient->npc_id != invocation->bl_id) break; /* Don't send multiple message boxes at once */ if (!invocation->script_pos) // first time running this script? clif_spawn_fake_npc_for_player(recipient, - invocation->bl.bl_id); + invocation->bl_id); // We have to do this or otherwise the client won't think that it's // dealing with an NPC int newpos = run_script_l(e->e.e_script, invocation->script_pos, message_recipient, - invocation->bl.bl_id, + invocation->bl_id, 3, arg); /* Returns the new script position, or -1 once the script is finished */ if (newpos != -1) { /* Must set up for continuation */ - recipient->npc_id = invocation->bl.bl_id; + recipient->npc_id = invocation->bl_id; recipient->npc_pos = invocation->script_pos = newpos; return static_cast<interval_t>(-1); /* Signal `wait for script' */ } else invocation->script_pos = 0; - clif_clearchar_id(invocation->bl.bl_id, BeingRemoveWhy::DEAD, caster->fd); + clif_clearchar_id(invocation->bl_id, BeingRemoveWhy::DEAD, caster->fd); } REFRESH_INVOCATION; // Script may have killed the caster break; @@ -1584,7 +1584,7 @@ void spell_execute_d(invocation_t *invocation, int allow_deletion) assert (!invocation->timer); invocation->timer = Timer(gettick() + delta, std::bind(invocation_timer_callback, ph::_1, ph::_2, - invocation->bl.bl_id)); + invocation->bl_id)); } /* If 0, the script cleaned itself. If -1(wait-for-script), we must wait for the user. */ @@ -1638,7 +1638,7 @@ int spell_attack(int caster_id, int target_id) caster->attack_spell_charges--; } - if (invocation && caster->attack_spell_override != invocation->bl.bl_id) + if (invocation && caster->attack_spell_override != invocation->bl_id) { /* Attack spell changed / was refreshed */ // spell_free_invocation(invocation); // [Fate] This would be a double free. diff --git a/src/map/map.cpp b/src/map/map.cpp index 2d0c1de..fd327ba 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -663,7 +663,7 @@ void map_clearflooritem_timer(TimerData *tid, tick_t, int id) struct flooritem_data *fitem = NULL; fitem = (struct flooritem_data *) object[id]; - if (fitem == NULL || fitem->bl.bl_type != BL::ITEM) + if (fitem == NULL || fitem->bl_type != BL::ITEM) { if (battle_config.error_log) PRINTF("map_clearflooritem_timer : error\n"); @@ -672,7 +672,7 @@ void map_clearflooritem_timer(TimerData *tid, tick_t, int id) if (!tid) fitem->cleartimer.cancel(); clif_clearflooritem(fitem, 0); - map_delobject(fitem->bl.bl_id, BL::ITEM); + map_delobject(fitem->bl_id, BL::ITEM); } std::pair<uint16_t, uint16_t> map_randfreecell(int m, uint16_t x, uint16_t y, uint16_t w, uint16_t h) @@ -714,11 +714,11 @@ int map_addflooritem_any(struct item *item_data, int amount, return 0; CREATE(fitem, struct flooritem_data, 1); - fitem->bl.bl_type = BL::ITEM; - fitem->bl.bl_prev = fitem->bl.bl_next = NULL; - fitem->bl.bl_m = m; - fitem->bl.bl_x = xy.first; - fitem->bl.bl_y = xy.second; + fitem->bl_type = BL::ITEM; + fitem->bl_prev = fitem->bl_next = NULL; + fitem->bl_m = m; + fitem->bl_x = xy.first; + fitem->bl_y = xy.second; fitem->first_get_id = 0; fitem->first_get_tick = tick_t(); fitem->second_get_id = 0; @@ -726,8 +726,8 @@ int map_addflooritem_any(struct item *item_data, int amount, fitem->third_get_id = 0; fitem->third_get_tick = tick_t(); - fitem->bl.bl_id = map_addobject(&fitem->bl); - if (fitem->bl.bl_id == 0) + fitem->bl_id = map_addobject(fitem); + if (fitem->bl_id == 0) { free(fitem); return 0; @@ -736,15 +736,15 @@ int map_addflooritem_any(struct item *item_data, int amount, tick_t tick = gettick(); if (owners[0]) - fitem->first_get_id = owners[0]->bl.bl_id; + fitem->first_get_id = owners[0]->bl_id; fitem->first_get_tick = tick + owner_protection[0]; if (owners[1]) - fitem->second_get_id = owners[1]->bl.bl_id; + fitem->second_get_id = owners[1]->bl_id; fitem->second_get_tick = tick + owner_protection[1]; if (owners[2]) - fitem->third_get_id = owners[2]->bl.bl_id; + fitem->third_get_id = owners[2]->bl_id; fitem->third_get_tick = tick + owner_protection[2]; memcpy(&fitem->item_data, item_data, sizeof(*item_data)); @@ -758,12 +758,12 @@ int map_addflooritem_any(struct item *item_data, int amount, fitem->suby = random_::in(1, 4) * 3; fitem->cleartimer = Timer(gettick() + lifetime, std::bind(map_clearflooritem_timer, ph::_1, ph::_2, - fitem->bl.bl_id)); + fitem->bl_id)); - map_addblock(&fitem->bl); + map_addblock(fitem); clif_dropflooritem(fitem); - return fitem->bl.bl_id; + return fitem->bl_id; } int map_addflooritem(struct item *item_data, int amount, @@ -853,10 +853,10 @@ void map_quit(struct map_session_data *sd) pc_cleareventtimer(sd); // イベントタイマを破棄する - skill_castcancel(&sd->bl, 0); // 詠唱を中断する - skill_stop_dancing(&sd->bl, 1); // ダンス/演奏中断 + skill_castcancel(sd, 0); // 詠唱を中断する + skill_stop_dancing(sd, 1); // ダンス/演奏中断 - skill_status_change_clear(&sd->bl, 1); // ステータス異常を解除する + skill_status_change_clear(sd, 1); // ステータス異常を解除する pc_stop_walking(sd, 0); pc_stopattack(sd); pc_delinvincibletimer(sd); @@ -864,7 +864,7 @@ void map_quit(struct map_session_data *sd) pc_calcstatus(sd, 4); - clif_clearchar(&sd->bl, BeingRemoveWhy::QUIT); + clif_clearchar(sd, BeingRemoveWhy::QUIT); if (pc_isdead(sd)) pc_setrestartvalue(sd, 2); @@ -880,9 +880,9 @@ void map_quit(struct map_session_data *sd) if (sd->npc_stackbuf && sd->npc_stackbuf != NULL) free(sd->npc_stackbuf); - map_delblock(&sd->bl); + map_delblock(sd); - id_db.put(sd->bl.bl_id, nullptr); + id_db.put(sd->bl_id, nullptr); nick_db.put(sd->status.name, nullptr); charid_db.erase(sd->status.char_id); } @@ -916,7 +916,7 @@ struct map_session_data *map_id2sd(int id) if (session[i]->session_data) { map_session_data *sd = static_cast<map_session_data *>(session[i]->session_data.get()); - if (sd->bl.bl_id == id) + if (sd->bl_id == id) return sd; } } @@ -1090,7 +1090,7 @@ int map_addnpc(int m, struct npc_data *nd) map[m].npc[i] = nd; nd->n = i; - id_db.put(nd->bl.bl_id, (struct block_list *)nd); + id_db.put(nd->bl_id, (struct block_list *)nd); return i; } @@ -1106,9 +1106,9 @@ void map_removenpc(void) { if (map[m].npc[i] != NULL) { - clif_clearchar(&map[m].npc[i]->bl, BeingRemoveWhy::QUIT); - map_delblock(&map[m].npc[i]->bl); - id_db.put(map[m].npc[i]->bl.bl_id, nullptr); + clif_clearchar(map[m].npc[i], BeingRemoveWhy::QUIT); + map_delblock(map[m].npc[i]); + id_db.put(map[m].npc[i]->bl_id, nullptr); if (map[m].npc[i]->npc_subtype == NpcSubtype::SCRIPT) { // free(map[m].npc[i]->u.scr.script); diff --git a/src/map/map.hpp b/src/map/map.hpp index ff8da3a..c3b4593 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -41,6 +41,9 @@ struct block_list int bl_id; short bl_m, bl_x, bl_y; BL bl_type; + +#warning "This is important!" + // virtual ~block_list() {} }; struct walkpath_data @@ -78,9 +81,8 @@ struct quick_regeneration unsigned char tickdelay; // number of ticks to next update }; -struct map_session_data : SessionData +struct map_session_data : block_list, SessionData { - struct block_list bl; struct { unsigned auth:1; @@ -277,9 +279,8 @@ struct npc_item_list { int nameid, value; }; -struct npc_data +struct npc_data : block_list { - struct block_list bl; NpcSubtype npc_subtype; short n; short npc_class; @@ -327,9 +328,8 @@ struct npc_data constexpr int MOB_XP_BONUS_BASE = 1024; constexpr int MOB_XP_BONUS_SHIFT = 10; -struct mob_data +struct mob_data : block_list { - struct block_list bl; short n; short mob_class; DIR dir; @@ -466,9 +466,8 @@ MapCell read_gat(int m, int x, int y) return read_gatp(&map[m], x, y); } -struct flooritem_data +struct flooritem_data : block_list { - struct block_list bl; short subx, suby; Timer cleartimer; int first_get_id, second_get_id, third_get_id; @@ -535,7 +534,7 @@ void map_log(const_string line); #define MAP_LOG_PC(sd, fmt, ...) \ MAP_LOG("PC%d %d:%d,%d " fmt, \ - sd->status.char_id, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, ## __VA_ARGS__) + sd->status.char_id, sd->bl_m, sd->bl_x, sd->bl_y, ## __VA_ARGS__) // 床アイテム関連 void map_clearflooritem_timer(TimerData *, tick_t, int); diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 5f1b29e..be9a090 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -100,11 +100,11 @@ int mob_spawn_dataset(struct mob_data *md, const char *mobname, int mob_class) else memcpy(md->name, mobname, 24); - md->bl.bl_prev = NULL; - md->bl.bl_next = NULL; + md->bl_prev = NULL; + md->bl_next = NULL; md->n = 0; md->mob_class = mob_class; - md->bl.bl_id = npc_get_new_npc_id(); + md->bl_id = npc_get_new_npc_id(); memset(&md->state, 0, sizeof(md->state)); // md->timer = nullptr; @@ -374,7 +374,7 @@ int mob_once_spawn(struct map_session_data *sd, const char *mapname, int m, count, r = mob_class; if (sd && strcmp(mapname, "this") == 0) - m = sd->bl.bl_m; + m = sd->bl_m; else m = map_mapname2mapid(mapname); @@ -384,9 +384,9 @@ int mob_once_spawn(struct map_session_data *sd, const char *mapname, if (sd) { if (x <= 0) - x = sd->bl.bl_x; + x = sd->bl_x; if (y <= 0) - y = sd->bl.bl_y; + y = sd->bl_y; } else if (x <= 0 || y <= 0) { @@ -403,9 +403,9 @@ int mob_once_spawn(struct map_session_data *sd, const char *mapname, md->lootitem = NULL; mob_spawn_dataset(md, mobname, mob_class); - md->bl.bl_m = m; - md->bl.bl_x = x; - md->bl.bl_y = y; + md->bl_m = m; + md->bl_x = x; + md->bl_y = y; if (r < 0 && battle_config.dead_branch_active == 1) //移動してアクティブで反撃する md->mode = MobMode::war; @@ -419,11 +419,11 @@ int mob_once_spawn(struct map_session_data *sd, const char *mapname, memcpy(md->npc_event, event, sizeof(md->npc_event)); - md->bl.bl_type = BL::MOB; - map_addiddb(&md->bl); - mob_spawn(md->bl.bl_id); + md->bl_type = BL::MOB; + map_addiddb(md); + mob_spawn(md->bl_id); } - return (amount > 0) ? md->bl.bl_id : 0; + return (amount > 0) ? md->bl_id : 0; } /*========================================== @@ -439,7 +439,7 @@ int mob_once_spawn_area(struct map_session_data *sd, const char *mapname, int m; if (strcmp(mapname, "this") == 0) - m = sd->bl.bl_m; + m = sd->bl_m; else m = map_mapname2mapid(mapname); @@ -556,8 +556,8 @@ interval_t calc_next_walk_step(struct mob_data *md) if (md->walkpath.path_pos >= md->walkpath.path_len) return static_cast<interval_t>(-1); if (dir_is_diagonal(md->walkpath.path[md->walkpath.path_pos])) - return battle_get_speed(&md->bl) * 14 / 10; - return battle_get_speed(&md->bl); + return battle_get_speed(md) * 14 / 10; + return battle_get_speed(md); } static @@ -595,9 +595,9 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) if (md->walkpath.path[md->walkpath.path_pos] >= DIR::COUNT) return 1; - x = md->bl.bl_x; - y = md->bl.bl_y; - if (bool(map_getcell(md->bl.bl_m, x, y) & MapCell::UNWALKABLE)) + x = md->bl_x; + y = md->bl_y; + if (bool(map_getcell(md->bl_m, x, y) & MapCell::UNWALKABLE)) { mob_stop_walking(md, 1); return 0; @@ -606,7 +606,7 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) dx = dirx[md->dir]; dy = diry[md->dir]; - if (bool(map_getcell(md->bl.bl_m, x + dx, y + dy) + if (bool(map_getcell(md->bl_m, x + dx, y + dy) & MapCell::UNWALKABLE)) { mob_walktoxy_sub(md); @@ -618,7 +618,7 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) md->state.state = MS::WALK; map_foreachinmovearea(std::bind(clif_moboutsight, ph::_1, md), - md->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + md->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, dx, dy, BL::PC); @@ -628,14 +628,14 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) md->min_chase--; if (moveblock) - map_delblock(&md->bl); - md->bl.bl_x = x; - md->bl.bl_y = y; + map_delblock(md); + md->bl_x = x; + md->bl_y = y; if (moveblock) - map_addblock(&md->bl); + map_addblock(md); map_foreachinmovearea(std::bind(clif_mobinsight, ph::_1, md), - md->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + md->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, -dx, -dy, BL::PC); md->state.state = MS::IDLE; @@ -648,7 +648,7 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) i = std::max(i, std::chrono::milliseconds(1)); md->timer = Timer(tick + i, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, md->walkpath.path_pos)); + md->bl_id, md->walkpath.path_pos)); md->state.state = MS::WALK; if (md->walkpath.path_pos >= md->walkpath.path_len) @@ -700,8 +700,8 @@ int mob_check_attack(struct mob_data *md) if (tsd) { if (pc_isdead(tsd) || tsd->invincible_timer - || pc_isinvisible(tsd) || md->bl.bl_m != tbl->bl_m || tbl->bl_prev == NULL - || distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, tbl->bl_y) >= 13) + || pc_isinvisible(tsd) || md->bl_m != tbl->bl_m || tbl->bl_prev == NULL + || distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y) >= 13) { md->target_id = 0; md->state.attackable = false; @@ -710,8 +710,8 @@ int mob_check_attack(struct mob_data *md) } if (tmd) { - if (md->bl.bl_m != tbl->bl_m || tbl->bl_prev == NULL - || distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, tbl->bl_y) >= 13) + if (md->bl_m != tbl->bl_m || tbl->bl_prev == NULL + || distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y) >= 13) { md->target_id = 0; md->state.attackable = false; @@ -745,7 +745,7 @@ int mob_check_attack(struct mob_data *md) range = mob_db[md->mob_class].range; if (bool(mode & MobMode::CAN_MOVE)) range++; - if (distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, tbl->bl_y) > range) + if (distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y) > range) return 0; return 1; @@ -777,7 +777,7 @@ int mob_attack(struct mob_data *md, tick_t tick) return 0; if (battle_config.monster_attack_direction_change) - md->dir = map_calc_dir(&md->bl, tbl->bl_x, tbl->bl_y); // 向き設定 + md->dir = map_calc_dir(md, tbl->bl_x, tbl->bl_y); // 向き設定 //clif_fixmobpos(md); @@ -785,20 +785,20 @@ int mob_attack(struct mob_data *md, tick_t tick) if (mobskill_use(md, tick, MobSkillCondition::NEVER_EQUAL)) return 0; - md->target_lv = battle_weapon_attack(&md->bl, tbl, tick); + md->target_lv = battle_weapon_attack(md, tbl, tick); // If you are reading this, please note: // it is highly platform-specific that this even works at all. int radius = battle_config.mob_splash_radius; if (radius >= 0 && tbl->bl_type == BL::PC && !map[tbl->bl_m].flag.town) - map_foreachinarea(std::bind(mob_ancillary_attack, ph::_1, &md->bl, tbl, tick), + map_foreachinarea(std::bind(mob_ancillary_attack, ph::_1, md, tbl, tick), tbl->bl_m, tbl->bl_x - radius, tbl->bl_y - radius, tbl->bl_x + radius, tbl->bl_y + radius, BL::PC); - md->attackabletime = tick + battle_get_adelay(&md->bl); + md->attackabletime = tick + battle_get_adelay(md); md->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, 0)); + md->bl_id, 0)); md->state.state = MS::ATTACK; return 0; @@ -840,7 +840,7 @@ int mob_changestate(struct mob_data *md, MS state, bool type) i = i / 4; md->timer = Timer(gettick() + i, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, 0)); + md->bl_id, 0)); } else md->state.state = MS::IDLE; @@ -853,31 +853,31 @@ int mob_changestate(struct mob_data *md, MS state, bool type) if (i > interval_t::zero() && i < std::chrono::seconds(2)) md->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, 0)); + md->bl_id, 0)); else if (type) { - md->attackabletime = tick + battle_get_amotion(&md->bl); + md->attackabletime = tick + battle_get_amotion(md); md->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, 0)); + md->bl_id, 0)); } else { md->attackabletime = tick + std::chrono::milliseconds(1); md->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.bl_id, 0)); + md->bl_id, 0)); } } break; case MS::DEAD: { - skill_castcancel(&md->bl, 0); + skill_castcancel(md, 0); md->state.skillstate = MobSkillState::MSS_DEAD; md->last_deadtime = gettick(); // Since it died, all aggressors' attack to this mob is stopped. - clif_foreachclient(std::bind(mob_stopattacked, ph::_1, md->bl.bl_id)); - skill_status_change_clear(&md->bl, 2); // The abnormalities in status are canceled. + clif_foreachclient(std::bind(mob_stopattacked, ph::_1, md->bl_id)); + skill_status_change_clear(md, 2); // The abnormalities in status are canceled. md->deletetimer.cancel(); md->hp = md->target_id = md->attacked_id = 0; md->state.attackable = false; @@ -909,7 +909,7 @@ void mob_timer(TimerData *, tick_t tick, int id, unsigned char data) md = (struct mob_data *) bl; - if (md->bl.bl_prev == NULL || md->state.state == MS::DEAD) + if (md->bl_prev == NULL || md->state.state == MS::DEAD) return; MapBlockLock lock; @@ -941,7 +941,7 @@ int mob_walktoxy_sub(struct mob_data *md) nullpo_ret(md); - if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, md->to_x, md->to_y, + if (path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, md->to_x, md->to_y, md->state.walk_easy)) return 1; memcpy(&md->walkpath, &wpd, sizeof(wpd)); @@ -965,7 +965,7 @@ int mob_walktoxy(struct mob_data *md, int x, int y, int easy) nullpo_ret(md); if (md->state.state == MS::WALK - && path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, x, y, easy)) + && path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, x, y, easy)) return 1; md->state.walk_easy = easy; @@ -1012,7 +1012,7 @@ int mob_setdelayspawn(int id) md = (struct mob_data *) bl; nullpo_retr(-1, md); - if (!md || md->bl.bl_type != BL::MOB) + if (!md || md->bl_type != BL::MOB) return -1; // Processing of MOB which is not revitalized @@ -1020,13 +1020,13 @@ int mob_setdelayspawn(int id) && md->spawndelay2 == static_cast<interval_t>(-1) && md->n == 0) { - map_deliddb(&md->bl); + map_deliddb(md); if (md->lootitem) { free(md->lootitem); md->lootitem = NULL; } - MapBlockLock::freeblock(&md->bl); + MapBlockLock::freeblock(md); return 0; } @@ -1062,24 +1062,24 @@ int mob_spawn(int id) md = (struct mob_data *) bl; nullpo_retr(-1, md); - if (!md || md->bl.bl_type == BL::NUL || md->bl.bl_type != BL::MOB) + if (!md || md->bl_type == BL::NUL || md->bl_type != BL::MOB) return -1; md->last_spawntime = tick; - if (md->bl.bl_prev != NULL) + if (md->bl_prev != NULL) { - map_delblock(&md->bl); + map_delblock(md); } - md->bl.bl_m = md->m; + md->bl_m = md->m; { int i = 0; do { if (md->x0 == 0 && md->y0 == 0) { - x = random_::in(1, map[md->bl.bl_m].xs - 2); - y = random_::in(1, map[md->bl.bl_m].ys - 2); + x = random_::in(1, map[md->bl_m].xs - 2); + y = random_::in(1, map[md->bl_m].ys - 2); } else { @@ -1090,13 +1090,13 @@ int mob_spawn(int id) } i++; } - while (bool(map_getcell(md->bl.bl_m, x, y) & MapCell::UNWALKABLE) + while (bool(map_getcell(md->bl_m, x, y) & MapCell::UNWALKABLE) && i < 50); if (i >= 50) { // if(battle_config.error_log==1) - // PRINTF("MOB spawn error %d @ %s\n",id,map[md->bl.bl_m].name); + // PRINTF("MOB spawn error %d @ %s\n",id,map[md->bl_m].name); Timer(tick + std::chrono::seconds(5), std::bind(mob_delayspawn, ph::_1, ph::_2, id) @@ -1105,11 +1105,11 @@ int mob_spawn(int id) } } - md->to_x = md->bl.bl_x = x; - md->to_y = md->bl.bl_y = y; + md->to_x = md->bl_x = x; + md->to_y = md->bl_y = y; md->dir = DIR::S; - map_addblock(&md->bl); + map_addblock(md); memset(&md->state, 0, sizeof(md->state)); md->attacked_id = 0; @@ -1156,11 +1156,11 @@ int mob_spawn(int id) md->opt3 = Opt3::ZERO; md->option = Option::ZERO; - md->hp = battle_get_max_hp(&md->bl); + md->hp = battle_get_max_hp(md); if (md->hp <= 0) { mob_makedummymobdb(md->mob_class); - md->hp = battle_get_max_hp(&md->bl); + md->hp = battle_get_max_hp(md); } clif_spawnmob(md); @@ -1209,19 +1209,19 @@ int mob_stop_walking(struct mob_data *md, int type) md->walkpath.path_len = 0; if (type & 4) { - dx = md->to_x - md->bl.bl_x; + dx = md->to_x - md->bl_x; if (dx < 0) dx = -1; else if (dx > 0) dx = 1; - dy = md->to_y - md->bl.bl_y; + dy = md->to_y - md->bl_y; if (dy < 0) dy = -1; else if (dy > 0) dy = 1; } - md->to_x = md->bl.bl_x + dx; - md->to_y = md->bl.bl_y + dy; + md->to_x = md->bl_x + dx; + md->to_y = md->bl_y + dy; if (dx != 0 || dy != 0) { mob_walktoxy_sub(md); @@ -1233,7 +1233,7 @@ int mob_stop_walking(struct mob_data *md, int type) clif_fixmobpos(md); if (type & 0x02) { - interval_t delay = battle_get_dmotion(&md->bl); + interval_t delay = battle_get_dmotion(md); tick_t tick = gettick(); if (md->canmove_tick < tick) md->canmove_tick = tick + delay; @@ -1256,8 +1256,8 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range) nullpo_ret(md); nullpo_ret(bl); - dx = abs(bl->bl_x - md->bl.bl_x); - dy = abs(bl->bl_y - md->bl.bl_y); + dx = abs(bl->bl_x - md->bl_x); + dy = abs(bl->bl_y - md->bl_y); if (bl && bl->bl_type == BL::PC && battle_config.monsters_ignore_gm == 1) { // option to have monsters ignore GMs [Valaris] @@ -1266,20 +1266,20 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range) return 0; } - if (md->bl.bl_m != bl->bl_m) // 違うャbプ + if (md->bl_m != bl->bl_m) // 違うャbプ return 0; if (range > 0 && range < ((dx > dy) ? dx : dy)) // 遠すぎる return 0; - if (md->bl.bl_x == bl->bl_x && md->bl.bl_y == bl->bl_y) // 同じャX + if (md->bl_x == bl->bl_x && md->bl_y == bl->bl_y) // 同じャX return 1; // Obstacle judging wpd.path_len = 0; wpd.path_pos = 0; wpd.path_half = 0; - if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, bl->bl_x, bl->bl_y, 0) != + if (path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, bl->bl_x, bl->bl_y, 0) != -1) return 1; @@ -1289,11 +1289,11 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range) // It judges whether it can adjoin or not. dx = (dx > 0) ? 1 : ((dx < 0) ? -1 : 0); dy = (dy > 0) ? 1 : ((dy < 0) ? -1 : 0); - if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, bl->bl_x - dx, bl->bl_y - dy, 0) != -1) + if (path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, bl->bl_x - dx, bl->bl_y - dy, 0) != -1) return 1; for (i = 0; i < 9; i++) { - if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, bl->bl_x - 1 + i / 3, + if (path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, bl->bl_x - 1 + i / 3, bl->bl_y - 1 + i % 3, 0) != -1) return 1; } @@ -1390,7 +1390,7 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, return; //敵味方判定 - if (battle_check_target(&smd->bl, bl, BCT_ENEMY) == 0) + if (battle_check_target(smd, bl, BCT_ENEMY) == 0) return; if (smd->mode == MobMode::ZERO) @@ -1405,11 +1405,11 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, //対象がPCの場合 if (tsd && !pc_isdead(tsd) && - tsd->bl.bl_m == smd->bl.bl_m && + tsd->bl_m == smd->bl_m && !tsd->invincible_timer && !pc_isinvisible(tsd) && (dist = - distance(smd->bl.bl_x, smd->bl.bl_y, tsd->bl.bl_x, tsd->bl.bl_y)) < 9) + distance(smd->bl_x, smd->bl_y, tsd->bl_x, tsd->bl_y)) < 9) { if (bool(mode & MobMode::BOSS) || (!tsd->state.gangsterparadise @@ -1422,7 +1422,7 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, && random_::chance({1, ++*pcc})) { // 範囲内PCで等確率にする - smd->target_id = tsd->bl.bl_id; + smd->target_id = tsd->bl_id; smd->state.attackable = true; smd->min_chase = 13; } @@ -1430,9 +1430,9 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, } //対象がMobの場合 else if (tmd && - tmd->bl.bl_m == smd->bl.bl_m && + tmd->bl_m == smd->bl_m && (dist = - distance(smd->bl.bl_x, smd->bl.bl_y, tmd->bl.bl_x, tmd->bl.bl_y)) < 9) + distance(smd->bl_x, smd->bl_y, tmd->bl_x, tmd->bl_y)) < 9) { // 到達可能性判定 if (mob_can_reach(smd, bl, 12) @@ -1474,8 +1474,8 @@ void mob_ai_sub_hard_lootsearch(struct block_list *bl, struct mob_data *md, int || (battle_config.monster_loot_type == 1 && md->lootitem_count >= LOOTITEM_SIZE)) return; - if (bl->bl_m == md->bl.bl_m - && (dist = distance(md->bl.bl_x, md->bl.bl_y, bl->bl_x, bl->bl_y)) < 9) + if (bl->bl_m == md->bl_m + && (dist = distance(md->bl_x, md->bl_y, bl->bl_x, bl->bl_y)) < 9) { // Reachability judging if (mob_can_reach(md, bl, 12) @@ -1508,7 +1508,7 @@ void mob_ai_sub_hard_linksearch(struct block_list *bl, struct mob_data *md, stru && bool(mob_db[md->mob_class].mode & MobMode::ASSIST)) { if (tmd->mob_class == md->mob_class - && tmd->bl.bl_m == md->bl.bl_m + && tmd->bl_m == md->bl_m && (!tmd->target_id || !md->state.attackable)) { if (mob_can_reach(tmd, target, 12)) @@ -1542,25 +1542,25 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, tick_t tick) mode = mob_db[md->mob_class].mode; // It is not main monster/leader. - if (!mmd || mmd->bl.bl_type != BL::MOB || mmd->bl.bl_id != md->master_id) + if (!mmd || mmd->bl_type != BL::MOB || mmd->bl_id != md->master_id) return 0; // Since it is in the map on which the master is not, teleport is carried out and it pursues. - if (mmd->bl.bl_m != md->bl.bl_m) + if (mmd->bl_m != md->bl_m) { - mob_warp(md, mmd->bl.bl_m, mmd->bl.bl_x, mmd->bl.bl_y, BeingRemoveWhy::WARPED); + mob_warp(md, mmd->bl_m, mmd->bl_x, mmd->bl_y, BeingRemoveWhy::WARPED); md->state.master_check = 1; return 0; } // Distance with between slave and master is measured. old_dist = md->master_dist; - md->master_dist = distance(md->bl.bl_x, md->bl.bl_y, mmd->bl.bl_x, mmd->bl.bl_y); + md->master_dist = distance(md->bl_x, md->bl_y, mmd->bl_x, mmd->bl_y); // Since the master was in near immediately before, teleport is carried out and it pursues. if (old_dist < 10 && md->master_dist > 18) { - mob_warp(md, -1, mmd->bl.bl_x, mmd->bl.bl_y, BeingRemoveWhy::WARPED); + mob_warp(md, -1, mmd->bl_x, mmd->bl_y, BeingRemoveWhy::WARPED); md->state.master_check = 1; return 0; } @@ -1578,8 +1578,8 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, tick_t tick) { if (i <= 5) { - dx = mmd->bl.bl_x - md->bl.bl_x; - dy = mmd->bl.bl_y - md->bl.bl_y; + dx = mmd->bl_x - md->bl_x; + dy = mmd->bl_y - md->bl_y; if (dx < 0) dx += random_::in(1, std::min(3, -dx)); else if (dx > 0) @@ -1591,11 +1591,11 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, tick_t tick) } else { - dx = mmd->bl.bl_x - md->bl.bl_x + random_::in(-3, 3); - dy = mmd->bl.bl_y - md->bl.bl_y + random_::in(-3, 3); + dx = mmd->bl_x - md->bl_x + random_::in(-3, 3); + dy = mmd->bl_y - md->bl_y + random_::in(-3, 3); } - ret = mob_walktoxy(md, md->bl.bl_x + dx, md->bl.bl_y + dy, 0); + ret = mob_walktoxy(md, md->bl_x + dx, md->bl_y + dy, 0); i++; } while (ret && i < 10); @@ -1613,10 +1613,10 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, tick_t tick) dx = random_::coin() ? 1 : -1; dy = random_::coin() ? 1 : -1; } - dx += mmd->bl.bl_x; - dy += mmd->bl.bl_y; + dx += mmd->bl_x; + dy += mmd->bl_y; - ret = mob_walktoxy(md, mmd->bl.bl_x + dx, mmd->bl.bl_y + dy, 0); + ret = mob_walktoxy(md, mmd->bl_x + dx, mmd->bl_y + dy, 0); i++; } while (ret && i < 10); @@ -1642,10 +1642,10 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, tick_t tick) || race == Race::_demon)) { // 妨害がないか判定 - md->target_id = sd->bl.bl_id; + md->target_id = sd->bl_id; md->state.attackable = true; md->min_chase = - 5 + distance(md->bl.bl_x, md->bl.bl_y, sd->bl.bl_x, sd->bl.bl_y); + 5 + distance(md->bl_x, md->bl_y, sd->bl_x, sd->bl_y); md->state.master_check = 1; } } @@ -1681,7 +1681,7 @@ int mob_randomwalk(struct mob_data *md, tick_t tick) nullpo_ret(md); - interval_t speed = battle_get_speed(&md->bl); + interval_t speed = battle_get_speed(md); if (md->next_walktime < tick) { int i, x, y, d = 12 - md->move_fail_count; @@ -1690,9 +1690,9 @@ int mob_randomwalk(struct mob_data *md, tick_t tick) for (i = 0; i < retrycount; i++) { // Search of a movable place - x = md->bl.bl_x + random_::in(-d, d); - y = md->bl.bl_y + random_::in(-d, d); - if (!bool(map_getcell(md->bl.bl_m, x, y) & MapCell::UNWALKABLE) + x = md->bl_x + random_::in(-d, d); + y = md->bl_y + random_::in(-d, d); + if (!bool(map_getcell(md->bl_m, x, y) & MapCell::UNWALKABLE) && mob_walktoxy(md, x, y, 1) == 0) { md->move_fail_count = 0; @@ -1705,9 +1705,9 @@ int mob_randomwalk(struct mob_data *md, tick_t tick) { if (battle_config.error_log == 1) PRINTF("MOB cant move. random spawn %d, mob_class = %d\n", - md->bl.bl_id, md->mob_class); + md->bl_id, md->mob_class); md->move_fail_count = 0; - mob_spawn(md->bl.bl_id); + mob_spawn(md->bl_id); } } } @@ -1749,7 +1749,7 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) return; md->last_thinktime = tick; - if (md->skilltimer || md->bl.bl_prev == NULL) + if (md->skilltimer || md->bl_prev == NULL) { // Under a skill aria and death if (tick > md->next_walktime + MIN_MOBTHINKTIME) @@ -1778,9 +1778,9 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) { if (!asd->invincible_timer && !pc_isinvisible(asd)) { - map_foreachinarea(std::bind(mob_ai_sub_hard_linksearch, ph::_1, md, &asd->bl), - md->bl.bl_m, md->bl.bl_x - 13, md->bl.bl_y - 13, - md->bl.bl_x + 13, md->bl.bl_y + 13, BL::MOB); + map_foreachinarea(std::bind(mob_ai_sub_hard_linksearch, ph::_1, md, asd), + md->bl_m, md->bl_x - 13, md->bl_y - 13, + md->bl_x + 13, md->bl_y + 13, BL::MOB); } } } @@ -1796,10 +1796,10 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) { if (abl->bl_type == BL::PC) asd = (struct map_session_data *) abl; - if (asd == NULL || md->bl.bl_m != abl->bl_m || abl->bl_prev == NULL + if (asd == NULL || md->bl_m != abl->bl_m || abl->bl_prev == NULL || asd->invincible_timer || pc_isinvisible(asd) || (dist = - distance(md->bl.bl_x, md->bl.bl_y, abl->bl_x, abl->bl_y)) >= 32 + distance(md->bl_x, md->bl_y, abl->bl_x, abl->bl_y)) >= 32 || battle_check_target(bl, abl, BCT_ENEMY) == 0) md->attacked_id = 0; else @@ -1829,15 +1829,15 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) if (md->state.special_mob_ai) { map_foreachinarea(std::bind(mob_ai_sub_hard_activesearch, ph::_1, md, &i), - md->bl.bl_m, md->bl.bl_x - AREA_SIZE * 2, md->bl.bl_y - AREA_SIZE * 2, - md->bl.bl_x + AREA_SIZE * 2, md->bl.bl_y + AREA_SIZE * 2, + md->bl_m, md->bl_x - AREA_SIZE * 2, md->bl_y - AREA_SIZE * 2, + md->bl_x + AREA_SIZE * 2, md->bl_y + AREA_SIZE * 2, BL::NUL); } else { map_foreachinarea(std::bind(mob_ai_sub_hard_activesearch, ph::_1, md, &i), - md->bl.bl_m, md->bl.bl_x - AREA_SIZE * 2, md->bl.bl_y - AREA_SIZE * 2, - md->bl.bl_x + AREA_SIZE * 2, md->bl.bl_y + AREA_SIZE * 2, BL::PC); + md->bl_m, md->bl_x - AREA_SIZE * 2, md->bl_y - AREA_SIZE * 2, + md->bl_x + AREA_SIZE * 2, md->bl_y + AREA_SIZE * 2, BL::PC); } } @@ -1848,8 +1848,8 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) { i = 0; map_foreachinarea(std::bind(mob_ai_sub_hard_lootsearch, ph::_1, md, &i), - md->bl.bl_m, md->bl.bl_x - AREA_SIZE * 2, md->bl.bl_y - AREA_SIZE * 2, - md->bl.bl_x + AREA_SIZE * 2, md->bl.bl_y + AREA_SIZE * 2, BL::ITEM); + md->bl_m, md->bl_x - AREA_SIZE * 2, md->bl_y - AREA_SIZE * 2, + md->bl_x + AREA_SIZE * 2, md->bl_y + AREA_SIZE * 2, BL::ITEM); } // It will attack, if the candidate for an attack is. @@ -1863,9 +1863,9 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) tmd = (struct mob_data *) tbl; if (tsd || tmd) { - if (tbl->bl_m != md->bl.bl_m || tbl->bl_prev == NULL + if (tbl->bl_m != md->bl_m || tbl->bl_prev == NULL || (dist = - distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, + distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y)) >= md->min_chase) mob_unlocktarget(md, tick); // 別マップか、視界外 else if (tsd && !bool(mode & MobMode::BOSS) @@ -1873,7 +1873,7 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) && race != Race::_insect && race != Race::_demon)) mob_unlocktarget(md, tick); // スキルなどによる策敵妨害 - else if (!battle_check_range(&md->bl, tbl, mob_db[md->mob_class].range)) + else if (!battle_check_range(md, tbl, mob_db[md->mob_class].range)) { // 攻撃範囲外なので移動 if (!bool(mode & MobMode::CAN_MOVE)) @@ -1901,8 +1901,8 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) if (i == 0) { // 最初はAEGISと同じ方法で検索 - dx = tbl->bl_x - md->bl.bl_x; - dy = tbl->bl_y - md->bl.bl_y; + dx = tbl->bl_x - md->bl_x; + dy = tbl->bl_y - md->bl_y; if (dx < 0) dx++; else if (dx > 0) @@ -1916,10 +1916,10 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) { // だめならAthena式(ランダム) // {0 1 2} - dx = tbl->bl_x - md->bl.bl_x + random_::in(-1, 1); - dy = tbl->bl_y - md->bl.bl_y + random_::in(-1, 1); + dx = tbl->bl_x - md->bl_x + random_::in(-1, 1); + dy = tbl->bl_y - md->bl_y + random_::in(-1, 1); } - ret = mob_walktoxy(md, md->bl.bl_x + dx, md->bl.bl_y + dy, 0); + ret = mob_walktoxy(md, md->bl_x + dx, md->bl_y + dy, 0); i++; } while (ret && i < 5); @@ -1934,7 +1934,7 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) dy = 2; else if (dy > 0) dy = -2; - mob_walktoxy(md, md->bl.bl_x + dx, md->bl.bl_y + dy, + mob_walktoxy(md, md->bl_x + dx, md->bl_y + dy, 0); } } @@ -1952,9 +1952,9 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) } else { // ルートモンスター処理 - if (tbl == NULL || tbl->bl_type != BL::ITEM || tbl->bl_m != md->bl.bl_m + if (tbl == NULL || tbl->bl_type != BL::ITEM || tbl->bl_m != md->bl_m || (dist = - distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, + distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y)) >= md->min_chase || !md->lootitem) { // 遠すぎるかアイテムがなくなった @@ -1978,9 +1978,9 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) || distance(md->to_x, md->to_y, tbl->bl_x, tbl->bl_y) <= 0)) return; // 既に移動中 md->next_walktime = tick + std::chrono::milliseconds(500); - dx = tbl->bl_x - md->bl.bl_x; - dy = tbl->bl_y - md->bl.bl_y; - ret = mob_walktoxy(md, md->bl.bl_x + dx, md->bl.bl_y + dy, 0); + dx = tbl->bl_x - md->bl_x; + dy = tbl->bl_y - md->bl_y; + ret = mob_walktoxy(md, md->bl_x + dx, md->bl_y + dy, 0); if (ret) mob_unlocktarget(md, tick); // 移動できないのでタゲ解除(IWとか?) } @@ -2064,8 +2064,8 @@ void mob_ai_sub_foreachclient(struct map_session_data *sd, tick_t tick) nullpo_retv(sd); map_foreachinarea(std::bind(mob_ai_sub_hard, ph::_1, tick), - sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE * 2, sd->bl.bl_y - AREA_SIZE * 2, - sd->bl.bl_x + AREA_SIZE * 2, sd->bl.bl_y + AREA_SIZE * 2, BL::MOB); + sd->bl_m, sd->bl_x - AREA_SIZE * 2, sd->bl_y - AREA_SIZE * 2, + sd->bl_x + AREA_SIZE * 2, sd->bl_y + AREA_SIZE * 2, BL::MOB); } /*========================================== @@ -2096,7 +2096,7 @@ void mob_ai_sub_lazy(struct block_list *bl, tick_t tick) return; md->last_thinktime = tick; - if (md->bl.bl_prev == NULL || md->skilltimer) + if (md->bl_prev == NULL || md->skilltimer) { if (tick > md->next_walktime + MIN_MOBTHINKTIME * 10) md->next_walktime = tick; @@ -2108,7 +2108,7 @@ void mob_ai_sub_lazy(struct block_list *bl, tick_t tick) && mob_can_move(md)) { - if (map[md->bl.bl_m].users > 0) + if (map[md->bl_m].users > 0) { // Since PC is in the same map, somewhat better negligent processing is carried out. @@ -2121,7 +2121,7 @@ void mob_ai_sub_lazy(struct block_list *bl, tick_t tick) && md->x0 <= 0 && md->master_id != 0 && !bool(mob_db[md->mob_class].mode & MobMode::BOSS)) - mob_spawn(md->bl.bl_id); + mob_spawn(md->bl_id); } else @@ -2254,13 +2254,13 @@ int mob_delete(struct mob_data *md) { nullpo_retr(1, md); - if (md->bl.bl_prev == NULL) + if (md->bl_prev == NULL) return 1; mob_changestate(md, MS::DEAD, 0); - clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); - map_delblock(&md->bl); + clif_clearchar(md, BeingRemoveWhy::DEAD); + map_delblock(md); mob_deleteslave(md); - mob_setdelayspawn(md->bl.bl_id); + mob_setdelayspawn(md->bl_id); return 0; } @@ -2268,12 +2268,12 @@ int mob_catch_delete(struct mob_data *md, BeingRemoveWhy type) { nullpo_retr(1, md); - if (md->bl.bl_prev == NULL) + if (md->bl_prev == NULL) return 1; mob_changestate(md, MS::DEAD, 0); - clif_clearchar(&md->bl, type); - map_delblock(&md->bl); - mob_setdelayspawn(md->bl.bl_id); + clif_clearchar(md, type); + map_delblock(md); + mob_setdelayspawn(md->bl_id); return 0; } @@ -2312,9 +2312,9 @@ int mob_deleteslave(struct mob_data *md) { nullpo_ret(md); - map_foreachinarea(std::bind(mob_deleteslave_sub, ph::_1, md->bl.bl_id), - md->bl.bl_m, 0, 0, - map[md->bl.bl_m].xs, map[md->bl.bl_m].ys, BL::MOB); + map_foreachinarea(std::bind(mob_deleteslave_sub, ph::_1, md->bl_id), + md->bl_m, 0, 0, + map[md->bl_m].xs, map[md->bl_m].ys, BL::MOB); return 0; } @@ -2359,7 +2359,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, md->attacked_id = src->bl_id; } - max_hp = battle_get_max_hp(&md->bl); + max_hp = battle_get_max_hp(md); if (src && src->bl_type == BL::PC) { @@ -2369,7 +2369,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, // if(battle_config.battle_log) // PRINTF("mob_damage %d %d %d\n",md->hp,max_hp,damage); - if (md->bl.bl_prev == NULL) + if (md->bl_prev == NULL) { if (battle_config.error_log == 1) PRINTF("mob_damage : BlockError!!\n"); @@ -2378,22 +2378,22 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, if (md->state.state == MS::DEAD || md->hp <= 0) { - if (md->bl.bl_prev != NULL) + if (md->bl_prev != NULL) { mob_changestate(md, MS::DEAD, 0); // It is skill at the time of death. mobskill_use(md, tick, MobSkillCondition::ANY); - clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); - map_delblock(&md->bl); - mob_setdelayspawn(md->bl.bl_id); + clif_clearchar(md, BeingRemoveWhy::DEAD); + map_delblock(md); + mob_setdelayspawn(md->bl_id); } return 0; } mob_stop_walking(md, 3); if (damage > max_hp >> 2) - skill_stop_dancing(&md->bl, 0); + skill_stop_dancing(md, 0); if (md->hp > max_hp) md->hp = max_hp; @@ -2410,7 +2410,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, for (i = 0, minpos = 0, mindmg = 0x7fffffff; i < DAMAGELOG_SIZE; i++) { - if (md->dmglog[i].id == sd->bl.bl_id) + if (md->dmglog[i].id == sd->bl_id) break; if (md->dmglog[i].id == 0) { @@ -2427,12 +2427,12 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, md->dmglog[i].dmg += damage; else { - md->dmglog[minpos].id = sd->bl.bl_id; + md->dmglog[minpos].id = sd->bl_id; md->dmglog[minpos].dmg = damage; } if (md->attacked_id <= 0 && md->state.special_mob_ai == 0) - md->attacked_id = sd->bl.bl_id; + md->attacked_id = sd->bl_id; } if (src && src->bl_type == BL::MOB && ((struct mob_data *) src)->state.special_mob_ai) @@ -2443,7 +2443,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, { MAP_LOG_PC(((struct map_session_data *) master_bl), "MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d", - md2->bl.bl_id, md2->mob_class, md->bl.bl_id, md->mob_class, + md2->bl_id, md2->mob_class, md->bl_id, md->mob_class, damage); } @@ -2486,7 +2486,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, return 0; } - MAP_LOG("MOB%d DEAD", md->bl.bl_id); + MAP_LOG("MOB%d DEAD", md->bl_id); // ----- ここから死亡処理 ----- @@ -2498,7 +2498,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, memset(tmpsd, 0, sizeof(tmpsd)); memset(pt, 0, sizeof(pt)); - max_hp = battle_get_max_hp(&md->bl); + max_hp = battle_get_max_hp(md); if (src && src->bl_type == BL::MOB) mob_unlocktarget((struct mob_data *) src, tick); @@ -2517,7 +2517,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, if (tmpsd[i] == NULL) continue; count++; - if (tmpsd[i]->bl.bl_m != md->bl.bl_m || pc_isdead(tmpsd[i])) + if (tmpsd[i]->bl_m != md->bl_m || pc_isdead(tmpsd[i])) continue; tdmg += (double) md->dmglog[i].dmg; @@ -2531,7 +2531,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, } // [MouseJstr] - if ((map[md->bl.bl_m].flag.pvp == 0) || (battle_config.pvp_exp == 1)) + if ((map[md->bl_m].flag.pvp == 0) || (battle_config.pvp_exp == 1)) { // 経験値の分配 for (int i = 0; i < DAMAGELOG_SIZE; i++) @@ -2540,7 +2540,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, int pid, base_exp, job_exp, flag = 1; double per; struct party *p; - if (tmpsd[i] == NULL || tmpsd[i]->bl.bl_m != md->bl.bl_m) + if (tmpsd[i] == NULL || tmpsd[i]->bl_m != md->bl_m) continue; /* jAthena's exp formula per = ((double)md->dmglog[i].dmg)* (9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; @@ -2619,7 +2619,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, } // 公平分配 for (int i = 0; i < pnum; i++) - party_exp_share(pt[i].p, md->bl.bl_m, pt[i].base_exp, + party_exp_share(pt[i].p, md->bl_m, pt[i].base_exp, pt[i].job_exp); // item drop @@ -2647,9 +2647,9 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, calloc(1, sizeof(struct delay_item_drop)); ditem->nameid = mob_db[md->mob_class].dropitem[i].nameid; ditem->amount = 1; - ditem->m = md->bl.bl_m; - ditem->x = md->bl.bl_x; - ditem->y = md->bl.bl_y; + ditem->m = md->bl_m; + ditem->x = md->bl_x; + ditem->y = md->bl_y; ditem->first_sd = mvp_sd; ditem->second_sd = second_sd; ditem->third_sd = third_sd; @@ -2668,9 +2668,9 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, calloc(1, sizeof(struct delay_item_drop2)); memcpy(&ditem->item_data, &md->lootitem[i], sizeof(md->lootitem[0])); - ditem->m = md->bl.bl_m; - ditem->x = md->bl.bl_x; - ditem->y = md->bl.bl_y; + ditem->m = md->bl_m; + ditem->x = md->bl_x; + ditem->y = md->bl_y; ditem->first_sd = mvp_sd; ditem->second_sd = second_sd; ditem->third_sd = third_sd; @@ -2700,7 +2700,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, map_session_data *tmp_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (tmp_sd && tmp_sd->state.auth) { - if (md->bl.bl_m == tmp_sd->bl.bl_m) + if (md->bl_m == tmp_sd->bl_m) { sd = tmp_sd; break; @@ -2713,10 +2713,10 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, npc_event(sd, md->npc_event, 0); } - clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); - map_delblock(&md->bl); + clif_clearchar(md, BeingRemoveWhy::DEAD); + map_delblock(md); mob_deleteslave(md); - mob_setdelayspawn(md->bl.bl_id); + mob_setdelayspawn(md->bl_id); return 0; } @@ -2727,7 +2727,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, */ int mob_heal(struct mob_data *md, int heal) { - int max_hp = battle_get_max_hp(&md->bl); + int max_hp = battle_get_max_hp(md); nullpo_ret(md); @@ -2761,8 +2761,8 @@ static int mob_warpslave(struct mob_data *md, int x, int y) { //PRINTF("warp slave\n"); - map_foreachinarea(std::bind(mob_warpslave_sub, ph::_1, md->bl.bl_id, md->bl.bl_x, md->bl.bl_y), - md->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + map_foreachinarea(std::bind(mob_warpslave_sub, ph::_1, md->bl_id, md->bl_x, md->bl_y), + md->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, BL::MOB); return 0; } @@ -2777,19 +2777,19 @@ int mob_warp(struct mob_data *md, int m, int x, int y, BeingRemoveWhy type) nullpo_ret(md); - if (md->bl.bl_prev == NULL) + if (md->bl_prev == NULL) return 0; if (m < 0) - m = md->bl.bl_m; + m = md->bl_m; if (type != BeingRemoveWhy::NEGATIVE1) { - if (map[md->bl.bl_m].flag.monster_noteleport) + if (map[md->bl_m].flag.monster_noteleport) return 0; - clif_clearchar(&md->bl, type); + clif_clearchar(md, type); } - map_delblock(&md->bl); + map_delblock(md); if (bx > 0 && by > 0) { // 位置指定の場合周囲9セルを探索 @@ -2817,14 +2817,14 @@ int mob_warp(struct mob_data *md, int m, int x, int y, BeingRemoveWhy type) md->dir = DIR::S; if (i < 1000) { - md->bl.bl_x = md->to_x = x; - md->bl.bl_y = md->to_y = y; - md->bl.bl_m = m; + md->bl_x = md->to_x = x; + md->bl_y = md->to_y = y; + md->bl_m = m; } else { if (battle_config.error_log == 1) - PRINTF("MOB %d warp failed, mob_class = %d\n", md->bl.bl_id, md->mob_class); + PRINTF("MOB %d warp failed, mob_class = %d\n", md->bl_id, md->mob_class); } md->target_id = 0; // タゲを解除する @@ -2837,15 +2837,15 @@ int mob_warp(struct mob_data *md, int m, int x, int y, BeingRemoveWhy type) && i == 1000) { if (battle_config.battle_log == 1) - PRINTF("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl.bl_id, x, y, + PRINTF("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl_id, x, y, md->mob_class); } - map_addblock(&md->bl); + map_addblock(md); if (type != BeingRemoveWhy::GONE && type != BeingRemoveWhy::NEGATIVE1) { clif_spawnmob(md); - mob_warpslave(md, md->bl.bl_x, md->bl.bl_y); + mob_warpslave(md, md->bl_x, md->bl_y); } return 0; @@ -2878,9 +2878,9 @@ int mob_countslave(struct mob_data *md) nullpo_ret(md); - map_foreachinarea(std::bind(mob_countslave_sub, ph::_1, md->bl.bl_id, &c), - md->bl.bl_m, 0, 0, - map[md->bl.bl_m].xs - 1, map[md->bl.bl_m].ys - 1, BL::MOB); + map_foreachinarea(std::bind(mob_countslave_sub, ph::_1, md->bl_id, &c), + md->bl_m, 0, 0, + map[md->bl_m].xs - 1, map[md->bl_m].ys - 1, BL::MOB); return c; } @@ -2896,9 +2896,9 @@ int mob_summonslave(struct mob_data *md2, int *value, int amount, int flag) nullpo_ret(md2); nullpo_ret(value); - bx = md2->bl.bl_x; - by = md2->bl.bl_y; - m = md2->bl.bl_m; + bx = md2->bl_x; + by = md2->bl_y; + m = md2->bl_m; if (value[0] <= 1000 || value[0] > 2000) // 値が異常なら召喚を止める return 0; @@ -2938,11 +2938,11 @@ int mob_summonslave(struct mob_data *md2, int *value, int amount, int flag) } mob_spawn_dataset(md, "--ja--", mob_class); - md->bl.bl_prev = NULL; - md->bl.bl_next = NULL; - md->bl.bl_m = m; - md->bl.bl_x = x; - md->bl.bl_y = y; + md->bl_prev = NULL; + md->bl_next = NULL; + md->bl_m = m; + md->bl_x = x; + md->bl_y = y; md->m = m; md->x0 = x; @@ -2954,12 +2954,12 @@ int mob_summonslave(struct mob_data *md2, int *value, int amount, int flag) md->spawndelay2 = static_cast<interval_t>(-1); // 一度のみフラグ memset(md->npc_event, 0, sizeof(md->npc_event)); - md->bl.bl_type = BL::MOB; - map_addiddb(&md->bl); - mob_spawn(md->bl.bl_id); + md->bl_type = BL::MOB; + map_addiddb(md); + mob_spawn(md->bl_id); if (flag) - md->master_id = md2->bl.bl_id; + md->master_id = md2->bl_id; } } return 0; @@ -3005,9 +3005,9 @@ int mob_counttargeted(struct mob_data *md, struct block_list *src, nullpo_ret(md); - map_foreachinarea(std::bind(mob_counttargeted_sub, ph::_1, md->bl.bl_id, &c, src, target_lv), - md->bl.bl_m, md->bl.bl_x - AREA_SIZE, md->bl.bl_y - AREA_SIZE, - md->bl.bl_x + AREA_SIZE, md->bl.bl_y + AREA_SIZE, + map_foreachinarea(std::bind(mob_counttargeted_sub, ph::_1, md->bl_id, &c, src, target_lv), + md->bl_m, md->bl_x - AREA_SIZE, md->bl_y - AREA_SIZE, + md->bl_x + AREA_SIZE, md->bl_y + AREA_SIZE, BL::NUL); return c; } @@ -3034,30 +3034,30 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id) PRINTF("mobskill_castend_id nullpo mbl->bl_id:%d\n", mbl->bl_id); return; } - if (md->bl.bl_type != BL::MOB || md->bl.bl_prev == NULL) + if (md->bl_type != BL::MOB || md->bl_prev == NULL) return; if (bool(md->opt1)) return; if (md->skillid != SkillID::NPC_EMOTION) - md->last_thinktime = tick + battle_get_adelay(&md->bl); + md->last_thinktime = tick + battle_get_adelay(md); if ((bl = map_id2bl(md->skilltarget)) == NULL || bl->bl_prev == NULL) { //スキルターゲットが存在しない //PRINTF("mobskill_castend_id nullpo\n");//ターゲットがいないときはnullpoじゃなくて普通に終了 return; } - if (md->bl.bl_m != bl->bl_m) + if (md->bl_m != bl->bl_m) return; if (((skill_get_inf(md->skillid) & 1) || (skill_get_inf2(md->skillid) & 4)) && // 彼我敵対関係チェック - battle_check_target(&md->bl, bl, BCT_ENEMY) <= 0) + battle_check_target(md, bl, BCT_ENEMY) <= 0) return; range = skill_get_range(md->skillid, md->skilllv); if (range < 0) - range = battle_get_range(&md->bl) - (range + 1); - if (range + battle_config.mob_skill_add_range < distance(md->bl.bl_x, md->bl.bl_y, bl->bl_x, bl->bl_y)) + range = battle_get_range(md) - (range + 1); + if (range + battle_config.mob_skill_add_range < distance(md->bl_x, md->bl_y, bl->bl_x, bl->bl_y)) return; md->skilldelay[md->skillidx] = tick; @@ -3072,12 +3072,12 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id) // 攻撃系/吹き飛ばし系 case 0: case 2: - skill_castend_damage_id(&md->bl, bl, + skill_castend_damage_id(md, bl, md->skillid, md->skilllv, tick, BCT_ZERO); break; case 1: // 支援系 - skill_castend_nodamage_id(&md->bl, bl, + skill_castend_nodamage_id(md, bl, md->skillid, md->skilllv); break; } @@ -3100,7 +3100,7 @@ void mobskill_castend_pos(TimerData *, tick_t tick, int id) md = (struct mob_data *) bl; nullpo_retv(md); - if (md->bl.bl_type != BL::MOB || md->bl.bl_prev == NULL) + if (md->bl_type != BL::MOB || md->bl_prev == NULL) return; if (bool(md->opt1)) @@ -3108,8 +3108,8 @@ void mobskill_castend_pos(TimerData *, tick_t tick, int id) range = skill_get_range(md->skillid, md->skilllv); if (range < 0) - range = battle_get_range(&md->bl) - (range + 1); - if (range + battle_config.mob_skill_add_range < distance(md->bl.bl_x, md->bl.bl_y, md->skillx, md->skilly)) + range = battle_get_range(md) - (range + 1); + if (range + battle_config.mob_skill_add_range < distance(md->bl_x, md->bl_y, md->skillx, md->skilly)) return; md->skilldelay[md->skillidx] = tick; @@ -3138,7 +3138,7 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target, if (target == NULL && (target = map_id2bl(md->target_id)) == NULL) return 0; - if (target->bl_prev == NULL || md->bl.bl_prev == NULL) + if (target->bl_prev == NULL || md->bl_prev == NULL) return 0; skill_id = ms->skill_id; @@ -3147,20 +3147,20 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target, if (bool(md->opt1)) return 0; - if (skill_get_inf2(skill_id) & 0x200 && md->bl.bl_id == target->bl_id) + if (skill_get_inf2(skill_id) & 0x200 && md->bl_id == target->bl_id) return 0; // 射程と障害物チェック range = skill_get_range(skill_id, skill_lv); if (range < 0) - range = battle_get_range(&md->bl) - (range + 1); + range = battle_get_range(md) - (range + 1); - if (!battle_check_range(&md->bl, target, range)) + if (!battle_check_range(md, target, range)) return 0; -// delay=skill_delayfix(&md->bl, skill_get_delay( skill_id,skill_lv) ); +// delay=skill_delayfix(md, skill_get_delay( skill_id,skill_lv) ); - interval_t casttime = skill_castfix(&md->bl, ms->casttime); + interval_t casttime = skill_castfix(md, ms->casttime); md->state.skillcastcancel = ms->cancel; md->skilldelay[skill_idx] = gettick(); @@ -3183,12 +3183,12 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target, { md->skilltimer = Timer(gettick() + casttime, std::bind(mobskill_castend_id, ph::_1, ph::_2, - md->bl.bl_id)); + md->bl_id)); } else { assert (!md->skilltimer); - mobskill_castend_id(nullptr, gettick(), md->bl.bl_id); + mobskill_castend_id(nullptr, gettick(), md->bl_id); } return 1; @@ -3211,7 +3211,7 @@ int mobskill_use_pos(struct mob_data *md, ms = &mob_db[md->mob_class].skill[skill_idx]; nullpo_ret(ms); - if (md->bl.bl_prev == NULL) + if (md->bl_prev == NULL) return 0; SkillID skill_id = ms->skill_id; @@ -3222,17 +3222,17 @@ int mobskill_use_pos(struct mob_data *md, // 射程と障害物チェック bl.bl_type = BL::NUL; - bl.bl_m = md->bl.bl_m; + bl.bl_m = md->bl_m; bl.bl_x = skill_x; bl.bl_y = skill_y; range = skill_get_range(skill_id, skill_lv); if (range < 0) - range = battle_get_range(&md->bl) - (range + 1); - if (!battle_check_range(&md->bl, &bl, range)) + range = battle_get_range(md) - (range + 1); + if (!battle_check_range(md, &bl, range)) return 0; -// delay=skill_delayfix(&sd->bl, skill_get_delay( skill_id,skill_lv) ); - interval_t casttime = skill_castfix(&md->bl, ms->casttime); +// delay=skill_delayfix(sd, skill_get_delay( skill_id,skill_lv) ); + interval_t casttime = skill_castfix(md, ms->casttime); md->skilldelay[skill_idx] = gettick(); md->state.skillcastcancel = ms->cancel; @@ -3255,12 +3255,12 @@ int mobskill_use_pos(struct mob_data *md, { md->skilltimer = Timer(gettick() + casttime, std::bind(mobskill_castend_pos, ph::_1, ph::_2, - md->bl.bl_id)); + md->bl_id)); } else { assert (!md->skilltimer); - mobskill_castend_pos(nullptr, gettick(), md->bl.bl_id); + mobskill_castend_pos(nullptr, gettick(), md->bl_id); } return 1; @@ -3281,7 +3281,7 @@ int mobskill_use(struct mob_data *md, tick_t tick, ms = mob_db[md->mob_class].skill; nullpo_ret(ms); - max_hp = battle_get_max_hp(&md->bl); + max_hp = battle_get_max_hp(md); if (battle_config.mob_skill_use == 0 || md->skilltimer) return 0; @@ -3314,7 +3314,7 @@ int mobskill_use(struct mob_data *md, tick_t tick, flag = (md->hp < max_hp * ms[ii].cond2i / 100); break; case MobSkillCondition::MSC_NOTINTOWN: // Only outside of towns. - flag = !map[md->bl.bl_m].flag.town; + flag = !map[md->bl_m].flag.town; break; case MobSkillCondition::MSC_SLAVELT: // slave < num flag = (mob_countslave(md) < ms[ii].cond2i); @@ -3338,7 +3338,7 @@ int mobskill_use(struct mob_data *md, tick_t tick, { bl = ms[ii].target == MobSkillTarget::MST_TARGET ? map_id2bl(md->target_id) - : &md->bl; + : md; } if (bl) @@ -3358,13 +3358,13 @@ int mobskill_use(struct mob_data *md, tick_t tick, struct block_list *bl = NULL; bl = (ms[ii].target == MobSkillTarget::MST_TARGET) ? map_id2bl(md->target_id) - : &md->bl; + : md; if (bl && !mobskill_use_id(md, bl, ii)) return 0; } } if (ms[ii].emotion >= 0) - clif_emotion(&md->bl, ms[ii].emotion); + clif_emotion(md, ms[ii].emotion); return 1; } } diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 6c0c842..f0ea12e 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -75,9 +75,9 @@ void npc_enable_sub(struct block_list *bl, struct npc_data *nd) return; memcpy(name, nd->name, sizeof(nd->name)); - if (sd->areanpc_id == nd->bl.bl_id) + if (sd->areanpc_id == nd->bl_id) return; // TODO fix leak of 'name' - sd->areanpc_id = nd->bl.bl_id; + sd->areanpc_id = nd->bl_id; npc_event(sd, strcat(name, "::OnTouch"), 0); } free(name); @@ -97,12 +97,12 @@ int npc_enable(const char *name, bool flag) else { // 無効化 nd->flag |= 1; - clif_clearchar(&nd->bl, BeingRemoveWhy::GONE); + clif_clearchar(nd, BeingRemoveWhy::GONE); } if (flag && (nd->u.scr.xs > 0 || nd->u.scr.ys > 0)) map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), - nd->bl.bl_m, nd->bl.bl_x - nd->u.scr.xs, nd->bl.bl_y - nd->u.scr.ys, - nd->bl.bl_x + nd->u.scr.xs, nd->bl.bl_y + nd->u.scr.ys, BL::PC); + nd->bl_m, nd->bl_x - nd->u.scr.xs, nd->bl_y - nd->u.scr.ys, + nd->bl_x + nd->u.scr.xs, nd->bl_y + nd->u.scr.ys, BL::PC); return 0; } @@ -148,11 +148,11 @@ int npc_delete(struct npc_data *nd) { nullpo_retr(1, nd); - if (nd->bl.bl_prev == NULL) + if (nd->bl_prev == NULL) return 1; - clif_clearchar(&nd->bl, BeingRemoveWhy::DEAD); - map_delblock(&nd->bl); + clif_clearchar(nd, BeingRemoveWhy::DEAD); + map_delblock(nd); return 0; } @@ -168,7 +168,7 @@ int npc_timer_event(const char *eventname) // Added by RoVeRT return 0; } - run_script(nd->u.scr.script, ev->pos, nd->bl.bl_id, nd->bl.bl_id); + run_script(nd->u.scr.script, ev->pos, nd->bl_id, nd->bl_id); return 0; } @@ -187,7 +187,7 @@ void npc_event_doall_sub(const std::string& key, struct event_data *ev, if ((p = strchr(p, ':')) && p && strcasecmp(name, p) == 0) { - run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.bl_id, argc, + run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl_id, argc, argv); (*c)++; } @@ -215,7 +215,7 @@ void npc_event_do_sub(const std::string& key, struct event_data *ev, if (p && strcasecmp(name, p) == 0) { - run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.bl_id, argc, + run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl_id, argc, argv); (*c)++; } @@ -310,7 +310,7 @@ void npc_timerevent(TimerData *, tick_t tick, int id, interval_t data) id, next)); } - run_script(nd->u.scr.script, te->pos, 0, nd->bl.bl_id); + run_script(nd->u.scr.script, te->pos, 0, nd->bl_id); } /*========================================== @@ -341,7 +341,7 @@ int npc_timerevent_start(struct npc_data *nd) interval_t next = nd->u.scr.timer_event[j].timer - nd->u.scr.timer; nd->u.scr.timerid = Timer(gettick() + next, std::bind(npc_timerevent, ph::_1, ph::_2, - nd->bl.bl_id, next)); + nd->bl_id, next)); return 0; } @@ -443,13 +443,13 @@ int npc_event(struct map_session_data *sd, const char *eventname, ys = nd->u.scr.ys; if (xs >= 0 && ys >= 0) { - if (nd->bl.bl_m != sd->bl.bl_m) + if (nd->bl_m != sd->bl_m) return 1; if (xs > 0 - && (sd->bl.bl_x < nd->bl.bl_x - xs / 2 || nd->bl.bl_x + xs / 2 < sd->bl.bl_x)) + && (sd->bl_x < nd->bl_x - xs / 2 || nd->bl_x + xs / 2 < sd->bl_x)) return 1; if (ys > 0 - && (sd->bl.bl_y < nd->bl.bl_y - ys / 2 || nd->bl.bl_y + ys / 2 < sd->bl.bl_y)) + && (sd->bl_y < nd->bl_y - ys / 2 || nd->bl_y + ys / 2 < sd->bl_y)) return 1; } @@ -481,9 +481,9 @@ int npc_event(struct map_session_data *sd, const char *eventname, return 0; } - sd->npc_id = nd->bl.bl_id; + sd->npc_id = nd->bl_id; sd->npc_pos = - run_script(nd->u.scr.script, ev->pos, sd->bl.bl_id, nd->bl.bl_id); + run_script(nd->u.scr.script, ev->pos, sd->bl_id, nd->bl_id); return 0; } @@ -499,7 +499,7 @@ void npc_command_sub(const std::string& key, struct event_data *ev, const char * sscanf(&p[11], "%s", temp); if (strcmp(command, temp) == 0) - run_script(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.bl_id); + run_script(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl_id); } } @@ -547,10 +547,10 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y) default: continue; } - if (x >= map[m].npc[i]->bl.bl_x - xs / 2 - && x < map[m].npc[i]->bl.bl_x - xs / 2 + xs - && y >= map[m].npc[i]->bl.bl_y - ys / 2 - && y < map[m].npc[i]->bl.bl_y - ys / 2 + ys) + if (x >= map[m].npc[i]->bl_x - xs / 2 + && x < map[m].npc[i]->bl_x - xs / 2 + xs + && y >= map[m].npc[i]->bl_y - ys / 2 + && y < map[m].npc[i]->bl_y - ys / 2 + ys) break; } if (i == map[m].npc_num) @@ -565,7 +565,7 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y) switch (map[m].npc[i]->npc_subtype) { case NpcSubtype::WARP: - skill_stop_dancing(&sd->bl, 0); + skill_stop_dancing(sd, 0); pc_setpos(sd, map[m].npc[i]->u.warp.name, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, BeingRemoveWhy::GONE); break; @@ -575,11 +575,11 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y) char *name = (char *)malloc(50); memcpy(name, map[m].npc[i]->name, 50); - if (sd->areanpc_id == map[m].npc[i]->bl.bl_id) + if (sd->areanpc_id == map[m].npc[i]->bl_id) return 1; // TODO fix leak of 'name' - sd->areanpc_id = map[m].npc[i]->bl.bl_id; + sd->areanpc_id = map[m].npc[i]->bl_id; if (npc_event(sd, strcat(name, "::OnTouch"), 0) > 0) - npc_click(sd, map[m].npc[i]->bl.bl_id); + npc_click(sd, map[m].npc[i]->bl_id); free(name); break; } @@ -599,7 +599,7 @@ int npc_checknear(struct map_session_data *sd, int id) nullpo_ret(sd); nd = (struct npc_data *) map_id2bl(id); - if (nd == NULL || nd->bl.bl_type != BL::NPC) + if (nd == NULL || nd->bl_type != BL::NPC) { if (battle_config.error_log) PRINTF("no such npc : %d\n", id); @@ -610,11 +610,11 @@ int npc_checknear(struct map_session_data *sd, int id) return 0; // エリア判定 - if (nd->bl.bl_m != sd->bl.bl_m || - nd->bl.bl_x < sd->bl.bl_x - AREA_SIZE - 1 - || nd->bl.bl_x > sd->bl.bl_x + AREA_SIZE + 1 - || nd->bl.bl_y < sd->bl.bl_y - AREA_SIZE - 1 - || nd->bl.bl_y > sd->bl.bl_y + AREA_SIZE + 1) + if (nd->bl_m != sd->bl_m || + nd->bl_x < sd->bl_x - AREA_SIZE - 1 + || nd->bl_x > sd->bl_x + AREA_SIZE + 1 + || nd->bl_y < sd->bl_y - AREA_SIZE - 1 + || nd->bl_y > sd->bl_y + AREA_SIZE + 1) return 1; return 0; @@ -655,7 +655,7 @@ int npc_click(struct map_session_data *sd, int id) npc_event_dequeue(sd); break; case NpcSubtype::SCRIPT: - sd->npc_pos = run_script(nd->u.scr.script, 0, sd->bl.bl_id, id); + sd->npc_pos = run_script(nd->u.scr.script, 0, sd->bl_id, id); break; case NpcSubtype::MESSAGE: if (nd->u.message) @@ -695,7 +695,7 @@ int npc_scriptcont(struct map_session_data *sd, int id) return 0; } - sd->npc_pos = run_script(nd->u.scr.script, sd->npc_pos, sd->bl.bl_id, id); + sd->npc_pos = run_script(nd->u.scr.script, sd->npc_pos, sd->bl_id, id); return 0; } @@ -975,13 +975,13 @@ int npc_parse_warp(const char *w1, const char *, const char *w3, const char *w4) m = map_mapname2mapid(mapname); nd = (struct npc_data *) calloc(1, sizeof(struct npc_data)); - nd->bl.bl_id = npc_get_new_npc_id(); + nd->bl_id = npc_get_new_npc_id(); nd->n = map_addnpc(m, nd); - nd->bl.bl_prev = nd->bl.bl_next = NULL; - nd->bl.bl_m = m; - nd->bl.bl_x = x; - nd->bl.bl_y = y; + nd->bl_prev = nd->bl_next = NULL; + nd->bl_m = m; + nd->bl_x = x; + nd->bl_y = y; nd->dir = DIR::S; nd->flag = 0; memcpy(nd->name, w3, 24); @@ -1020,11 +1020,11 @@ int npc_parse_warp(const char *w1, const char *, const char *w3, const char *w4) } } -// PRINTF("warp npc %s %d read done\n",mapname,nd->bl.bl_id); +// PRINTF("warp npc %s %d read done\n",mapname,nd->bl_id); npc_warp++; - nd->bl.bl_type = BL::NPC; + nd->bl_type = BL::NPC; nd->npc_subtype = NpcSubtype::WARP; - map_addblock(&nd->bl); + map_addblock(nd); clif_spawnnpc(nd); npcname_db.put(nd->name, nd); @@ -1105,11 +1105,11 @@ int npc_parse_shop(char *w1, char *, char *w3, char *w4) } nd->u.shop_item[pos++].nameid = 0; - nd->bl.bl_prev = nd->bl.bl_next = NULL; - nd->bl.bl_m = m; - nd->bl.bl_x = x; - nd->bl.bl_y = y; - nd->bl.bl_id = npc_get_new_npc_id(); + nd->bl_prev = nd->bl_next = NULL; + nd->bl_m = m; + nd->bl_x = x; + nd->bl_y = y; + nd->bl_id = npc_get_new_npc_id(); nd->dir = dir; nd->flag = 0; memcpy(nd->name, w3, 24); @@ -1124,12 +1124,12 @@ int npc_parse_shop(char *w1, char *, char *w3, char *w4) nd = (struct npc_data *) realloc(nd, sizeof(struct npc_data) + sizeof(nd->u.shop_item[0]) * pos); - //PRINTF("shop npc %s %d read done\n",mapname,nd->bl.bl_id); + //PRINTF("shop npc %s %d read done\n",mapname,nd->bl_id); npc_shop++; - nd->bl.bl_type = BL::NPC; + nd->bl_type = BL::NPC; nd->npc_subtype = NpcSubtype::SHOP; nd->n = map_addnpc(m, nd); - map_addblock(&nd->bl); + map_addblock(nd); clif_spawnnpc(nd); npcname_db.put(nd->name, nd); @@ -1278,7 +1278,7 @@ int npc_parse_script(char *w1, char *w2, char *w3, char *w4, script = nd2->u.scr.script; label_dup = nd2->u.scr.label_list; label_dupnum = nd2->u.scr.label_list_num; - src_id = nd2->bl.bl_id; + src_id = nd2->bl_id; } // end of スクリプト解析 @@ -1350,11 +1350,11 @@ int npc_parse_script(char *w1, char *w2, char *w3, char *w4, memcpy(nd->exname, w3, 24); } - nd->bl.bl_prev = nd->bl.bl_next = NULL; - nd->bl.bl_m = m; - nd->bl.bl_x = x; - nd->bl.bl_y = y; - nd->bl.bl_id = npc_get_new_npc_id(); + nd->bl_prev = nd->bl_next = NULL; + nd->bl_m = m; + nd->bl_x = x; + nd->bl_y = y; + nd->bl_id = npc_get_new_npc_id(); nd->dir = dir; nd->flag = 0; nd->npc_class = npc_class; @@ -1367,14 +1367,14 @@ int npc_parse_script(char *w1, char *w2, char *w3, char *w4, nd->opt2 = Opt2::ZERO; nd->opt3 = Opt3::ZERO; - //PRINTF("script npc %s %d %d read done\n",mapname,nd->bl.bl_id,nd->class); + //PRINTF("script npc %s %d %d read done\n",mapname,nd->bl_id,nd->class); npc_script++; - nd->bl.bl_type = BL::NPC; + nd->bl_type = BL::NPC; nd->npc_subtype = NpcSubtype::SCRIPT; if (m >= 0) { nd->n = map_addnpc(m, nd); - map_addblock(&nd->bl); + map_addblock(nd); if (evflag) { // イベント型 @@ -1585,11 +1585,11 @@ int npc_parse_mob(const char *w1, const char *, const char *w3, const char *w4) { md = (struct mob_data *) calloc(1, sizeof(struct mob_data)); - md->bl.bl_prev = NULL; - md->bl.bl_next = NULL; - md->bl.bl_m = m; - md->bl.bl_x = x; - md->bl.bl_y = y; + md->bl_prev = NULL; + md->bl_next = NULL; + md->bl_m = m; + md->bl_x = x; + md->bl_y = y; if (strcmp(w3, "--en--") == 0) memcpy(md->name, mob_db[mob_class].name, 24); else if (strcmp(w3, "--ja--") == 0) @@ -1599,7 +1599,7 @@ int npc_parse_mob(const char *w1, const char *, const char *w3, const char *w4) md->n = i; md->mob_class = mob_class; - md->bl.bl_id = npc_get_new_npc_id(); + md->bl_id = npc_get_new_npc_id(); md->m = m; md->x0 = x; md->y0 = y; @@ -1626,13 +1626,13 @@ int npc_parse_mob(const char *w1, const char *, const char *w3, const char *w4) else memset(md->npc_event, 0, 24); - md->bl.bl_type = BL::MOB; - map_addiddb(&md->bl); - mob_spawn(md->bl.bl_id); + md->bl_type = BL::MOB; + map_addiddb(md); + mob_spawn(md->bl_id); npc_mob++; } - //PRINTF("warp npc %s %d read done\n",mapname,nd->bl.bl_id); + //PRINTF("warp npc %s %d read done\n",mapname,nd->bl_id); return 0; } @@ -1772,11 +1772,11 @@ struct npc_data *npc_spawn_text(int m, int x, int y, { struct npc_data *retval = (struct npc_data *) calloc(1, sizeof(struct npc_data)); - retval->bl.bl_id = npc_get_new_npc_id(); - retval->bl.bl_x = x; - retval->bl.bl_y = y; - retval->bl.bl_m = m; - retval->bl.bl_type = BL::NPC; + retval->bl_id = npc_get_new_npc_id(); + retval->bl_x = x; + retval->bl_y = y; + retval->bl_m = m; + retval->bl_type = BL::NPC; retval->npc_subtype = NpcSubtype::MESSAGE; strncpy(retval->name, name, 23); @@ -1789,8 +1789,8 @@ struct npc_data *npc_spawn_text(int m, int x, int y, retval->speed = std::chrono::milliseconds(200); clif_spawnnpc(retval); - map_addblock(&retval->bl); - map_addiddb(&retval->bl); + map_addblock(retval); + map_addiddb(retval); if (retval->name && retval->name[0]) npcname_db.put(retval->name, retval); @@ -1836,16 +1836,16 @@ static void npc_propagate_update(struct npc_data *nd) { map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), - nd->bl.bl_m, nd->bl.bl_x - nd->u.scr.xs, nd->bl.bl_y - nd->u.scr.ys, - nd->bl.bl_x + nd->u.scr.xs, nd->bl.bl_y + nd->u.scr.ys, BL::PC); + nd->bl_m, nd->bl_x - nd->u.scr.xs, nd->bl_y - nd->u.scr.ys, + nd->bl_x + nd->u.scr.xs, nd->bl_y + nd->u.scr.ys, BL::PC); } void npc_free(struct npc_data *nd) { - clif_clearchar(&nd->bl, BeingRemoveWhy::GONE); + clif_clearchar(nd, BeingRemoveWhy::GONE); npc_propagate_update(nd); - map_deliddb(&nd->bl); - map_delblock(&nd->bl); + map_deliddb(nd); + map_delblock(nd); npc_free_internal(nd); } diff --git a/src/map/party.cpp b/src/map/party.cpp index c2dc5c4..c1488c0 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -644,11 +644,11 @@ void party_send_xyhp_timer_sub(struct party *p) if ((sd = p->member[i].sd) != NULL) { // 座標通知 - if (sd->party_x != sd->bl.bl_x || sd->party_y != sd->bl.bl_y) + if (sd->party_x != sd->bl_x || sd->party_y != sd->bl_y) { clif_party_xy(p, sd); - sd->party_x = sd->bl.bl_x; - sd->party_y = sd->bl.bl_y; + sd->party_x = sd->bl_x; + sd->party_y = sd->bl_y; } // HP通知 if (sd->party_hp != sd->status.hp) @@ -712,12 +712,12 @@ int party_exp_share(struct party *p, int mapid, int base_exp, int job_exp) nullpo_ret(p); for (i = c = 0; i < MAX_PARTY; i++) - if ((sd = p->member[i].sd) != NULL && sd->bl.bl_m == mapid) + if ((sd = p->member[i].sd) != NULL && sd->bl_m == mapid) c++; if (c == 0) return 0; for (i = 0; i < MAX_PARTY; i++) - if ((sd = p->member[i].sd) != NULL && sd->bl.bl_m == mapid) + if ((sd = p->member[i].sd) != NULL && sd->bl_m == mapid) pc_gainexp_reason(sd, base_exp / c + 1, job_exp / c + 1, PC_GAINEXP_REASON::SHARING); return 0; @@ -740,23 +740,23 @@ void party_foreachsamemap(std::function<void(struct block_list *)> func, if ((p = party_search(sd->status.party_id)) == NULL) return; - x0 = sd->bl.bl_x - AREA_SIZE; - y0 = sd->bl.bl_y - AREA_SIZE; - x1 = sd->bl.bl_x + AREA_SIZE; - y1 = sd->bl.bl_y + AREA_SIZE; + x0 = sd->bl_x - AREA_SIZE; + y0 = sd->bl_y - AREA_SIZE; + x1 = sd->bl_x + AREA_SIZE; + y1 = sd->bl_y + AREA_SIZE; for (i = 0; i < MAX_PARTY; i++) { struct party_member *m = &p->member[i]; if (m->sd != NULL) { - if (sd->bl.bl_m != m->sd->bl.bl_m) + if (sd->bl_m != m->sd->bl_m) continue; if (type != 0 && - (m->sd->bl.bl_x < x0 || m->sd->bl.bl_y < y0 || - m->sd->bl.bl_x > x1 || m->sd->bl.bl_y > y1)) + (m->sd->bl_x < x0 || m->sd->bl_y < y0 || + m->sd->bl_x > x1 || m->sd->bl_y > y1)) continue; - list[blockcount++] = &m->sd->bl; + list[blockcount++] = m->sd; } } diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 79a1222..59dbfad 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -252,12 +252,12 @@ int pc_iskiller(struct map_session_data *src, { nullpo_ret(src); - if (src->bl.bl_type != BL::PC) + if (src->bl_type != BL::PC) return 0; if (src->special_state.killer) return 1; - if (target->bl.bl_type != BL::PC) + if (target->bl_type != BL::PC) return 0; if (target->special_state.killable) return 1; @@ -300,7 +300,7 @@ void pc_invincible_timer(TimerData *, tick_t, int id) struct map_session_data *sd = map_id2sd(id); assert (sd != NULL); - assert (sd->bl.bl_type == BL::PC); + assert (sd->bl_type == BL::PC); } int pc_setinvincibletimer(struct map_session_data *sd, interval_t val) @@ -309,7 +309,7 @@ int pc_setinvincibletimer(struct map_session_data *sd, interval_t val) sd->invincible_timer = Timer(gettick() + val, std::bind(pc_invincible_timer, ph::_1, ph::_2, - sd->bl.bl_id)); + sd->bl_id)); return 0; } @@ -390,9 +390,9 @@ int pc_counttargeted(struct map_session_data *sd, struct block_list *src, ATK target_lv) { int c = 0; - map_foreachinarea(std::bind(pc_counttargeted_sub, ph::_1, sd->bl.bl_id, &c, src, target_lv), - sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE, sd->bl.bl_y - AREA_SIZE, - sd->bl.bl_x + AREA_SIZE, sd->bl.bl_y + AREA_SIZE, BL::NUL); + map_foreachinarea(std::bind(pc_counttargeted_sub, ph::_1, sd->bl_id, &c, src, target_lv), + sd->bl_m, sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, + sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, BL::NUL); return c; } @@ -425,14 +425,14 @@ int pc_makesavestatus(struct map_session_data *sd) else { memcpy(sd->status.last_point.map, sd->mapname, 24); - sd->status.last_point.x = sd->bl.bl_x; - sd->status.last_point.y = sd->bl.bl_y; + sd->status.last_point.x = sd->bl_x; + sd->status.last_point.y = sd->bl_y; } // セーブ禁止マップだったので指定位置に移動 - if (map[sd->bl.bl_m].flag.nosave) + if (map[sd->bl_m].flag.nosave) { - struct map_data *m = &map[sd->bl.bl_m]; + struct map_data *m = &map[sd->bl_m]; if (strcmp(m->save.map, "SavePoint") == 0) memcpy(&sd->status.last_point, &sd->status.save_point, sizeof(sd->status.last_point)); @@ -453,14 +453,14 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, { nullpo_ret(sd); - sd->bl.bl_id = account_id; + sd->bl_id = account_id; sd->char_id = char_id; sd->login_id1 = login_id1; sd->login_id2 = 0; // at this point, we can not know the value :( sd->client_tick = client_tick; sd->sex = sex; sd->state.auth = 0; - sd->bl.bl_type = BL::PC; + sd->bl_type = BL::PC; sd->canact_tick = sd->canmove_tick = gettick(); sd->canlog_tick = gettick(); sd->state.waitingdisconnect = 0; @@ -596,7 +596,7 @@ int pc_isequip(struct map_session_data *sd, int n) nullpo_ret(sd); item = sd->inventory_data[n]; - sc_data = battle_get_sc_data(&sd->bl); + sc_data = battle_get_sc_data(sd); if (battle_config.gm_allequip > 0 && pc_isGM(sd) >= battle_config.gm_allequip) @@ -609,7 +609,7 @@ int pc_isequip(struct map_session_data *sd, int n) if (item->elv > 0 && sd->status.base_level < item->elv) return 0; - if (map[sd->bl.bl_m].flag.pvp + if (map[sd->bl_m].flag.pvp && (item->flag.no_equip == 1 || item->flag.no_equip == 3)) return 0; return 1; @@ -652,7 +652,7 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time, memset(&sd->state, 0, sizeof(sd->state)); // 基本的な初期化 sd->state.connect_new = 1; - sd->bl.bl_prev = sd->bl.bl_next = NULL; + sd->bl_prev = sd->bl_next = NULL; sd->weapontype1 = sd->weapontype2 = ItemLook::NONE; sd->speed = DEFAULT_WALK_SPEED; @@ -871,20 +871,20 @@ int pc_checkweighticon(struct map_session_data *sd) if (flag == 1) { if (!sd->sc_data[StatusChange::SC_WEIGHT50].timer) - skill_status_change_start(&sd->bl, StatusChange::SC_WEIGHT50, 0, interval_t::zero()); + skill_status_change_start(sd, StatusChange::SC_WEIGHT50, 0, interval_t::zero()); } else { - skill_status_change_end(&sd->bl, StatusChange::SC_WEIGHT50, nullptr); + skill_status_change_end(sd, StatusChange::SC_WEIGHT50, nullptr); } if (flag == 2) { if (!sd->sc_data[StatusChange::SC_WEIGHT90].timer) - skill_status_change_start(&sd->bl, StatusChange::SC_WEIGHT90, 0, interval_t::zero()); + skill_status_change_start(sd, StatusChange::SC_WEIGHT90, 0, interval_t::zero()); } else { - skill_status_change_end(&sd->bl, StatusChange::SC_WEIGHT90, nullptr); + skill_status_change_end(sd, StatusChange::SC_WEIGHT90, nullptr); } return 0; } @@ -893,10 +893,10 @@ static void pc_set_weapon_look(struct map_session_data *sd) { if (sd->attack_spell_override) - clif_changelook(&sd->bl, LOOK::WEAPON, + clif_changelook(sd, LOOK::WEAPON, sd->attack_spell_look_override); else - clif_changelook(&sd->bl, LOOK::WEAPON, + clif_changelook(sd, LOOK::WEAPON, static_cast<uint16_t>(sd->status.weapon)); } @@ -1075,7 +1075,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) if (i == EQUIP::SHIELD && sd->status.inventory[index].equip == EPOS::SHIELD) sd->state.lr_flag = 1; - run_script_l(itemdb_equipscript(c), 0, sd->bl.bl_id, + run_script_l(itemdb_equipscript(c), 0, sd->bl_id, 0, 2, arg); sd->state.lr_flag = 0; } @@ -1098,7 +1098,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) arg[0].v.i = int(i); arg[1].name = "@itemId"; arg[1].v.i = sd->inventory_data[index]->nameid; - run_script_l(itemdb_equipscript(c), 0, sd->bl.bl_id, + run_script_l(itemdb_equipscript(c), 0, sd->bl_id, 0, 2, arg); } } @@ -1162,7 +1162,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) arg[1].name = "@itemId"; arg[1].v.i = sd->inventory_data[index]->nameid; run_script_l(sd->inventory_data[index]->equip_script, 0, - sd->bl.bl_id, 0, 2, arg); + sd->bl_id, 0, 2, arg); } sd->state.lr_flag = 0; } @@ -1185,7 +1185,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) } sd->attackrange += sd->inventory_data[index]->range; run_script_l(sd->inventory_data[index]->equip_script, 0, - sd->bl.bl_id, 0, 2, arg); + sd->bl_id, 0, 2, arg); } } else if (sd->inventory_data[index]->type == ItemType::ARMOR) @@ -1199,12 +1199,12 @@ int pc_calcstatus(struct map_session_data *sd, int first) refinedef += sd->status.inventory[index].refine * 0; run_script_l(sd->inventory_data[index]->equip_script, 0, - sd->bl.bl_id, 0, 2, arg); + sd->bl_id, 0, 2, arg); } } } - if (battle_is_unarmed(&sd->bl)) + if (battle_is_unarmed(sd)) { sd->watk += skill_power(sd, SkillID::TMW_BRAWLING) / 3; // +66 for 200 sd->watk2 += skill_power(sd, SkillID::TMW_BRAWLING) >> 3; // +25 for 200 @@ -1223,7 +1223,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) arg[1].name = "@itemId"; arg[1].v.i = sd->inventory_data[index]->nameid; sd->state.lr_flag = 2; - run_script_l(sd->inventory_data[index]->equip_script, 0, sd->bl.bl_id, + run_script_l(sd->inventory_data[index]->equip_script, 0, sd->bl_id, 0, 2, arg); sd->state.lr_flag = 0; sd->arrow_atk += sd->inventory_data[index]->atk; @@ -2150,7 +2150,7 @@ int pc_dropitem(struct map_session_data *sd, int n, int amount) sd->trade_partner != 0 || sd->status.inventory[n].amount <= 0) return 1; map_addflooritem(&sd->status.inventory[n], amount, - sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, + sd->bl_m, sd->bl_x, sd->bl_y, NULL, NULL, NULL); pc_delitem(sd, n, amount, 0); @@ -2168,7 +2168,7 @@ int can_pick_item_up_from(struct map_session_data *self, int other_id) struct party *p = party_search(self->status.party_id); /* From ourselves or from no-one? */ - if (!self || self->bl.bl_id == other_id || !other_id) + if (!self || self->bl_id == other_id || !other_id) return 1; struct map_session_data *other = map_id2sd(other_id); @@ -2189,12 +2189,12 @@ int can_pick_item_up_from(struct map_session_data *self, int other_id) /* From someone who is far away? */ /* On another map? */ - if (other->bl.bl_m != self->bl.bl_m) + if (other->bl_m != self->bl_m) return 1; else { - int distance_x = abs(other->bl.bl_x - self->bl.bl_x); - int distance_y = abs(other->bl.bl_y - self->bl.bl_y); + int distance_x = abs(other->bl_x - self->bl_x); + int distance_y = abs(other->bl_y - self->bl_y); int distance = (distance_x > distance_y) ? distance_x : distance_y; return distance > battle_config.drop_pickup_safety_zone; @@ -2246,8 +2246,8 @@ int pc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem) // 取得成功 if (sd->attacktimer) pc_stopattack(sd); - clif_takeitem(&sd->bl, &fitem->bl); - map_clearflooritem(fitem->bl.bl_id); + clif_takeitem(sd, fitem); + map_clearflooritem(fitem->bl_id); } return 0; } @@ -2273,15 +2273,15 @@ int pc_isUseitem(struct map_session_data *sd, int n) if (itemdb_type(nameid) != ItemType::USE) return 0; if (nameid == 601 - && (map[sd->bl.bl_m].flag.noteleport)) + && (map[sd->bl_m].flag.noteleport)) { return 0; } - if (nameid == 602 && map[sd->bl.bl_m].flag.noreturn) + if (nameid == 602 && map[sd->bl_m].flag.noreturn) return 0; if (nameid == 604 - && (map[sd->bl.bl_m].flag.nobranch)) + && (map[sd->bl_m].flag.nobranch)) return 0; if (item->sex != 2 && sd->status.sex != item->sex) return 0; @@ -2312,7 +2312,7 @@ int pc_useitem(struct map_session_data *sd, int n) return 1; } - run_script(sd->inventory_data[n]->use_script, 0, sd->bl.bl_id, 0); + run_script(sd->inventory_data[n]->use_script, 0, sd->bl_id, 0); clif_useitemack(sd, n, amount - 1, 1); pc_delitem(sd, n, 1, 1); @@ -2367,7 +2367,7 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y if (sd->party_invite > 0) // パーティ勧誘を拒否する party_reply_invite(sd, sd->party_invite_account, 0); - skill_castcancel(&sd->bl, 0); // 詠唱中断 + skill_castcancel(sd, 0); // 詠唱中断 pc_stop_walking(sd, 0); // 歩行中断 pc_stopattack(sd); // 攻撃中断 @@ -2393,13 +2393,13 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y int port; if (map_mapname2ipport(mapname, &ip, &port) == 0) { - skill_stop_dancing(&sd->bl, 1); - clif_clearchar(&sd->bl, clrtype); + skill_stop_dancing(sd, 1); + clif_clearchar(sd, clrtype); skill_gangsterparadise(sd, 0); - map_delblock(&sd->bl); + map_delblock(sd); memcpy(sd->mapname, mapname, 24); - sd->bl.bl_x = x; - sd->bl.bl_y = y; + sd->bl_x = x; + sd->bl_y = y; sd->state.waitingdisconnect = 1; pc_makesavestatus(sd); //The storage close routines save the char data. [Skotlex] @@ -2437,25 +2437,25 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y while (bool(read_gat(m, x, y) & MapCell::UNWALKABLE)); } - if (sd->mapname[0] && sd->bl.bl_prev != NULL) + if (sd->mapname[0] && sd->bl_prev != NULL) { - clif_clearchar(&sd->bl, clrtype); + clif_clearchar(sd, clrtype); skill_gangsterparadise(sd, 0); - map_delblock(&sd->bl); + map_delblock(sd); clif_changemap(sd, map[m].name, x, y); // [MouseJstr] } memcpy(sd->mapname, mapname, 24); - sd->bl.bl_m = m; + sd->bl_m = m; sd->to_x = x; sd->to_y = y; // moved and changed dance effect stopping - sd->bl.bl_x = x; - sd->bl.bl_y = y; + sd->bl_x = x; + sd->bl_y = y; -// map_addblock(&sd->bl); // ブロック登録とspawnは +// map_addblock(sd); // ブロック登録とspawnは // clif_spawnpc(sd); return 0; @@ -2472,9 +2472,9 @@ int pc_randomwarp(struct map_session_data *sd, BeingRemoveWhy type) nullpo_ret(sd); - m = sd->bl.bl_m; + m = sd->bl_m; - if (map[sd->bl.bl_m].flag.noteleport) // テレポート禁止 + if (map[sd->bl_m].flag.noteleport) // テレポート禁止 return 0; do @@ -2502,14 +2502,14 @@ int pc_can_reach(struct map_session_data *sd, int x, int y) nullpo_ret(sd); - if (sd->bl.bl_x == x && sd->bl.bl_y == y) // 同じマス + if (sd->bl_x == x && sd->bl_y == y) // 同じマス return 1; // 障害物判定 wpd.path_len = 0; wpd.path_pos = 0; wpd.path_half = 0; - return (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, x, y, 0) != + return (path_search(&wpd, sd->bl_m, sd->bl_x, sd->bl_y, x, y, 0) != -1) ? 1 : 0; } @@ -2567,9 +2567,9 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) if (sd->walkpath.path[sd->walkpath.path_pos] >= DIR::COUNT) return; - x = sd->bl.bl_x; - y = sd->bl.bl_y; - if (bool(map_getcell(sd->bl.bl_m, x, y) & MapCell::UNWALKABLE)) + x = sd->bl_x; + y = sd->bl_y; + if (bool(map_getcell(sd->bl_m, x, y) & MapCell::UNWALKABLE)) { pc_stop_walking(sd, 1); return; @@ -2577,7 +2577,7 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) sd->dir = sd->head_dir = sd->walkpath.path[sd->walkpath.path_pos]; dx = dirx[sd->dir]; dy = diry[sd->dir]; - if (bool(map_getcell(sd->bl.bl_m, x + dx, y + dy) + if (bool(map_getcell(sd->bl_m, x + dx, y + dy) & MapCell::UNWALKABLE)) { pc_walktoxy_sub(sd); @@ -2589,7 +2589,7 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) // sd->walktimer = dummy value that is not nullptr; map_foreachinmovearea(std::bind(clif_pcoutsight, ph::_1, sd), - sd->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, dx, dy, BL::NUL); @@ -2598,14 +2598,14 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) y += dy; if (moveblock) - map_delblock(&sd->bl); - sd->bl.bl_x = x; - sd->bl.bl_y = y; + map_delblock(sd); + sd->bl_x = x; + sd->bl_y = y; if (moveblock) - map_addblock(&sd->bl); + map_addblock(sd); map_foreachinmovearea(std::bind(clif_pcinsight, ph::_1, sd), - sd->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, -dx, -dy, BL::NUL); @@ -2618,7 +2618,7 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) { int p_flag = 0; map_foreachinmovearea(std::bind(party_send_hp_check, ph::_1, sd->status.party_id, &p_flag), - sd->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, -dx, -dy, BL::PC); @@ -2631,12 +2631,12 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) for (int i = 0; i < 5; i++) if (sd->dev.val1[i]) { - skill_devotion3(&sd->bl, sd->dev.val1[i]); + skill_devotion3(sd, sd->dev.val1[i]); break; } - if (bool(map_getcell(sd->bl.bl_m, x, y) & MapCell::NPC_NEAR)) - npc_touch_areanpc(sd, sd->bl.bl_m, x, y); + if (bool(map_getcell(sd->bl_m, x, y) & MapCell::NPC_NEAR)) + npc_touch_areanpc(sd, sd->bl_m, x, y); else sd->areanpc_id = 0; } @@ -2664,7 +2664,7 @@ int pc_walktoxy_sub(struct map_session_data *sd) nullpo_retr(1, sd); - if (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, sd->to_x, sd->to_y, 0)) + if (path_search(&wpd, sd->bl_m, sd->bl_x, sd->bl_y, sd->to_x, sd->to_y, 0)) return 1; memcpy(&sd->walkpath, &wpd, sizeof(wpd)); @@ -2677,7 +2677,7 @@ int pc_walktoxy_sub(struct map_session_data *sd) i = i / 4; sd->walktimer = Timer(gettick() + i, std::bind(pc_walk, ph::_1, ph::_2, - sd->bl.bl_id, 0)); + sd->bl_id, 0)); } clif_movechar(sd); @@ -2724,14 +2724,14 @@ int pc_stop_walking(struct map_session_data *sd, int type) sd->walktimer.cancel(); sd->walkpath.path_len = 0; - sd->to_x = sd->bl.bl_x; - sd->to_y = sd->bl.bl_y; + sd->to_x = sd->bl_x; + sd->to_y = sd->bl_y; if (type & 0x01) - clif_fixpos(&sd->bl); + clif_fixpos(sd); if (type & 0x02 && battle_config.pc_damage_delay) { tick_t tick = gettick(); - interval_t delay = battle_get_dmotion(&sd->bl); + interval_t delay = battle_get_dmotion(sd); if (sd->canmove_tick < tick) sd->canmove_tick = tick + delay; } @@ -2741,8 +2741,8 @@ int pc_stop_walking(struct map_session_data *sd, int type) void pc_touch_all_relevant_npcs(struct map_session_data *sd) { - if (bool(map_getcell(sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y) & MapCell::NPC_NEAR)) - npc_touch_areanpc(sd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y); + if (bool(map_getcell(sd->bl_m, sd->bl_x, sd->bl_y) & MapCell::NPC_NEAR)) + npc_touch_areanpc(sd, sd->bl_m, sd->bl_x, sd->bl_y); else sd->areanpc_id = 0; } @@ -2760,33 +2760,33 @@ int pc_movepos(struct map_session_data *sd, int dst_x, int dst_y) nullpo_ret(sd); - if (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, dst_x, dst_y, 0)) + if (path_search(&wpd, sd->bl_m, sd->bl_x, sd->bl_y, dst_x, dst_y, 0)) return 1; - sd->dir = sd->head_dir = map_calc_dir(&sd->bl, dst_x, dst_y); + sd->dir = sd->head_dir = map_calc_dir(sd, dst_x, dst_y); - dx = dst_x - sd->bl.bl_x; - dy = dst_y - sd->bl.bl_y; + dx = dst_x - sd->bl_x; + dy = dst_y - sd->bl_y; - moveblock = (sd->bl.bl_x / BLOCK_SIZE != dst_x / BLOCK_SIZE - || sd->bl.bl_y / BLOCK_SIZE != dst_y / BLOCK_SIZE); + moveblock = (sd->bl_x / BLOCK_SIZE != dst_x / BLOCK_SIZE + || sd->bl_y / BLOCK_SIZE != dst_y / BLOCK_SIZE); map_foreachinmovearea(std::bind(clif_pcoutsight, ph::_1, sd), - sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE, sd->bl.bl_y - AREA_SIZE, - sd->bl.bl_x + AREA_SIZE, sd->bl.bl_y + AREA_SIZE, + sd->bl_m, sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, + sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, dx, dy, BL::NUL); if (moveblock) - map_delblock(&sd->bl); - sd->bl.bl_x = dst_x; - sd->bl.bl_y = dst_y; + map_delblock(sd); + sd->bl_x = dst_x; + sd->bl_y = dst_y; if (moveblock) - map_addblock(&sd->bl); + map_addblock(sd); map_foreachinmovearea(std::bind(clif_pcinsight, ph::_1, sd), - sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE, sd->bl.bl_y - AREA_SIZE, - sd->bl.bl_x + AREA_SIZE, sd->bl.bl_y + AREA_SIZE, + sd->bl_m, sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, + sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, -dx, -dy, BL::NUL); @@ -2797,8 +2797,8 @@ int pc_movepos(struct map_session_data *sd, int dst_x, int dst_y) { int flag = 0; map_foreachinmovearea(std::bind(party_send_hp_check, ph::_1, sd->status.party_id, &flag), - sd->bl.bl_m, sd->bl.bl_x - AREA_SIZE, sd->bl.bl_y - AREA_SIZE, - sd->bl.bl_x + AREA_SIZE, sd->bl.bl_y + AREA_SIZE, + sd->bl_m, sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, + sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, -dx, -dy, BL::PC); if (flag) @@ -2858,7 +2858,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) if (sd == NULL) return; - if (sd->bl.bl_prev == NULL) + if (sd->bl_prev == NULL) return; bl = map_id2bl(sd->attacktarget); @@ -2870,7 +2870,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) // 同じmapでないなら攻撃しない // PCが死んでても攻撃しない - if (sd->bl.bl_m != bl->bl_m || pc_isdead(sd)) + if (sd->bl_m != bl->bl_m || pc_isdead(sd)) return; // 異常などで攻撃できない @@ -2903,7 +2903,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) } else { - dist = distance(sd->bl.bl_x, sd->bl.bl_y, bl->bl_x, bl->bl_y); + dist = distance(sd->bl_x, sd->bl_y, bl->bl_x, bl->bl_y); range = sd->attackrange; if (sd->status.weapon != ItemLook::BOW) range++; @@ -2914,7 +2914,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) return; } - if (dist <= range && !battle_check_range(&sd->bl, bl, range)) + if (dist <= range && !battle_check_range(sd, bl, range)) { if (pc_can_reach(sd, bl->bl_x, bl->bl_y) && sd->canmove_tick < tick) // TMW client doesn't support this @@ -2925,7 +2925,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) else { if (battle_config.pc_attack_direction_change) - sd->dir = sd->head_dir = map_calc_dir(&sd->bl, bl->bl_x, bl->bl_y); // 向き設定 + sd->dir = sd->head_dir = map_calc_dir(sd, bl->bl_x, bl->bl_y); // 向き設定 if (sd->walktimer) pc_stop_walking(sd, 1); @@ -2933,7 +2933,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) { MapBlockLock lock; pc_stop_walking(sd, 0); - sd->attacktarget_lv = battle_weapon_attack(&sd->bl, bl, tick); + sd->attacktarget_lv = battle_weapon_attack(sd, bl, tick); sd->attackabletime = tick + (sd->aspd * 2); } if (sd->attackabletime <= tick) @@ -2945,7 +2945,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) { sd->attacktimer = Timer(sd->attackabletime, std::bind(pc_attack_timer, ph::_1, ph::_2, - sd->bl.bl_id)); + sd->bl_id)); } } @@ -2970,7 +2970,7 @@ int pc_attack(struct map_session_data *sd, int target_id, int type) return 0; } - if (!battle_check_target(&sd->bl, bl, BCT_ENEMY)) + if (!battle_check_target(sd, bl, BCT_ENEMY)) return 1; if (sd->attacktimer) pc_stopattack(sd); @@ -2982,12 +2982,12 @@ int pc_attack(struct map_session_data *sd, int target_id, int type) { // 攻撃delay中 sd->attacktimer = Timer(sd->attackabletime, std::bind(pc_attack_timer, ph::_1, ph::_2, - sd->bl.bl_id)); + sd->bl_id)); } else { // 本来timer関数なので引数を合わせる - pc_attack_timer(nullptr, gettick(), sd->bl.bl_id); + pc_attack_timer(nullptr, gettick(), sd->bl_id); } return 0; @@ -3029,7 +3029,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) pc_calcstatus(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); - clif_misceffect(&sd->bl, 0); + clif_misceffect(sd, 0); //レベルアップしたのでパーティー情報を更新する //(公平範囲チェック) party_send_movemap(sd); @@ -3095,7 +3095,7 @@ int pc_checkjoblevelup(struct map_session_data *sd) && sd->status.job_level < sd->status.base_level * 2) sd->status.job_level++; // Make levelling up a little harder - clif_misceffect(&sd->bl, 1); + clif_misceffect(sd, 1); return 1; } @@ -3107,10 +3107,10 @@ int pc_gainexp_reason(struct map_session_data *sd, int base_exp, int job_exp, { nullpo_ret(sd); - if (sd->bl.bl_prev == NULL || pc_isdead(sd)) + if (sd->bl_prev == NULL || pc_isdead(sd)) return 0; - if ((battle_config.pvp_exp == 0) && map[sd->bl.bl_m].flag.pvp) // [MouseJstr] + if ((battle_config.pvp_exp == 0) && map[sd->bl_m].flag.pvp) // [MouseJstr] return 0; // no exp on pvp maps earray<const char *, PC_GAINEXP_REASON, PC_GAINEXP_REASON::COUNT> reasons //= @@ -3536,7 +3536,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, pc_stop_walking(sd, 3); // 演奏/ダンスの中断 if (damage > sd->status.max_hp >> 2) - skill_stop_dancing(&sd->bl, 0); + skill_stop_dancing(sd, 0); sd->status.hp -= damage; @@ -3570,10 +3570,10 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, pc_setdead(sd); pc_stop_walking(sd, 0); - skill_castcancel(&sd->bl, 0); // 詠唱の中止 - clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); + skill_castcancel(sd, 0); // 詠唱の中止 + clif_clearchar(sd, BeingRemoveWhy::DEAD); pc_setglobalreg(sd, "PC_DIE_COUNTER", ++sd->die_counter); //死にカウンター書き込み - skill_status_change_clear(&sd->bl, 0); // ステータス異常を解除する + skill_status_change_clear(sd, 0); // ステータス異常を解除する clif_updatestatus(sd, SP::HP); pc_calcstatus(sd, 0); // [Fate] Reset magic @@ -3588,7 +3588,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, if (battle_config.death_penalty_type > 0 && sd->status.base_level >= 20) { // changed penalty options, added death by player if pk_mode [Valaris] - if (!map[sd->bl.bl_m].flag.nopenalty) + if (!map[sd->bl_m].flag.nopenalty) { if (battle_config.death_penalty_type == 1 && battle_config.death_penalty_base > 0) @@ -3643,10 +3643,10 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, } // pvp - if (map[sd->bl.bl_m].flag.pvp && !battle_config.pk_mode) + if (map[sd->bl_m].flag.pvp && !battle_config.pk_mode) { // disable certain pvp functions on pk_mode [Valaris] //ランキング計算 - if (!map[sd->bl.bl_m].flag.pvp_nocalcrank) + if (!map[sd->bl_m].flag.pvp_nocalcrank) { sd->pvp_point -= 5; if (src && src->bl_type == BL::PC) @@ -3672,13 +3672,13 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, arg[0].name = "@killerrid"; arg[0].v.i = src->bl_id; arg[1].name = "@victimrid"; - arg[1].v.i = sd->bl.bl_id; + arg[1].v.i = sd->bl_id; arg[2].name = "@victimlvl"; arg[2].v.i = sd->status.base_level; - npc_event_doall_l("OnPCKilledEvent", sd->bl.bl_id, 3, arg); + npc_event_doall_l("OnPCKilledEvent", sd->bl_id, 3, arg); npc_event_doall_l("OnPCKillEvent", src->bl_id, 3, arg); } - npc_event_doall_l("OnPCDieEvent", sd->bl.bl_id, 0, NULL); + npc_event_doall_l("OnPCDieEvent", sd->bl_id, 0, NULL); return 0; } @@ -3804,7 +3804,7 @@ int pc_setparam(struct map_session_data *sd, SP type, int val) clif_updatestatus(sd, SP::JOBEXP); clif_updatestatus(sd, SP::SKILLPOINT); pc_calcstatus(sd, 0); - clif_misceffect(&sd->bl, 1); + clif_misceffect(sd, 1); } else { @@ -4157,7 +4157,7 @@ int pc_changelook(struct map_session_data *sd, LOOK type, int val) case LOOK::SHOES: break; } - clif_changelook(&sd->bl, type, val); + clif_changelook(sd, type, val); return 0; } @@ -4171,7 +4171,7 @@ int pc_setoption(struct map_session_data *sd, Option type) nullpo_ret(sd); sd->status.option = type; - clif_changeoption(&sd->bl); + clif_changeoption(sd); pc_calcstatus(sd, 0); return 0; @@ -4509,7 +4509,7 @@ int pc_addeventtimer(struct map_session_data *sd, interval_t tick, const char *n strzcpy(evname, name, 24); sd->eventtimer[i] = Timer(gettick() + tick, std::bind(pc_eventtimer, ph::_1, ph::_2, - sd->bl.bl_id, evname)); + sd->bl_id, evname)); return 1; } @@ -4541,15 +4541,15 @@ static int pc_signal_advanced_equipment_change(struct map_session_data *sd, int n) { if (bool(sd->status.inventory[n].equip & EPOS::SHOES)) - clif_changelook(&sd->bl, LOOK::SHOES, 0); + clif_changelook(sd, LOOK::SHOES, 0); if (bool(sd->status.inventory[n].equip & EPOS::GLOVES)) - clif_changelook(&sd->bl, LOOK::GLOVES, 0); + clif_changelook(sd, LOOK::GLOVES, 0); if (bool(sd->status.inventory[n].equip & EPOS::CAPE)) - clif_changelook(&sd->bl, LOOK::CAPE, 0); + clif_changelook(sd, LOOK::CAPE, 0); if (bool(sd->status.inventory[n].equip & EPOS::MISC1)) - clif_changelook(&sd->bl, LOOK::MISC1, 0); + clif_changelook(sd, LOOK::MISC1, 0); if (bool(sd->status.inventory[n].equip & EPOS::MISC2)) - clif_changelook(&sd->bl, LOOK::MISC2, 0); + clif_changelook(sd, LOOK::MISC2, 0); return 0; } @@ -4668,22 +4668,22 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS) sd->weapontype2 = ItemLook::NONE; } pc_calcweapontype(sd); - clif_changelook(&sd->bl, LOOK::SHIELD, sd->status.shield); + clif_changelook(sd, LOOK::SHIELD, sd->status.shield); } if (bool(sd->status.inventory[n].equip & EPOS::LEGS)) { sd->status.head_bottom = view_i; - clif_changelook(&sd->bl, LOOK::HEAD_BOTTOM, sd->status.head_bottom); + clif_changelook(sd, LOOK::HEAD_BOTTOM, sd->status.head_bottom); } if (bool(sd->status.inventory[n].equip & EPOS::HAT)) { sd->status.head_top = view_i; - clif_changelook(&sd->bl, LOOK::HEAD_TOP, sd->status.head_top); + clif_changelook(sd, LOOK::HEAD_TOP, sd->status.head_top); } if (bool(sd->status.inventory[n].equip & EPOS::TORSO)) { sd->status.head_mid = view_i; - clif_changelook(&sd->bl, LOOK::HEAD_MID, sd->status.head_mid); + clif_changelook(sd, LOOK::HEAD_MID, sd->status.head_mid); } pc_signal_advanced_equipment_change(sd, n); @@ -4725,30 +4725,30 @@ int pc_unequipitem(struct map_session_data *sd, int n, CalcStatus type) sd->status.shield = 0; sd->weapontype2 = ItemLook::NONE; pc_calcweapontype(sd); - clif_changelook(&sd->bl, LOOK::SHIELD, sd->status.shield); + clif_changelook(sd, LOOK::SHIELD, sd->status.shield); } if (bool(sd->status.inventory[n].equip & EPOS::LEGS)) { sd->status.head_bottom = 0; - clif_changelook(&sd->bl, LOOK::HEAD_BOTTOM, + clif_changelook(sd, LOOK::HEAD_BOTTOM, sd->status.head_bottom); } if (bool(sd->status.inventory[n].equip & EPOS::HAT)) { sd->status.head_top = 0; - clif_changelook(&sd->bl, LOOK::HEAD_TOP, sd->status.head_top); + clif_changelook(sd, LOOK::HEAD_TOP, sd->status.head_top); } if (bool(sd->status.inventory[n].equip & EPOS::TORSO)) { sd->status.head_mid = 0; - clif_changelook(&sd->bl, LOOK::HEAD_MID, sd->status.head_mid); + clif_changelook(sd, LOOK::HEAD_MID, sd->status.head_mid); } pc_signal_advanced_equipment_change(sd, n); if (sd->sc_data[StatusChange::SC_BROKNWEAPON].timer && bool(sd->status.inventory[n].equip & EPOS::WEAPON) && sd->status.inventory[n].broken == 1) - skill_status_change_end(&sd->bl, StatusChange::SC_BROKNWEAPON, nullptr); + skill_status_change_end(sd, StatusChange::SC_BROKNWEAPON, nullptr); clif_unequipitemack(sd, n, sd->status.inventory[n].equip, 1); sd->status.inventory[n].equip = EPOS::ZERO; @@ -4805,7 +4805,7 @@ int pc_checkitem(struct map_session_data *sd) { if (battle_config.error_log) PRINTF("illeagal item id %d in %d[%s] inventory.\n", id, - sd->bl.bl_id, sd->status.name); + sd->bl_id, sd->status.name); pc_delitem(sd, i, sd->status.inventory[i].amount, 3); continue; } @@ -4832,7 +4832,7 @@ int pc_checkitem(struct map_session_data *sd) { if (battle_config.error_log) PRINTF("illeagal item id %d in %d[%s] cart.\n", id, - sd->bl.bl_id, sd->status.name); + sd->bl_id, sd->status.name); pc_cart_delitem(sd, i, sd->status.cart[i].amount, 1); continue; } @@ -4863,7 +4863,7 @@ int pc_checkitem(struct map_session_data *sd) } //装備制限チェック if (bool(sd->status.inventory[i].equip) - && map[sd->bl.bl_m].flag.pvp + && map[sd->bl_m].flag.pvp && (it->flag.no_equip == 1 || it->flag.no_equip == 3)) { //PvP制限 sd->status.inventory[i].equip = EPOS::ZERO; @@ -4936,14 +4936,14 @@ int pc_calc_pvprank(struct map_session_data *sd) struct map_data *m; nullpo_ret(sd); - m = &map[sd->bl.bl_m]; + m = &map[sd->bl_m]; nullpo_ret(m); if (!(m->flag.pvp)) return 0; sd->pvp_rank = 1; map_foreachinarea(std::bind(pc_calc_pvprank_sub, ph::_1, sd), - sd->bl.bl_m, 0, 0, m->xs, m->ys, + sd->bl_m, 0, 0, m->xs, m->ys, BL::PC); return sd->pvp_rank; } @@ -5460,15 +5460,15 @@ void pc_invisibility(struct map_session_data *sd, int enabled) { if (enabled && !bool(sd->status.option & Option::INVISIBILITY)) { - clif_clearchar(&sd->bl, BeingRemoveWhy::WARPED); + clif_clearchar(sd, BeingRemoveWhy::WARPED); sd->status.option |= Option::INVISIBILITY; - clif_status_change(&sd->bl, StatusChange::CLIF_OPTION_SC_INVISIBILITY, 1); + clif_status_change(sd, StatusChange::CLIF_OPTION_SC_INVISIBILITY, 1); } else if (!enabled) { sd->status.option &= ~Option::INVISIBILITY; - clif_status_change(&sd->bl, StatusChange::CLIF_OPTION_SC_INVISIBILITY, 0); - pc_setpos(sd, map[sd->bl.bl_m].name, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::WARPED); + clif_status_change(sd, StatusChange::CLIF_OPTION_SC_INVISIBILITY, 0); + pc_setpos(sd, map[sd->bl_m].name, sd->bl_x, sd->bl_y, BeingRemoveWhy::WARPED); } } diff --git a/src/map/script.cpp b/src/map/script.cpp index 0c56bc7..dfb6dbe 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -1619,8 +1619,8 @@ void builtin_isat(ScriptState *st) return; push_val(st->stack, ScriptCode::INT, - (x == sd->bl.bl_x) - && (y == sd->bl.bl_y) && (!strcmp(str, map[sd->bl.bl_m].name))); + (x == sd->bl_x) + && (y == sd->bl_y) && (!strcmp(str, map[sd->bl_m].name))); } @@ -1641,7 +1641,7 @@ void builtin_warp(ScriptState *st) pc_randomwarp(sd, BeingRemoveWhy::WARPED); else if (strcmp(str, "SavePoint") == 0) { - if (map[sd->bl.bl_m].flag.noreturn) // 蝶禁止 + if (map[sd->bl_m].flag.noreturn) // 蝶禁止 return; pc_setpos(sd, sd->status.save_point.map, @@ -1649,7 +1649,7 @@ void builtin_warp(ScriptState *st) } else if (strcmp(str, "Save") == 0) { - if (map[sd->bl.bl_m].flag.noreturn) // 蝶禁止 + if (map[sd->bl_m].flag.noreturn) // 蝶禁止 return; pc_setpos(sd, sd->status.save_point.map, @@ -2138,7 +2138,7 @@ void builtin_getitem(ScriptState *st) { clif_additem(sd, 0, 0, flag); map_addflooritem(&item_tmp, amount, - sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, + sd->bl_m, sd->bl_x, sd->bl_y, NULL, NULL, NULL); } } @@ -2179,7 +2179,7 @@ void builtin_makeitem(ScriptState *st) y = conv_num(st, &(st->stack->stack_data[st->start + 6])); if (sd && strcmp(mapname, "this") == 0) - m = sd->bl.bl_m; + m = sd->bl_m; else m = map_mapname2mapid(mapname); @@ -2601,7 +2601,7 @@ void builtin_setopt2(ScriptState *st) if (new_opt2 == sd->opt2) return; sd->opt2 = new_opt2; - clif_changeoption(&sd->bl); + clif_changeoption(sd); pc_calcstatus(sd, 0); } @@ -3129,7 +3129,7 @@ void builtin_getareadropitem_sub_anddelete(struct block_list *bl, int item, int if (drop->item_data.nameid == item) { (*amount) += drop->item_data.amount; clif_clearflooritem(drop, 0); - map_delobject(drop->bl.bl_id, drop->bl.bl_type); + map_delobject(drop->bl_id, drop->bl_type); } } @@ -3567,11 +3567,11 @@ void builtin_pvpon(ScriptState *st) map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd && pl_sd->state.auth) { - if (m == pl_sd->bl.bl_m && !pl_sd->pvp_timer) + if (m == pl_sd->bl_m && !pl_sd->pvp_timer) { pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200), std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, - pl_sd->bl.bl_id)); + pl_sd->bl_id)); pl_sd->pvp_rank = 0; pl_sd->pvp_lastusers = 0; pl_sd->pvp_point = 5; @@ -3601,7 +3601,7 @@ void builtin_pvpoff(ScriptState *st) map_session_data *pl_sd = static_cast<map_session_data *>(session[i]->session_data.get()); if (pl_sd && pl_sd->state.auth) { - if (m == pl_sd->bl.bl_m) + if (m == pl_sd->bl_m) { pl_sd->pvp_timer.cancel(); } @@ -3933,7 +3933,7 @@ void builtin_misceffect(ScriptState *st) { struct map_session_data *sd = map_nick2sd(name); if (sd) - bl = &sd->bl; + bl = sd; } else if (id) bl = map_id2bl(id); @@ -3943,7 +3943,7 @@ void builtin_misceffect(ScriptState *st) { struct map_session_data *sd = script_rid2sd(st); if (sd) - bl = &sd->bl; + bl = sd; } if (bl) @@ -3978,7 +3978,7 @@ void builtin_specialeffect2(ScriptState *st) if (sd == NULL) return; - clif_specialeffect(&sd->bl, + clif_specialeffect(sd, conv_num(st, &(st->stack->stack_data[st->start + 2])), 0); @@ -4065,19 +4065,19 @@ void builtin_npcwarp(ScriptState *st) if (!nd) return; - short m = nd->bl.bl_m; + short m = nd->bl_m; /* Crude sanity checks. */ - if (m < 0 || !nd->bl.bl_prev + if (m < 0 || !nd->bl_prev || x < 0 || x > map[m].xs -1 || y < 0 || y > map[m].ys - 1) return; npc_enable(npc, 0); - map_delblock(&nd->bl); /* [Freeyorp] */ - nd->bl.bl_x = x; - nd->bl.bl_y = y; - map_addblock(&nd->bl); + map_delblock(nd); /* [Freeyorp] */ + nd->bl_x = x; + nd->bl_y = y; + map_addblock(nd); npc_enable(npc, 1); } @@ -4120,7 +4120,7 @@ void builtin_npctalk(ScriptState *st) memcpy(message, nd->name, 24); strcat(message, " : "); strcat(message, str); - clif_message(&nd->bl, message); + clif_message(nd, message); } } @@ -4253,9 +4253,9 @@ void builtin_isin(ScriptState *st) return; push_val(st->stack, ScriptCode::INT, - (sd->bl.bl_x >= x1 && sd->bl.bl_x <= x2) - && (sd->bl.bl_y >= y1 && sd->bl.bl_y <= y2) - && (!strcmp(str, map[sd->bl.bl_m].name))); + (sd->bl_x >= x1 && sd->bl_x <= x2) + && (sd->bl_y >= y1 && sd->bl_y <= y2) + && (!strcmp(str, map[sd->bl_m].name))); } @@ -4274,7 +4274,7 @@ void builtin_shop(ScriptState *st) return; builtin_close(st); - clif_npcbuysell(sd, nd->bl.bl_id); + clif_npcbuysell(sd, nd->bl_id); } /*========================================== @@ -4320,7 +4320,7 @@ void builtin_getx(ScriptState *st) { struct map_session_data *sd = script_rid2sd(st); - push_val(st->stack, ScriptCode::INT, sd->bl.bl_x); + push_val(st->stack, ScriptCode::INT, sd->bl_x); } /*============================ @@ -4332,7 +4332,7 @@ void builtin_gety(ScriptState *st) { struct map_session_data *sd = script_rid2sd(st); - push_val(st->stack, ScriptCode::INT, sd->bl.bl_y); + push_val(st->stack, ScriptCode::INT, sd->bl_y); } /* @@ -4344,7 +4344,7 @@ void builtin_getmap(ScriptState *st) struct map_session_data *sd = script_rid2sd(st); // A map_data lives essentially forever. - push_str(st->stack, ScriptCode::CONSTSTR, map[sd->bl.bl_m].name); + push_str(st->stack, ScriptCode::CONSTSTR, map[sd->bl_m].name); } // diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp index 65b8ae0..ab0f856 100644 --- a/src/map/skill-pools.cpp +++ b/src/map/skill-pools.cpp @@ -103,7 +103,7 @@ int skill_power(struct map_session_data *sd, SkillID skill_id) if (stat == SP::ZERO || !skill_pool_is_activated(sd, skill_id)) return 0; - stat_value = battle_get_stat(stat, &(sd->bl)); + stat_value = battle_get_stat(stat, sd); skill_value = sd->status.skill[skill_id].lv; if ((skill_value * 10) - 1 > stat_value) diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 724228a..66f1e4c 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -541,7 +541,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, case SkillID::NPC_EMOTION: if (md) - clif_emotion(&md->bl, + clif_emotion(md, mob_db[md->mob_class].skill[md->skillidx].val[0]); break; } @@ -676,8 +676,8 @@ void skill_devotion(struct map_session_data *md, int) struct map_session_data *sd = map_id2sd(md->dev.val1[n]); // 相手が見つからない // 相手をディボしてるのが自分じゃない // 距離が離れてる if (sd == NULL - || (md->bl.bl_id != 0/* was something else - TODO remove this */) - || skill_devotion3(&md->bl, md->dev.val1[n])) + || (md->bl_id != 0/* was something else - TODO remove this */) + || skill_devotion3(md, md->dev.val1[n])) { skill_devotion_end(md, sd, n); } @@ -698,7 +698,7 @@ int skill_devotion3(struct block_list *bl, int target) || (sd = map_id2sd(target)) == NULL) return 1; else - r = distance(bl->bl_x, bl->bl_y, sd->bl.bl_x, sd->bl.bl_y); + r = distance(bl->bl_x, bl->bl_y, sd->bl_x, sd->bl_y); if ( + 6 < r) { // 許容範囲を超えてた @@ -867,7 +867,7 @@ int skill_update_heal_animation(struct map_session_data *sd) else sd->opt2 &= ~mask; - return clif_changeoption(&sd->bl); + return clif_changeoption(sd); } /*========================================== diff --git a/src/map/trade.cpp b/src/map/trade.cpp index 13f7a4d..ba789c3 100644 --- a/src/map/trade.cpp +++ b/src/map/trade.cpp @@ -45,11 +45,11 @@ void trade_traderequest(struct map_session_data *sd, int target_id) } else { - if (sd->bl.bl_m != target_sd->bl.bl_m - || (sd->bl.bl_x - target_sd->bl.bl_x <= -5 - || sd->bl.bl_x - target_sd->bl.bl_x >= 5) - || (sd->bl.bl_y - target_sd->bl.bl_y <= -5 - || sd->bl.bl_y - target_sd->bl.bl_y >= 5)) + if (sd->bl_m != target_sd->bl_m + || (sd->bl_x - target_sd->bl_x <= -5 + || sd->bl_x - target_sd->bl_x >= 5) + || (sd->bl_y - target_sd->bl_y <= -5 + || sd->bl_y - target_sd->bl_y >= 5)) { clif_tradestart(sd, 0); //too far } |