diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-05-23 13:58:57 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-05-23 13:58:57 -0700 |
commit | 543e4b419239f37321bc5a224d56773d1fe6ebfe (patch) | |
tree | b1af74736f9ecaf4e7b7770c9fbff59e971d3f4b /src/map | |
parent | cce12d0d059b3328ad74446b389445bd43e0a90b (diff) | |
download | tmwa-543e4b419239f37321bc5a224d56773d1fe6ebfe.tar.gz tmwa-543e4b419239f37321bc5a224d56773d1fe6ebfe.tar.bz2 tmwa-543e4b419239f37321bc5a224d56773d1fe6ebfe.tar.xz tmwa-543e4b419239f37321bc5a224d56773d1fe6ebfe.zip |
Rename fields of block_list in preparation for subclassing
This is necessary because at least some of the subclasses overlap names.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.cpp | 160 | ||||
-rw-r--r-- | src/map/battle.cpp | 286 | ||||
-rw-r--r-- | src/map/chrif.cpp | 20 | ||||
-rw-r--r-- | src/map/clif.cpp | 226 | ||||
-rw-r--r-- | src/map/intif.cpp | 10 | ||||
-rw-r--r-- | src/map/magic-expr-eval.hpp | 2 | ||||
-rw-r--r-- | src/map/magic-expr.cpp | 20 | ||||
-rw-r--r-- | src/map/magic-interpreter-base.cpp | 30 | ||||
-rw-r--r-- | src/map/magic-stmt.cpp | 117 | ||||
-rw-r--r-- | src/map/map.cpp | 222 | ||||
-rw-r--r-- | src/map/map.hpp | 12 | ||||
-rw-r--r-- | src/map/mob.cpp | 460 | ||||
-rw-r--r-- | src/map/npc.cpp | 164 | ||||
-rw-r--r-- | src/map/party.cpp | 26 | ||||
-rw-r--r-- | src/map/pc.cpp | 224 | ||||
-rw-r--r-- | src/map/script.cpp | 44 | ||||
-rw-r--r-- | src/map/skill-pools.cpp | 2 | ||||
-rw-r--r-- | src/map/skill.cpp | 116 | ||||
-rw-r--r-- | src/map/trade.cpp | 10 |
19 files changed, 1077 insertions, 1074 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index e4ec17b..fe12acf 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.m].name, sd->bl.x, sd->bl.y, + map[sd->bl.bl_m].name, sd->bl.bl_x, sd->bl.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.m >= 0 && map[pl_sd->bl.m].flag.nowarp + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarp + if (sd->bl.bl_m >= 0 && map[sd->bl.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.x, pl_sd->bl.y); + pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.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.m >= 0 && map[pl_sd->bl.m].flag.nowarpto + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarp + if (sd->bl.bl_m >= 0 && map[sd->bl.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.x, pl_sd->bl.y, BeingRemoveWhy::WARPED); + pc_setpos(sd, pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarpto + if (sd->bl.bl_m >= 0 && map[sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarp + if (sd->bl.bl_m >= 0 && map[sd->bl.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.x, pl_sd->bl.y); + pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); else output = STRPRINTF( "Name: %s | Location: %s %d %d", pl_sd->status.name, pl_sd->mapname, - pl_sd->bl.x, pl_sd->bl.y); + pl_sd->bl.bl_x, pl_sd->bl.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.m; + map_id = sd->bl.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.m; + map_id = sd->bl.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.m == map_id) + if (pl_sd->bl.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.x, pl_sd->bl.y); + pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.bl_y); else output = STRPRINTF( "Name: %s | Location: %s %d %d", pl_sd->status.name, pl_sd->mapname, - pl_sd->bl.x, pl_sd->bl.y); + pl_sd->bl.bl_x, pl_sd->bl.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.m; + map_id = sd->bl.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.m; + map_id = sd->bl.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.m == map_id) + if (pl_sd->bl.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.x, pl_sd->bl.y); + pl_sd->mapname, pl_sd->bl.bl_x, pl_sd->bl.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.x, sd->bl.y); + pc_setsavepoint(sd, sd->mapname, sd->bl.bl_x, sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarp + if (sd->bl.bl_m >= 0 && map[sd->bl.bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, @@ -1893,9 +1893,9 @@ int atcommand_pvpoff(const int fd, struct map_session_data *sd, return -1; } - if (map[sd->bl.m].flag.pvp) + if (map[sd->bl.bl_m].flag.pvp) { - map[sd->bl.m].flag.pvp = 0; + map[sd->bl.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.m == pl_sd->bl.m) + if (sd->bl.bl_m == pl_sd->bl.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.m].flag.pvp && !map[sd->bl.m].flag.nopvp) + if (!map[sd->bl.bl_m].flag.pvp && !map[sd->bl.bl_m].flag.nopvp) { - map[sd->bl.m].flag.pvp = 1; + map[sd->bl.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.m == pl_sd->bl.m && !pl_sd->pvp_timer) + if (sd->bl.bl_m == pl_sd->bl.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.id)); + std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl.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.x + random_::in(-range / 2, range / 2 ); + mx = sd->bl.bl_x + random_::in(-range / 2, range / 2 ); else mx = x; if (y <= 0) - my = sd->bl.y + random_::in(-range / 2, range / 2); + my = sd->bl.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.m; + map_id = sd->bl.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.m; + map_id = sd->bl.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.m, sd->bl.x - 1, sd->bl.y - 1, - sd->bl.x + 1, sd->bl.x + 1, BL::PC); + 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); 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.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)); + 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)); clif_displaymessage(fd, output); } @@ -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.m >= 0 && map[sd->bl.m].flag.nowarpto + if (sd->bl.bl_m >= 0 && map[sd->bl.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.m >= 0 && map[pl_sd->bl.m].flag.nowarp + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.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.x, sd->bl.y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::QUIT); std::string output = STRPRINTF("%s recalled!", character); clif_displaymessage(fd, output); } @@ -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.m == pl_sd->bl.m + && pl_sd->state.auth && i != fd && sd->bl.bl_m == pl_sd->bl.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); @@ -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.m == pl_sd->bl.m) + && pl_sd->state.auth && sd->bl.bl_m == pl_sd->bl.bl_m) atcommand_raise_sub(pl_sd); } clif_displaymessage(fd, "Mercy has been granted."); @@ -4256,7 +4256,7 @@ int atcommand_recallall(const int fd, struct map_session_data *sd, { int count; - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto + if (sd->bl.bl_m >= 0 && map[sd->bl.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.m >= 0 && map[pl_sd->bl.m].flag.nowarp + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) count++; else - pc_setpos(pl_sd, sd->mapname, sd->bl.x, sd->bl.y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::QUIT); } } @@ -4316,7 +4316,7 @@ int atcommand_partyrecall(const int fd, struct map_session_data *sd, return -1; } - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto + if (sd->bl.bl_m >= 0 && map[sd->bl.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.m >= 0 && map[pl_sd->bl.m].flag.nowarp + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.bl_m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) count++; else - pc_setpos(pl_sd, sd->mapname, sd->bl.x, sd->bl.y, BeingRemoveWhy::QUIT); + pc_setpos(pl_sd, sd->mapname, sd->bl.bl_x, sd->bl.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.x, pl_sd->bl.y); + pl_sd->status.name, i, pl_sd->bl.bl_x, pl_sd->bl.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.x, - nd->bl.y); + ++i, nd->name, direction, nd->npc_class, nd->bl.bl_x, + nd->bl.bl_y); clif_displaymessage(fd, output); } break; @@ -5681,8 +5681,8 @@ int atcommand_npcmove(const int, struct map_session_data *sd, return -1; npc_enable(character, 0); - nd->bl.x = x; - nd->bl.y = y; + nd->bl.bl_x = x; + nd->bl.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.x, sd->bl.y); - std::string w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl.x, sd->bl.y, x, y); + 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 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()); @@ -5900,10 +5900,10 @@ 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.m].flag.rain) + if (effno < 0 || map[sd->bl.bl_m].flag.rain) return -1; - map[sd->bl.m].flag.rain = 1; + map[sd->bl.bl_m].flag.rain = 1; clif_specialeffect(&sd->bl, effno, 2); return 0; } @@ -5918,10 +5918,10 @@ 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.m].flag.snow) + if (effno < 0 || map[sd->bl.bl_m].flag.snow) return -1; - map[sd->bl.m].flag.snow = 1; + map[sd->bl.bl_m].flag.snow = 1; clif_specialeffect(&sd->bl, effno, 2); return 0; } @@ -5936,10 +5936,10 @@ 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.m].flag.sakura) + if (effno < 0 || map[sd->bl.bl_m].flag.sakura) return -1; - map[sd->bl.m].flag.sakura = 1; + map[sd->bl.bl_m].flag.sakura = 1; clif_specialeffect(&sd->bl, effno, 2); return 0; } @@ -5954,10 +5954,10 @@ 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.m].flag.fog) + if (effno < 0 || map[sd->bl.bl_m].flag.fog) return -1; - map[sd->bl.m].flag.fog = 1; + map[sd->bl.bl_m].flag.fog = 1; clif_specialeffect(&sd->bl, effno, 2); return 0; @@ -5973,10 +5973,10 @@ 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.m].flag.leaves) + if (effno < 0 || map[sd->bl.bl_m].flag.leaves) return -1; - map[sd->bl.m].flag.leaves = 1; + map[sd->bl.bl_m].flag.leaves = 1; clif_specialeffect(&sd->bl, effno, 2); return 0; } @@ -6008,13 +6008,13 @@ int atcommand_summon(const int, struct map_session_data *sd, if (mob_id == 0) return -1; - x = sd->bl.x + random_::in(-5, 4); - y = sd->bl.y + random_::in(-5, 4); + x = sd->bl.bl_x + random_::in(-5, 4); + y = sd->bl.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.id; + md->master_id = sd->bl.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), @@ -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.id); + trade_traderequest(sd, pl_sd->bl.bl_id); return 0; } return -1; @@ -6300,25 +6300,25 @@ int atcommand_jump_iterate(const int fd, struct map_session_data *sd, pl_sd = get_start(); } - if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto + if (pl_sd->bl.bl_m >= 0 && map[pl_sd->bl.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.m >= 0 && map[sd->bl.m].flag.nowarp + if (sd->bl.bl_m >= 0 && map[sd->bl.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.m].name, pl_sd->bl.x, pl_sd->bl.y, BeingRemoveWhy::WARPED); + pc_setpos(sd, map[pl_sd->bl.bl_m].name, pl_sd->bl.bl_x, pl_sd->bl.bl_y, BeingRemoveWhy::WARPED); std::string output = STRPRINTF("Jump to %s", pl_sd->status.name); clif_displaymessage(fd, output); - sd->followtarget = pl_sd->bl.id; + sd->followtarget = pl_sd->bl.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.x, pl_sd->bl.y); + pl_sd->bl.bl_x, pl_sd->bl.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.m == pl_sd->bl.m - && sd->bl.x == pl_sd->bl.x && sd->bl.y == pl_sd->bl.y + && 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 && 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 6f01ac7..e0706dc 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -29,10 +29,10 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src, ATK target_lv) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return pc_counttargeted((struct map_session_data *) bl, src, target_lv); - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) return mob_counttargeted((struct mob_data *) bl, src, target_lv); return 0; } @@ -45,9 +45,9 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src, int battle_get_class(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return ((struct mob_data *) bl)->mob_class; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return 0; else return 0; @@ -61,9 +61,9 @@ int battle_get_class(struct block_list *bl) DIR battle_get_dir(struct block_list *bl) { nullpo_retr(DIR::S, bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return ((struct mob_data *) bl)->dir; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->dir; else return DIR::S; @@ -77,9 +77,9 @@ DIR battle_get_dir(struct block_list *bl) int battle_get_lv(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return ((struct mob_data *) bl)->stats[mob_stat::LV]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->status.base_level; else return 0; @@ -93,9 +93,9 @@ int battle_get_lv(struct block_list *bl) int battle_get_range(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return mob_db[((struct mob_data *) bl)->mob_class].range; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->attackrange; else return 0; @@ -109,9 +109,9 @@ int battle_get_range(struct block_list *bl) int battle_get_hp(struct block_list *bl) { nullpo_retr(1, bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return ((struct mob_data *) bl)->hp; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->status.hp; else return 1; @@ -125,12 +125,12 @@ int battle_get_hp(struct block_list *bl) int battle_get_max_hp(struct block_list *bl) { nullpo_retr(1, bl); - if (bl->type == BL::PC && ((struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && ((struct map_session_data *) bl)) return ((struct map_session_data *) bl)->status.max_hp; else { int max_hp = 1; - if (bl->type == BL::MOB && ((struct mob_data *) bl)) + if (bl->bl_type == BL::MOB && ((struct mob_data *) bl)) { max_hp = ((struct mob_data *) bl)->stats[mob_stat::MAX_HP]; { @@ -156,9 +156,9 @@ int battle_get_str(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB && ((struct mob_data *) bl)) + if (bl->bl_type == BL::MOB && ((struct mob_data *) bl)) str = ((struct mob_data *) bl)->stats[mob_stat::STR]; - else if (bl->type == BL::PC && ((struct map_session_data *) bl)) + else if (bl->bl_type == BL::PC && ((struct map_session_data *) bl)) return ((struct map_session_data *) bl)->paramc[ATTR::STR]; if (str < 0) @@ -179,9 +179,9 @@ int battle_get_agi(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) agi = ((struct mob_data *) bl)->stats[mob_stat::AGI]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) agi = ((struct map_session_data *) bl)->paramc[ATTR::AGI]; if (agi < 0) @@ -201,9 +201,9 @@ int battle_get_vit(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) vit = ((struct mob_data *) bl)->stats[mob_stat::VIT]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) vit = ((struct map_session_data *) bl)->paramc[ATTR::VIT]; if (vit < 0) @@ -223,9 +223,9 @@ int battle_get_int(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) int_ = ((struct mob_data *) bl)->stats[mob_stat::INT]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) int_ = ((struct map_session_data *) bl)->paramc[ATTR::INT]; if (int_ < 0) @@ -245,9 +245,9 @@ int battle_get_dex(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) dex = ((struct mob_data *) bl)->stats[mob_stat::DEX]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) dex = ((struct map_session_data *) bl)->paramc[ATTR::DEX]; if (dex < 0) @@ -267,9 +267,9 @@ int battle_get_luk(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) luk = ((struct mob_data *) bl)->stats[mob_stat::LUK]; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) luk = ((struct map_session_data *) bl)->paramc[ATTR::LUK]; if (luk < 0) @@ -290,7 +290,7 @@ int battle_get_flee(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) flee = ((struct map_session_data *) bl)->flee; else flee = battle_get_agi(bl) + battle_get_lv(bl); @@ -319,7 +319,7 @@ int battle_get_hit(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) hit = ((struct map_session_data *) bl)->hit; else hit = battle_get_dex(bl) + battle_get_lv(bl); @@ -347,7 +347,7 @@ int battle_get_flee2(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { flee2 = battle_get_luk(bl) + 10; flee2 += @@ -380,7 +380,7 @@ int battle_get_critical(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { critical = battle_get_luk(bl) * 2 + 10; critical += @@ -408,7 +408,7 @@ int battle_get_baseatk(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) batk = ((struct map_session_data *) bl)->base_atk; //設定されているbase_atk else { //それ以外なら @@ -435,9 +435,9 @@ int battle_get_atk(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) atk = ((struct map_session_data *) bl)->watk; - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) atk = ((struct mob_data *) bl)->stats[mob_stat::ATK1]; if (atk < 0) @@ -454,7 +454,7 @@ static int battle_get_atk_(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->watk_; else return 0; @@ -469,12 +469,12 @@ static int battle_get_atk2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->watk2; else { int atk2 = 0; - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) atk2 = ((struct mob_data *) bl)->stats[mob_stat::ATK2]; if (atk2 < 0) @@ -492,7 +492,7 @@ static int battle_get_atk_2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->watk_2; else return 0; @@ -509,14 +509,14 @@ int battle_get_matk1(struct block_list *bl) eptr<struct status_change, StatusChange> sc_data; nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { int matk, int_ = battle_get_int(bl); matk = int_ + (int_ / 5) * (int_ / 5); return matk; } - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->matk1; else return 0; @@ -531,14 +531,14 @@ static int battle_get_matk2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { int matk, int_ = battle_get_int(bl); matk = int_ + (int_ / 7) * (int_ / 7); return matk; } - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->matk2; else return 0; @@ -556,11 +556,11 @@ int battle_get_def(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { def = ((struct map_session_data *) bl)->def; } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { def = ((struct mob_data *) bl)->stats[mob_stat::DEF]; } @@ -571,7 +571,7 @@ int battle_get_def(struct block_list *bl) { //毒にかかっている時は減算 if (sc_data[StatusChange::SC_POISON].timer - && bl->type != BL::PC) + && bl->bl_type != BL::PC) def = def * 75 / 100; } } @@ -592,9 +592,9 @@ int battle_get_mdef(struct block_list *bl) nullpo_ret(bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) mdef = ((struct map_session_data *) bl)->mdef; - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) mdef = ((struct mob_data *) bl)->stats[mob_stat::MDEF]; if (mdef < 1000000) @@ -627,15 +627,15 @@ int battle_get_def2(struct block_list *bl) nullpo_retr(1, bl); sc_data = battle_get_sc_data(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) def2 = ((struct map_session_data *) bl)->def2; - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) def2 = ((struct mob_data *) bl)->stats[mob_stat::VIT]; if (sc_data) { if (sc_data[StatusChange::SC_POISON].timer - && bl->type != BL::PC) + && bl->bl_type != BL::PC) def2 = def2 * 75 / 100; } if (def2 < 1) @@ -653,11 +653,11 @@ int battle_get_mdef2(struct block_list *bl) int mdef2 = 0; nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) mdef2 = ((struct mob_data *) bl)->stats[mob_stat::INT] + (((struct mob_data *) bl)->stats[mob_stat::VIT] >> 1); - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) mdef2 = ((struct map_session_data *) bl)->mdef2 + (((struct map_session_data *) bl)->paramc[ATTR::VIT] >> 1); @@ -676,12 +676,12 @@ int battle_get_mdef2(struct block_list *bl) interval_t battle_get_speed(struct block_list *bl) { nullpo_retr(std::chrono::seconds(1), bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->speed; else { interval_t speed = std::chrono::seconds(1); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) speed = static_cast<interval_t>(((struct mob_data *) bl)->stats[mob_stat::SPEED]); return std::max(speed, std::chrono::milliseconds(1)); @@ -697,14 +697,14 @@ interval_t battle_get_speed(struct block_list *bl) interval_t battle_get_adelay(struct block_list *bl) { nullpo_retr(std::chrono::seconds(4), bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->aspd * 2; else { eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl); interval_t adelay = std::chrono::seconds(4); int aspd_rate = 100; - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) adelay = static_cast<interval_t>(((struct mob_data *) bl)->stats[mob_stat::ADELAY]); if (sc_data) @@ -725,14 +725,14 @@ interval_t battle_get_adelay(struct block_list *bl) interval_t battle_get_amotion(struct block_list *bl) { nullpo_retr(std::chrono::seconds(2), bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->amotion; else { eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl); interval_t amotion = std::chrono::seconds(2); int aspd_rate = 100; - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) amotion = static_cast<interval_t>(mob_db[((struct mob_data *) bl)->mob_class].amotion); if (sc_data) @@ -752,11 +752,11 @@ interval_t battle_get_amotion(struct block_list *bl) interval_t battle_get_dmotion(struct block_list *bl) { nullpo_retr(interval_t::zero(), bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { return static_cast<interval_t>(mob_db[((struct mob_data *) bl)->mob_class].dmotion); } - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) { return ((struct map_session_data *) bl)->dmotion; } @@ -769,7 +769,7 @@ LevelElement battle_get_element(struct block_list *bl) LevelElement ret = {2, Element::neutral}; nullpo_retr(ret, bl); - if (bl->type == BL::MOB) // 10の位=Lv*2、1の位=属性 + if (bl->bl_type == BL::MOB) // 10の位=Lv*2、1の位=属性 ret = ((struct mob_data *) bl)->def_ele; return ret; @@ -778,14 +778,14 @@ LevelElement battle_get_element(struct block_list *bl) int battle_get_party_id(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return ((struct map_session_data *) bl)->status.party_id; - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { struct mob_data *md = (struct mob_data *) bl; if (md->master_id > 0) return -md->master_id; - return -md->bl.id; + return -md->bl.bl_id; } return 0; } @@ -793,9 +793,9 @@ int battle_get_party_id(struct block_list *bl) Race battle_get_race(struct block_list *bl) { nullpo_retr(Race::formless, bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return mob_db[((struct mob_data *) bl)->mob_class].race; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return Race::demihuman; else return Race::formless; @@ -804,7 +804,7 @@ Race battle_get_race(struct block_list *bl) MobMode battle_get_mode(struct block_list *bl) { nullpo_retr(MobMode::CAN_MOVE, bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return mob_db[((struct mob_data *) bl)->mob_class].mode; // とりあえず動くということで1 return MobMode::CAN_MOVE; @@ -836,7 +836,7 @@ eptr<struct status_change, StatusChange> battle_get_sc_data(struct block_list *b { nullpo_retr(nullptr, bl); - switch (bl->type) + switch (bl->bl_type) { case BL::MOB: return ((struct mob_data *)(bl))->sc_data; @@ -849,9 +849,9 @@ eptr<struct status_change, StatusChange> battle_get_sc_data(struct block_list *b short *battle_get_sc_count(struct block_list *bl) { nullpo_retr(NULL, bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return &((struct mob_data *) bl)->sc_count; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return &((struct map_session_data *) bl)->sc_count; return NULL; } @@ -859,11 +859,11 @@ short *battle_get_sc_count(struct block_list *bl) Opt1 *battle_get_opt1(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return &((struct mob_data *) bl)->opt1; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return &((struct map_session_data *) bl)->opt1; - else if (bl->type == BL::NPC && (struct npc_data *) bl) + else if (bl->bl_type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt1; return 0; } @@ -871,11 +871,11 @@ Opt1 *battle_get_opt1(struct block_list *bl) Opt2 *battle_get_opt2(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return &((struct mob_data *) bl)->opt2; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return &((struct map_session_data *) bl)->opt2; - else if (bl->type == BL::NPC && (struct npc_data *) bl) + else if (bl->bl_type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt2; return 0; } @@ -883,11 +883,11 @@ Opt2 *battle_get_opt2(struct block_list *bl) Opt3 *battle_get_opt3(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return &((struct mob_data *) bl)->opt3; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return &((struct map_session_data *) bl)->opt3; - else if (bl->type == BL::NPC && (struct npc_data *) bl) + else if (bl->bl_type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->opt3; return 0; } @@ -895,11 +895,11 @@ Opt3 *battle_get_opt3(struct block_list *bl) Option *battle_get_option(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return &((struct mob_data *) bl)->option; - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return &((struct map_session_data *) bl)->status.option; - else if (bl->type == BL::NPC && (struct npc_data *) bl) + else if (bl->bl_type == BL::NPC && (struct npc_data *) bl) return &((struct npc_data *) bl)->option; return 0; } @@ -923,26 +923,26 @@ int battle_damage(struct block_list *bl, struct block_list *target, if (damage == 0) return 0; - if (target->prev == NULL) + if (target->bl_prev == NULL) return 0; if (bl) { - if (bl->prev == NULL) + if (bl->bl_prev == NULL) return 0; } if (damage < 0) return battle_heal(bl, target, -damage, 0, flag); - if (target->type == BL::MOB) + if (target->bl_type == BL::MOB) { // MOB struct mob_data *md = (struct mob_data *) target; if (md && md->skilltimer && md->state.skillcastcancel) // 詠唱妨害 skill_castcancel(target, 0); return mob_damage(bl, md, damage, 0); } - else if (target->type == BL::PC) + else if (target->bl_type == BL::PC) { // PC struct map_session_data *tsd = (struct map_session_data *) target; @@ -958,7 +958,7 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, { nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック - if (target->type == BL::PC + if (target->bl_type == BL::PC && pc_isdead((struct map_session_data *) target)) return 0; if (hp == 0 && sp == 0) @@ -967,9 +967,9 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, if (hp < 0) return battle_damage(bl, target, -hp, flag); - if (target->type == BL::MOB) + if (target->bl_type == BL::MOB) return mob_heal((struct mob_data *) target, hp); - else if (target->type == BL::PC) + else if (target->bl_type == BL::PC) return pc_heal((struct map_session_data *) target, hp, sp); return 0; } @@ -978,9 +978,9 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp, int battle_stopattack(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return mob_stopattack((struct mob_data *) bl); - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return pc_stopattack((struct map_session_data *) bl); return 0; } @@ -989,9 +989,9 @@ int battle_stopattack(struct block_list *bl) int battle_stopwalking(struct block_list *bl, int type) { nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) return mob_stop_walking((struct mob_data *) bl, type); - else if (bl->type == BL::PC) + else if (bl->bl_type == BL::PC) return pc_stop_walking((struct map_session_data *) bl, type); return 0; } @@ -1009,7 +1009,7 @@ int battle_calc_damage(struct block_list *, struct block_list *bl, nullpo_ret(bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) md = (struct mob_data *) bl; if (battle_config.skill_min_damage @@ -1059,9 +1059,9 @@ struct Damage battle_calc_mob_weapon_attack(struct block_list *src, sc_data = battle_get_sc_data(src); // ターゲット - if (target->type == BL::PC) + if (target->bl_type == BL::PC) tsd = (struct map_session_data *) target; - else if (target->type == BL::MOB) + else if (target->bl_type == BL::MOB) tmd = (struct mob_data *) target; MobMode t_mode = battle_get_mode(target); t_sc_data = battle_get_sc_data(target); @@ -1288,7 +1288,7 @@ int battle_is_unarmed(struct block_list *bl) { if (!bl) return 0; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; @@ -1341,9 +1341,9 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, sd->state.attack_type = BF::WEAPON; //攻撃タイプは武器攻撃 // ターゲット - if (target->type == BL::PC) //対象がPCなら + if (target->bl_type == BL::PC) //対象がPCなら tsd = (struct map_session_data *) target; //tsdに代入(tmdはNULL) - else if (target->type == BL::MOB) //対象がMobなら + else if (target->bl_type == BL::MOB) //対象がMobなら tmd = (struct mob_data *) target; //tmdに代入(tsdはNULL) MobMode t_mode = battle_get_mode(target); //対象のMode t_sc_data = battle_get_sc_data(target); //対象のステータス異常 @@ -1378,8 +1378,8 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, hitrate = battle_get_hit(src) - flee + 80; //命中率計算 { // [fate] Reduce hit chance by distance - int dx = abs(src->x - target->x); - int dy = abs(src->y - target->y); + int dx = abs(src->bl_x - target->bl_x); + int dy = abs(src->bl_y - target->bl_y); int malus_dist; target_distance = max(dx, dy); @@ -1763,9 +1763,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src, nullpo_retr(wd, src); nullpo_retr(wd, target); - if (src->type == BL::PC) + if (src->bl_type == BL::PC) wd = battle_calc_pc_weapon_attack(src, target, skill_num, skill_lv, wflag); // weapon breaking [Valaris] - else if (src->type == BL::MOB) + else if (src->bl_type == BL::MOB) wd = battle_calc_mob_weapon_attack(src, target, skill_num, skill_lv, wflag); return wd; @@ -1794,7 +1794,7 @@ struct Damage battle_calc_magic_attack(struct block_list *bl, matk2 = battle_get_matk2(bl); MobMode t_mode = battle_get_mode(target); - if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { sd->state.attack_type = BF::MAGIC; if (sd->matk_rate != 100) @@ -1870,7 +1870,7 @@ struct Damage battle_calc_misc_attack(struct block_list *bl, nullpo_retr(md, bl); nullpo_retr(md, target); - if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { sd->state.attack_type = BF::MISC; sd->state.arrow_atk = 0; @@ -1961,14 +1961,14 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, nullpo_retr(ATK::ZERO, src); nullpo_retr(ATK::ZERO, target); - if (src->type == BL::PC) + if (src->bl_type == BL::PC) sd = (struct map_session_data *) src; - if (src->prev == NULL || target->prev == NULL) + if (src->bl_prev == NULL || target->bl_prev == NULL) return ATK::ZERO; - if (src->type == BL::PC && pc_isdead(sd)) + if (src->bl_type == BL::PC && pc_isdead(sd)) return ATK::ZERO; - if (target->type == BL::PC + if (target->bl_type == BL::PC && pc_isdead((struct map_session_data *) target)) return ATK::ZERO; @@ -2006,7 +2006,7 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, if (wd.damage > 0 && t_sc_data[StatusChange::SC_PHYS_SHIELD].timer - && target->type == BL::PC) + && target->bl_type == BL::PC) { int reduction = t_sc_data[StatusChange::SC_PHYS_SHIELD].val1; if (reduction > wd.damage) @@ -2030,7 +2030,7 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, MapBlockLock lock; - if (src->type == BL::PC) + if (src->bl_type == BL::PC) { int weapon_index = sd->equip_index[EQUIP::WEAPON]; int weapon = 0; @@ -2039,32 +2039,32 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target, weapon = sd->inventory_data[weapon_index]->nameid; MAP_LOG("PC%d %d:%d,%d WPNDMG %s%d %d FOR %d WPN %d", - sd->status.char_id, src->m, src->x, src->y, - (target->type == BL::PC) ? "PC" : "MOB", - (target->type == + sd->status.char_id, src->bl_m, src->bl_x, src->bl_y, + (target->bl_type == BL::PC) ? "PC" : "MOB", + (target->bl_type == BL::PC) ? ((struct map_session_data *) target)-> - status.char_id : target->id, + status.char_id : target->bl_id, battle_get_class(target), wd.damage + wd.damage2, weapon); } - if (target->type == BL::PC) + if (target->bl_type == BL::PC) { struct map_session_data *sd2 = (struct map_session_data *) target; MAP_LOG("PC%d %d:%d,%d WPNINJURY %s%d %d FOR %d", - sd2->status.char_id, target->m, target->x, target->y, - (src->type == BL::PC) ? "PC" : "MOB", - (src->type == BL::PC) + sd2->status.char_id, target->bl_m, target->bl_x, target->bl_y, + (src->bl_type == BL::PC) ? "PC" : "MOB", + (src->bl_type == BL::PC) ? ((struct map_session_data *) src)->status.char_id - : src->id, + : src->bl_id, battle_get_class(src), wd.damage + wd.damage2); } battle_damage(src, target, (wd.damage + wd.damage2), 0); - if (target->prev != NULL && - (target->type != BL::PC - || (target->type == BL::PC + if (target->bl_prev != NULL && + (target->bl_type != BL::PC + || (target->bl_type == BL::PC && !pc_isdead((struct map_session_data *) target)))) { if (wd.damage > 0 || wd.damage2 > 0) @@ -2151,27 +2151,27 @@ int battle_check_target(struct block_list *src, struct block_list *target, if (flag & BCT_ALL) { - if (target->type == BL::MOB || target->type == BL::PC) + if (target->bl_type == BL::MOB || target->bl_type == BL::PC) return 1; else return -1; } - if (target->type == BL::PC + if (target->bl_type == BL::PC && ((struct map_session_data *) target)->invincible_timer) return -1; // Mobでmaster_idがあってspecial_mob_aiなら、召喚主を求める - if (src->type == BL::MOB) + if (src->bl_type == BL::MOB) { struct mob_data *md = (struct mob_data *) src; if (md && md->master_id > 0) { - if (md->master_id == target->id) // 主なら肯定 + if (md->master_id == target->bl_id) // 主なら肯定 return 1; if (md->state.special_mob_ai) { - if (target->type == BL::MOB) + if (target->bl_type == BL::MOB) { //special_mob_aiで対象がMob struct mob_data *tmd = (struct mob_data *) target; if (tmd) @@ -2196,16 +2196,16 @@ int battle_check_target(struct block_list *src, struct block_list *target, if (src == target || ss == target) // 同じなら肯定 return 1; - if (target->type == BL::PC + if (target->bl_type == BL::PC && pc_isinvisible((struct map_session_data *) target)) return -1; - if (src->prev == NULL || // 死んでるならエラー - (src->type == BL::PC && pc_isdead((struct map_session_data *) src))) + if (src->bl_prev == NULL || // 死んでるならエラー + (src->bl_type == BL::PC && pc_isdead((struct map_session_data *) src))) return -1; - if ((ss->type == BL::PC && target->type == BL::MOB) || - (ss->type == BL::MOB && target->type == BL::PC)) + if ((ss->bl_type == BL::PC && target->bl_type == BL::MOB) || + (ss->bl_type == BL::MOB && target->bl_type == BL::PC)) return 0; // PCvsMOBなら否定 s_p = battle_get_party_id(ss); @@ -2220,18 +2220,18 @@ int battle_check_target(struct block_list *src, struct block_list *target, return 0; } -//PRINTF("ss:%d src:%d target:%d flag:0x%x %d %d ",ss->id,src->id,target->id,flag,src->type,target->type); +//PRINTF("ss:%d src:%d target:%d flag:0x%x %d %d ",ss->bl_id,src->bl_id,target->bl_id,flag,src->bl_type,target->bl_type); //PRINTF("p:%d %d g:%d %d\n",s_p,t_p,s_g,t_g); - if (ss->type == BL::PC && target->type == BL::PC) + if (ss->bl_type == BL::PC && target->bl_type == BL::PC) { // 両方PVPモードなら否定(敵) - if (map[ss->m].flag.pvp + if (map[ss->bl_m].flag.pvp || pc_iskiller((struct map_session_data *) ss, (struct map_session_data *) target)) { // [MouseJstr] if (battle_config.pk_mode) return 1; // prevent novice engagement in pk_mode [Valaris] - else if (map[ss->m].flag.pvp_noparty && s_p > 0 && t_p > 0 + else if (map[ss->bl_m].flag.pvp_noparty && s_p > 0 && t_p > 0 && s_p == t_p) return 1; return 0; @@ -2256,11 +2256,11 @@ int battle_check_range(struct block_list *src, struct block_list *bl, nullpo_ret(src); nullpo_ret(bl); - dx = abs(bl->x - src->x); - dy = abs(bl->y - src->y); + dx = abs(bl->bl_x - src->bl_x); + dy = abs(bl->bl_y - src->bl_y); arange = ((dx > dy) ? dx : dy); - if (src->m != bl->m) // 違うマップ + if (src->bl_m != bl->bl_m) // 違うマップ return 0; if (range > 0 && range < arange) // 遠すぎる @@ -2269,21 +2269,21 @@ int battle_check_range(struct block_list *src, struct block_list *bl, if (arange < 2) // 同じマスか隣接 return 1; -// if(bl->type == BL_SKILL && ((struct skill_unit *)bl)->group->unit_id == 0x8d) +// if(bl->bl_type == BL_SKILL && ((struct skill_unit *)bl)->group->unit_id == 0x8d) // return 1; // 障害物判定 wpd.path_len = 0; wpd.path_pos = 0; wpd.path_half = 0; - if (path_search(&wpd, src->m, src->x, src->y, bl->x, bl->y, 0x10001) != + if (path_search(&wpd, src->bl_m, src->bl_x, src->bl_y, bl->bl_x, bl->bl_y, 0x10001) != -1) return 1; dx = (dx > 0) ? 1 : ((dx < 0) ? -1 : 0); dy = (dy > 0) ? 1 : ((dy < 0) ? -1 : 0); - return (path_search(&wpd, src->m, src->x + dx, src->y + dy, - bl->x - dx, bl->y - dy, 0x10001) != -1) ? 1 : 0; + return (path_search(&wpd, src->bl_m, src->bl_x + dx, src->bl_y + dy, + bl->bl_x - dx, bl->bl_y - dy, 0x10001) != -1) ? 1 : 0; } /*========================================== diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 4757c0a..a015b3c 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.id; + WFIFOL(char_fd, 4) = sd->bl.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.id; + WFIFOL(char_fd, 2) = sd->bl.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.id || !sd->login_id1) + if (!sd || !char_fd || !sd->bl.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.id; + WFIFOL(char_fd, 2) = sd->bl.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.id || !sd->login_id1) + if (!sd || !char_fd || !sd->bl.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.id; + WFIFOL(char_fd, 2) = sd->bl.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.id; + WFIFOL(char_fd, 4) = sd->bl.bl_id; WFIFOSET(char_fd, p); return 0; @@ -949,7 +949,7 @@ void ladmin_itemfrob_c2(struct block_list *bl, int source_id, int dest_id) if (!bl) return; - switch (bl->type) + switch (bl->bl_type) { case BL::PC: { @@ -1023,10 +1023,10 @@ void ladmin_itemfrob(int fd) map_foreachobject(std::bind(ladmin_itemfrob_c, ph::_1, source_id, dest_id), BL::NUL /* any object */); // player characters (and, hopefully, mobs) - while (bl->next) + while (bl->bl_next) { ladmin_itemfrob_c2(bl, source_id, dest_id); - bl = bl->next; + bl = bl->bl_next; } } diff --git a/src/map/clif.cpp b/src/map/clif.cpp index eb1283e..fadb216 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -194,7 +194,7 @@ static int is_deaf(struct block_list *bl) { struct map_session_data *sd = (struct map_session_data *) bl; - if (!bl || bl->type != BL::PC) + if (!bl || bl->bl_type != BL::PC) return 0; return sd->special_state.deaf; } @@ -227,7 +227,7 @@ void clif_send_sub(struct block_list *bl, const unsigned char *buf, int len, case SendWho::AREA_CHAT_WOC: if (is_deaf(bl) - && !(bl->type == BL::PC + && !(bl->bl_type == BL::PC && pc_isGM((struct map_session_data *) src_bl))) { clif_emotion_towards(src_bl, bl, EMOTE_IGNORED); @@ -275,7 +275,7 @@ int clif_send(const uint8_t *buf, int len, struct block_list *bl, SendWho type) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd2 = (struct map_session_data *) bl; if (bool(sd2->status.option & Option::INVISIBILITY)) @@ -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.m == bl->m) + if (sd && sd->state.auth && sd->bl.bl_m == bl->bl_m) { if (clif_parse_func_table[RBUFW(buf, 0)].len) { @@ -337,27 +337,27 @@ int clif_send(const uint8_t *buf, int len, struct block_list *bl, SendWho type) case SendWho::AREA: case SendWho::AREA_WOS: map_foreachinarea(std::bind(clif_send_sub, ph::_1, buf, len, bl, type), - bl->m, bl->x - AREA_SIZE, bl->y - AREA_SIZE, - bl->x + AREA_SIZE, bl->y + AREA_SIZE, BL::PC); + bl->bl_m, bl->bl_x - AREA_SIZE, bl->bl_y - AREA_SIZE, + bl->bl_x + AREA_SIZE, bl->bl_y + AREA_SIZE, BL::PC); break; case SendWho::AREA_CHAT_WOC: map_foreachinarea(std::bind(clif_send_sub, ph::_1, buf, len, bl, SendWho::AREA_CHAT_WOC), - bl->m, bl->x - (AREA_SIZE), bl->y - (AREA_SIZE), - bl->x + (AREA_SIZE), bl->y + (AREA_SIZE), BL::PC); + bl->bl_m, bl->bl_x - (AREA_SIZE), bl->bl_y - (AREA_SIZE), + bl->bl_x + (AREA_SIZE), bl->bl_y + (AREA_SIZE), BL::PC); break; case SendWho::PARTY_AREA: // 同じ画面内の全パーティーメンバに送信 case SendWho::PARTY_AREA_WOS: // 自分以外の同じ画面内の全パーティーメンバに送信 - x0 = bl->x - AREA_SIZE; - y0 = bl->y - AREA_SIZE; - x1 = bl->x + AREA_SIZE; - y1 = bl->y + AREA_SIZE; + x0 = bl->bl_x - AREA_SIZE; + y0 = bl->bl_y - AREA_SIZE; + x1 = bl->bl_x + AREA_SIZE; + y1 = bl->bl_y + AREA_SIZE; FALLTHROUGH; case SendWho::PARTY: // 全パーティーメンバに送信 case SendWho::PARTY_WOS: // 自分以外の全パーティーメンバに送信 case SendWho::PARTY_SAMEMAP: // 同じマップの全パーティーメンバに送信 case SendWho::PARTY_SAMEMAP_WOS: // 自分以外の同じマップの全パーティーメンバに送信 - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; if (sd->partyspy > 0) @@ -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.id == bl->id && (type == SendWho::PARTY_WOS || + if (sd->bl.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->m != sd->bl.m) // マップチェック + if (type != SendWho::PARTY && type != SendWho::PARTY_WOS && bl->bl_m != sd->bl.bl_m) // マップチェック continue; if ((type == SendWho::PARTY_AREA || type == SendWho::PARTY_AREA_WOS) && - (sd->bl.x < x0 || sd->bl.y < y0 || - sd->bl.x > x1 || sd->bl.y > y1)) + (sd->bl.bl_x < x0 || sd->bl.bl_y < y0 || + sd->bl.bl_x > x1 || sd->bl.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.x, sd->bl.y); + WFIFOPOS(fd, 6, sd->bl.bl_x, sd->bl.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.id; + WBUFL(buf, 2) = fitem->bl.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.x; - WBUFW(buf, 11) = fitem->bl.y; + WBUFW(buf, 9) = fitem->bl.bl_x; + WBUFW(buf, 11) = fitem->bl.bl_y; WBUFB(buf, 13) = fitem->subx; WBUFB(buf, 14) = fitem->suby; WBUFW(buf, 15) = fitem->item_data.amount; @@ -565,7 +565,7 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) nullpo_ret(fitem); WBUFW(buf, 0) = 0xa1; - WBUFL(buf, 2) = fitem->bl.id; + WBUFL(buf, 2) = fitem->bl.bl_id; if (fd == 0) { @@ -591,7 +591,7 @@ int clif_clearchar(struct block_list *bl, BeingRemoveWhy type) nullpo_ret(bl); WBUFW(buf, 0) = 0x80; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; if (type == BeingRemoveWhy::DISGUISE) { WBUFB(buf, 6) = static_cast<uint8_t>(BeingRemoveWhy::GONE); @@ -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.id; + WBUFL(buf, 2) = sd->bl.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.x, sd->bl.y); + WBUFPOS(buf, 46, sd->bl.bl_x, sd->bl.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.id; + WBUFL(buf, 2) = sd->bl.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.x, sd->bl.y, sd->to_x, sd->to_y); + WBUFPOS2(buf, 50, sd->bl.bl_x, sd->bl.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.id; + WBUFL(buf, 2) = md->bl.bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(&md->bl).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.x, md->bl.y); + WBUFPOS(buf, 46, md->bl.bl_x, md->bl.bl_y); // work around ICE in gcc 4.6 uint8_t dir = static_cast<uint8_t>(md->dir); WBUFB(buf, 48) |= dir; @@ -823,7 +823,7 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf) nullpo_ret(md); WBUFW(buf, 0) = 0x7b; - WBUFL(buf, 2) = md->bl.id; + WBUFL(buf, 2) = md->bl.bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(battle_get_speed(&md->bl).count()); WBUFW(buf, 8) = static_cast<uint16_t>(md->opt1); WBUFW(buf, 10) = static_cast<uint16_t>(md->opt2); @@ -832,7 +832,7 @@ 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.x, md->bl.y, md->to_x, md->to_y); + WBUFPOS2(buf, 50, md->bl.bl_x, md->bl.bl_y, md->to_x, md->to_y); WBUFB(buf, 56) = 5; WBUFB(buf, 57) = 5; WBUFW(buf, 58) = @@ -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.id; + WBUFL(buf, 2) = nd->bl.bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(nd->speed.count()); WBUFW(buf, 14) = nd->npc_class; - WBUFPOS(buf, 46, nd->bl.x, nd->bl.y); + WBUFPOS(buf, 46, nd->bl.bl_x, nd->bl.bl_y); // work around ICE in gcc 4.6 uint8_t dir = static_cast<uint8_t>(nd->dir); WBUFB(buf, 48) |= dir; @@ -904,15 +904,15 @@ int clif_spawnpc(struct map_session_data *sd) WBUFW(buf, 51) = 0; clif_send(buf, clif_parse_func_table[0x1d9].len, &sd->bl, SendWho::AREA_WOS); - if (map[sd->bl.m].flag.snow) + if (map[sd->bl.bl_m].flag.snow) clif_specialeffect(&sd->bl, 162, 1); - if (map[sd->bl.m].flag.fog) + if (map[sd->bl.bl_m].flag.fog) clif_specialeffect(&sd->bl, 233, 1); - if (map[sd->bl.m].flag.sakura) + if (map[sd->bl.bl_m].flag.sakura) clif_specialeffect(&sd->bl, 163, 1); - if (map[sd->bl.m].flag.leaves) + if (map[sd->bl.bl_m].flag.leaves) clif_specialeffect(&sd->bl, 333, 1); - if (map[sd->bl.m].flag.rain) + if (map[sd->bl.bl_m].flag.rain) clif_specialeffect(&sd->bl, 161, 1); // clif_changelook_accessories(&sd->bl, NULL); @@ -937,10 +937,10 @@ 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.id; + WBUFL(buf, 2) = nd->bl.bl_id; WBUFW(buf, 6) = static_cast<uint16_t>(nd->speed.count()); WBUFW(buf, 20) = nd->npc_class; - WBUFPOS(buf, 36, nd->bl.x, nd->bl.y); + WBUFPOS(buf, 36, nd->bl.bl_x, nd->bl.bl_y); clif_send(buf, clif_parse_func_table[0x7c].len, &nd->bl, SendWho::AREA); @@ -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.x, sd->bl.y); + WFIFOPOS(fd, 36, sd->bl.bl_x, sd->bl.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.x, sd->bl.y); - WFIFOPOS(fd, 36, sd->bl.x, sd->bl.y); + WFIFOPOS(fd, 46, sd->bl.bl_x, sd->bl.bl_y); + WFIFOPOS(fd, 36, sd->bl.bl_x, sd->bl.bl_y); WFIFOB(fd, 49) = 5; WFIFOB(fd, 50) = 5; WFIFOSET(fd, clif_parse_func_table[0x78].len); @@ -1002,13 +1002,13 @@ 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.id; + WBUFL(buf, 2) = md->bl.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.x, md->bl.y); + WBUFPOS(buf, 36, md->bl.bl_x, md->bl.bl_y); clif_send(buf, clif_parse_func_table[0x7c].len, &md->bl, SendWho::AREA); } @@ -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.x, sd->bl.y, sd->to_x, sd->to_y); + WFIFOPOS2(fd, 6, sd->bl.bl_x, sd->bl.bl_y, sd->to_x, sd->to_y); WFIFOB(fd, 11) = 0; WFIFOSET(fd, clif_parse_func_table[0x87].len); @@ -1169,9 +1169,9 @@ int clif_fixpos(struct block_list *bl) nullpo_ret(bl); WBUFW(buf, 0) = 0x88; - WBUFL(buf, 2) = bl->id; - WBUFW(buf, 6) = bl->x; - WBUFW(buf, 8) = bl->y; + WBUFL(buf, 2) = bl->bl_id; + WBUFW(buf, 6) = bl->bl_x; + WBUFW(buf, 8) = bl->bl_y; clif_send(buf, clif_parse_func_table[0x88].len, bl, SendWho::AREA); @@ -1964,7 +1964,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) sd = (struct map_session_data *) bl; if (sd && bool(sd->status.option & Option::INVISIBILITY)) @@ -1974,7 +1974,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, && (type == LOOK::WEAPON || type == LOOK::SHIELD || type >= LOOK::SHOES)) { WBUFW(buf, 0) = 0x1d7; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; if (type >= LOOK::SHOES) { EQUIP equip_point = equip_points[type]; @@ -2039,7 +2039,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, else { WBUFW(buf, 0) = 0x1d7; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFB(buf, 6) = uint8_t(type); WBUFW(buf, 7) = val; WBUFW(buf, 9) = 0; @@ -2220,7 +2220,7 @@ int clif_misceffect(struct block_list *bl, int type) nullpo_ret(bl); WBUFW(buf, 0) = 0x19b; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFL(buf, 6) = type; clif_send(buf, clif_parse_func_table[0x19b].len, bl, SendWho::AREA); @@ -2243,7 +2243,7 @@ int clif_changeoption(struct block_list *bl) sc_data = battle_get_sc_data(bl); WBUFW(buf, 0) = 0x119; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFW(buf, 6) = uint16_t(*battle_get_opt1(bl)); WBUFW(buf, 8) = uint16_t(*battle_get_opt2(bl)); WBUFW(buf, 10) = uint16_t(option); @@ -2283,7 +2283,7 @@ 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.id; + WBUFL(buf, 6) = sd->bl.bl_id; WBUFW(buf, 10) = amount; WBUFB(buf, 12) = ok; clif_send(buf, clif_parse_func_table[0x1c8].len, &sd->bl, SendWho::SELF); @@ -2754,8 +2754,8 @@ int clif_damage(struct block_list *src, struct block_list *dst, sc_data = battle_get_sc_data(dst); WBUFW(buf, 0) = 0x8a; - WBUFL(buf, 2) = src->id; - WBUFL(buf, 6) = dst->id; + WBUFL(buf, 2) = src->bl_id; + WBUFL(buf, 6) = dst->bl_id; WBUFL(buf, 10) = tick.time_since_epoch().count(); WBUFL(buf, 14) = sdelay.count(); WBUFL(buf, 18) = ddelay.count(); @@ -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.id; + WFIFOL(fd, 2) = fitem->bl.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.x; - WFIFOW(fd, 11) = fitem->bl.y; + WFIFOW(fd, 9) = fitem->bl.bl_x; + WFIFOW(fd, 11) = fitem->bl.bl_y; WFIFOW(fd, 13) = fitem->item_data.amount; WFIFOB(fd, 15) = fitem->subx; WFIFOB(fd, 16) = fitem->suby; @@ -2831,7 +2831,7 @@ void clif_getareachar(struct block_list *bl, struct map_session_data *sd) { nullpo_retv(bl); - switch (bl->type) + switch (bl->bl_type) { case BL::PC: if (sd == (struct map_session_data *) bl) @@ -2850,7 +2850,7 @@ void clif_getareachar(struct block_list *bl, struct map_session_data *sd) default: if (battle_config.error_log) PRINTF("get area char ??? %d\n", - bl->type); + bl->bl_type); break; } } @@ -2866,22 +2866,22 @@ void clif_pcoutsight(struct block_list *bl, struct map_session_data *sd) nullpo_retv(bl); nullpo_retv(sd); - switch (bl->type) + switch (bl->bl_type) { case BL::PC: dstsd = (struct map_session_data *) bl; if (sd != dstsd) { - clif_clearchar_id(dstsd->bl.id, BeingRemoveWhy::GONE, sd->fd); - clif_clearchar_id(sd->bl.id, BeingRemoveWhy::GONE, dstsd->fd); + clif_clearchar_id(dstsd->bl.bl_id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(sd->bl.bl_id, BeingRemoveWhy::GONE, dstsd->fd); } break; case BL::NPC: if (((struct npc_data *) bl)->npc_class != INVISIBLE_CLASS) - clif_clearchar_id(bl->id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(bl->bl_id, BeingRemoveWhy::GONE, sd->fd); break; case BL::MOB: - clif_clearchar_id(bl->id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(bl->bl_id, BeingRemoveWhy::GONE, sd->fd); break; case BL::ITEM: clif_clearflooritem((struct flooritem_data *) bl, sd->fd); @@ -2900,7 +2900,7 @@ void clif_pcinsight(struct block_list *bl, struct map_session_data *sd) nullpo_retv(bl); nullpo_retv(sd); - switch (bl->type) + switch (bl->bl_type) { case BL::PC: dstsd = (struct map_session_data *) bl; @@ -2933,9 +2933,9 @@ void clif_moboutsight(struct block_list *bl, struct mob_data *md) nullpo_retv(bl); nullpo_retv(md); - if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { - clif_clearchar_id(md->bl.id, BeingRemoveWhy::GONE, sd->fd); + clif_clearchar_id(md->bl.bl_id, BeingRemoveWhy::GONE, sd->fd); } } @@ -2950,7 +2950,7 @@ void clif_mobinsight(struct block_list *bl, struct mob_data *md) nullpo_retv(bl); nullpo_retv(md); - if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { clif_getareachar_mob(sd, md); } @@ -3071,7 +3071,7 @@ int clif_skillcastcancel(struct block_list *bl) nullpo_ret(bl); WBUFW(buf, 0) = 0x1b9; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; clif_send(buf, clif_parse_func_table[0x1b9].len, bl, SendWho::AREA); return 0; @@ -3124,8 +3124,8 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst, WBUFW(buf, 0) = 0x1de; WBUFW(buf, 2) = uint16_t(skill_id); - WBUFL(buf, 4) = src->id; - WBUFL(buf, 8) = dst->id; + WBUFL(buf, 4) = src->bl_id; + WBUFL(buf, 8) = dst->bl_id; WBUFL(buf, 12) = static_cast<uint32_t>(tick.time_since_epoch().count()); WBUFL(buf, 16) = static_cast<uint32_t>(sdelay.count()); WBUFL(buf, 20) = static_cast<uint32_t>(ddelay.count()); @@ -3150,7 +3150,7 @@ int clif_status_change(struct block_list *bl, StatusChange type, int flag) WBUFW(buf, 0) = 0x0196; WBUFW(buf, 2) = uint16_t(type); - WBUFL(buf, 4) = bl->id; + WBUFL(buf, 4) = bl->bl_id; WBUFB(buf, 8) = flag; clif_send(buf, clif_parse_func_table[0x196].len, bl, SendWho::AREA); return 0; @@ -3206,7 +3206,7 @@ int clif_resurrection(struct block_list *bl, int type) nullpo_ret(bl); WBUFW(buf, 0) = 0x148; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFW(buf, 6) = type; clif_send(buf, clif_parse_func_table[0x148].len, bl, type == 1 ? SendWho::AREA : SendWho::AREA_WOS); @@ -3474,8 +3474,8 @@ 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.x; - WBUFW(buf, 8) = sd->bl.y; + 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); // if(battle_config.etc_log) // PRINTF("clif_party_xy %d\n",sd->status.account_id); @@ -3516,11 +3516,11 @@ int clif_movetoattack(struct map_session_data *sd, struct block_list *bl) fd = sd->fd; WFIFOW(fd, 0) = 0x139; - WFIFOL(fd, 2) = bl->id; - WFIFOW(fd, 6) = bl->x; - WFIFOW(fd, 8) = bl->y; - WFIFOW(fd, 10) = sd->bl.x; - WFIFOW(fd, 12) = sd->bl.y; + 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, 14) = sd->attackrange; WFIFOSET(fd, clif_parse_func_table[0x139].len); return 0; @@ -3537,7 +3537,7 @@ int clif_mvp_effect(struct map_session_data *sd) nullpo_ret(sd); WBUFW(buf, 0) = 0x10c; - WBUFL(buf, 2) = sd->bl.id; + WBUFL(buf, 2) = sd->bl.bl_id; clif_send(buf, clif_parse_func_table[0x10c].len, &sd->bl, SendWho::AREA); return 0; } @@ -3553,7 +3553,7 @@ void clif_emotion(struct block_list *bl, int type) nullpo_retv(bl); WBUFW(buf, 0) = 0xc0; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFB(buf, 6) = type; clif_send(buf, clif_parse_func_table[0xc0].len, bl, SendWho::AREA); } @@ -3569,11 +3569,11 @@ void clif_emotion_towards(struct block_list *bl, nullpo_retv(bl); nullpo_retv(target); - if (target->type != BL::PC) + if (target->bl_type != BL::PC) return; WBUFW(buf, 0) = 0xc0; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFB(buf, 6) = type; memcpy(WFIFOP(sd->fd, 0), buf, len); @@ -3591,7 +3591,7 @@ void clif_sitting(int, struct map_session_data *sd) nullpo_retv(sd); WBUFW(buf, 0) = 0x8a; - WBUFL(buf, 2) = sd->bl.id; + WBUFL(buf, 2) = sd->bl.bl_id; WBUFB(buf, 26) = 2; clif_send(buf, clif_parse_func_table[0x8a].len, &sd->bl, SendWho::AREA); } @@ -3641,7 +3641,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) memset(buf, 0, clif_parse_func_table[0x19b].len); WBUFW(buf, 0) = 0x19b; - WBUFL(buf, 2) = bl->id; + WBUFL(buf, 2) = bl->bl_id; WBUFL(buf, 6) = type; if (flag == 2) @@ -3651,7 +3651,7 @@ 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.m == bl->m) + if (sd && sd->state.auth && sd->bl.bl_m == bl->bl_m) clif_specialeffect(&sd->bl, type, 1); } } @@ -3733,7 +3733,7 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) int i; nullpo_retv(sd); - if (sd->bl.prev != NULL) + if (sd->bl.bl_prev != NULL) return; // 接続ok時 @@ -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.m].flag.pvp) + if (map[sd->bl.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.id)); + sd->bl.bl_id)); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; @@ -3818,9 +3818,9 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) // clif_changelook_accessories(sd, NULL); - 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); + 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); } /*========================================== @@ -3927,7 +3927,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) WFIFOW(fd, 0) = 0x95; WFIFOL(fd, 2) = account_id; - switch (bl->type) + switch (bl->bl_type) { case BL::PC: { @@ -4009,7 +4009,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) default: if (battle_config.error_log) PRINTF("clif_parse_GetCharNameRequest : bad type %d (%d)\n", - bl->type, account_id); + bl->bl_type, account_id); break; } } @@ -4057,7 +4057,7 @@ 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.id; + WBUFL(reinterpret_cast<uint8_t *>(buf), 4) = sd->bl.bl_id; // evil multiuse buffer! clif_send((const uint8_t *)buf, msg_len + 8, &sd->bl, SendWho::AREA_CHAT_WOC); @@ -4084,7 +4084,7 @@ int clif_message(struct block_list *bl, const char *msg) WBUFW(buf, 0) = 0x8d; WBUFW(buf, 2) = msg_len + 8; - WBUFL(buf, 4) = bl->id; + WBUFL(buf, 4) = bl->bl_id; memcpy(WBUFP(buf, 8), msg, msg_len); clif_send(buf, WBUFW(buf, 2), bl, SendWho::AREA); @@ -4114,7 +4114,7 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) pc_setdir(sd, dir); WBUFW(buf, 0) = 0x9c; - WBUFL(buf, 2) = sd->bl.id; + WBUFL(buf, 2) = sd->bl.bl_id; WBUFW(buf, 6) = 0; WBUFB(buf, 8) = static_cast<uint8_t>(dir); @@ -4137,7 +4137,7 @@ 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.id; + WBUFL(buf, 2) = sd->bl.bl_id; WBUFB(buf, 6) = RFIFOB(fd, 2); clif_send(buf, clif_parse_func_table[0xc0].len, &sd->bl, SendWho::AREA); } @@ -4217,7 +4217,7 @@ 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.id; + WBUFL(buf, 2) = sd->bl.bl_id; WBUFB(buf, 26) = 3; clif_send(buf, clif_parse_func_table[0x8a].len, &sd->bl, SendWho::AREA); break; @@ -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.m != sd->bl.m) + if (fitem == NULL || fitem->bl.bl_m != sd->bl.bl_m) return; - if (abs(sd->bl.x - fitem->bl.x) >= 2 - || abs(sd->bl.y - fitem->bl.y) >= 2) + if (abs(sd->bl.bl_x - fitem->bl.bl_x) >= 2 + || abs(sd->bl.bl_y - fitem->bl.bl_y) >= 2) return; // too far away to pick up if (sd->state.shroud_active && sd->state.shroud_disappears_on_pickup) @@ -4409,7 +4409,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) clif_clearchar(&sd->bl, BeingRemoveWhy::DEAD); return; } - if (map[sd->bl.m].flag.no_player_drops) + if (map[sd->bl.bl_m].flag.no_player_drops) { clif_displaymessage(sd->fd, "Can't drop items here."); return; @@ -5789,11 +5789,11 @@ 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.id); // Player logout display [Yor] + PRINTF("Player with account [%d] has logged off your server.\n", sd->bl.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.id); // Player logout display [Yor] + 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 } if (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.id); + PRINTF("\nAccount ID %d.\n", sd->bl.bl_id); } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified) - PRINTF("\nAccount ID %d.\n", sd->bl.id); + PRINTF("\nAccount ID %d.\n", sd->bl.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.id); + now, sd->bl.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.id); + now, sd->bl.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 6a9008e..6fcdf68 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.id; + WFIFOL(char_fd, 4) = sd->bl.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.id; + WFIFOL(char_fd, 2) = sd->bl.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.m].name, 16); + memcpy(WFIFOP(char_fd, 54), map[sd->bl.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.m].name, 16); + memcpy(WFIFOP(char_fd, 34), map[sd->bl.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.m].name, 16); + memcpy(WFIFOP(char_fd, 10), map[sd->bl.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-expr-eval.hpp b/src/map/magic-expr-eval.hpp index d6decd9..d61d397 100644 --- a/src/map/magic-expr-eval.hpp +++ b/src/map/magic-expr-eval.hpp @@ -32,7 +32,7 @@ void magic_area_rect(int *m, int *x, int *y, int *width, int *height, #define RESULTINVOCATION result->v.v_invocation #define ARG_TYPE(x) args[x].ty -#define ENTITY_TYPE(x) ARGENTITY(x)->type +#define ENTITY_TYPE(x) ARGENTITY(x)->bl_type #define ARGPC(x) ((struct map_session_data *)ARGENTITY(x)) #define ARGNPC(x) ((struct map_session_data *)ARGENTITY(x)) diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp index 4a72a38..f25bf87 100644 --- a/src/map/magic-expr.cpp +++ b/src/map/magic-expr.cpp @@ -88,7 +88,7 @@ void magic_clear_var(val_t *v) static const char *show_entity(entity_t *entity) { - switch (entity->type) + switch (entity->bl_type) { case BL::PC: return ((struct map_session_data *) entity)->status.name; @@ -677,17 +677,17 @@ int fun_mob_id(env_t *, int, val_t *result, val_t *args) inline void COPY_LOCATION(entity_t& dest, location_t& src) { - dest.x = src.x; - dest.y = src.y; - dest.m = src.m; + dest.bl_x = src.x; + dest.bl_y = src.y; + dest.bl_m = src.m; } inline void COPY_LOCATION(location_t& dest, entity_t& src) { - dest.x = src.x; - dest.y = src.y; - dest.m = src.m; + dest.x = src.bl_x; + dest.y = src.bl_y; + dest.m = src.bl_m; } static @@ -728,7 +728,7 @@ int fun_random_dir(env_t *, int, val_t *result, val_t *args) static int fun_hash_entity(env_t *, int, val_t *result, val_t *args) { - RESULTINT = ARGENTITY(0)->id; + RESULTINT = ARGENTITY(0)->bl_id; return 0; } @@ -995,7 +995,7 @@ int fun_read_script_int(env_t *, int, val_t *result, val_t *args) entity_t *subject_p = ARGENTITY(0); char *var_name = ARGSTR(1); - if (subject_p->type != BL::PC) + if (subject_p->bl_type != BL::PC) return 1; RESULTINT = pc_readglobalreg((character_t *) subject_p, var_name); @@ -1633,7 +1633,7 @@ void magic_eval(env_t *env, val_t *dest, expr_t *expr) if (dest->ty == TYPE::ENTITY) { if (dest->v.v_entity) - dest->v.v_int = dest->v.v_entity->id; + dest->v.v_int = dest->v.v_entity->bl_id; else dest->ty = TYPE::FAIL; } diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp index 26d75af..1cdfd75 100644 --- a/src/map/magic-interpreter-base.cpp +++ b/src/map/magic-interpreter-base.cpp @@ -32,14 +32,14 @@ static void set_entity(val_t *v, entity_t *e) { v->ty = TYPE::ENTITY; - v->v.v_int = e->id; + v->v.v_int = e->bl_id; } static void set_invocation(val_t *v, invocation_t *i) { v->ty = TYPE::INVOCATION; - v->v.v_int = i->bl.id; + v->v.v_int = i->bl.bl_id; } static @@ -457,9 +457,9 @@ void spell_set_location(invocation_t *invocation, entity_t *entity) { magic_clear_var(&invocation->env->vars[VAR_LOCATION]); invocation->env->vars[VAR_LOCATION].ty = TYPE::LOCATION; - invocation->env->vars[VAR_LOCATION].v.v_location.m = entity->m; - invocation->env->vars[VAR_LOCATION].v.v_location.x = entity->x; - invocation->env->vars[VAR_LOCATION].v.v_location.y = entity->y; + invocation->env->vars[VAR_LOCATION].v.v_location.m = entity->bl_m; + invocation->env->vars[VAR_LOCATION].v.v_location.x = entity->bl_x; + invocation->env->vars[VAR_LOCATION].v.v_location.y = entity->bl_y; } void spell_update_location(invocation_t *invocation) @@ -492,11 +492,11 @@ 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.id = map_addobject(&retval->bl); - retval->bl.type = BL::SPELL; - retval->bl.m = caster->m; - retval->bl.x = caster->x; - retval->bl.y = caster->y; + 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; map_addblock(&retval->bl); set_env_invocation(VAR_INVOCATION, 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.id = 0; - retval->bl.prev = NULL; - retval->bl.next = NULL; + retval->bl.bl_id = 0; + retval->bl.bl_prev = NULL; + retval->bl.bl_next = NULL; - retval->bl.id = map_addobject(&retval->bl); + retval->bl.bl_id = map_addobject(&retval->bl); 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.id; + invocation->subject = subject->bl.bl_id; } spell_set_location(invocation, (entity_t *) subject); diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp index f132ca6..607b6b2 100644 --- a/src/map/magic-stmt.cpp +++ b/src/map/magic-stmt.cpp @@ -114,7 +114,7 @@ void spell_free_invocation(invocation_t *invocation) if (bool(invocation->flags & INVOCATION_FLAG::BOUND)) { entity_t *e = map_id2bl(invocation->subject); - if (e && e->type == BL::PC) + if (e && e->bl_type == BL::PC) spell_unbind((character_t *) e, invocation); } @@ -125,7 +125,7 @@ void spell_free_invocation(invocation_t *invocation) magic_free_env(invocation->env); map_delblock(&invocation->bl); - map_delobject(invocation->bl.id, BL::SPELL); // also frees the object + map_delobject(invocation->bl.bl_id, BL::SPELL); // also frees the object // free(invocation); } @@ -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.id; + return invocation->bl.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.m, character->bl.x, - character->bl.y); + entity_warp((entity_t *) character, character->bl.bl_m, character->bl.bl_x, + character->bl.bl_y); } static @@ -256,7 +256,7 @@ void entity_effect(entity_t *entity, int effect_nr, interval_t delay) { Timer(gettick() + delay, std::bind(&timer_callback_effect, ph::_1, ph::_2, - entity->id, effect_nr) + entity->bl_id, effect_nr) ).detach(); } @@ -284,7 +284,7 @@ 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.id; + int effect_npc_id = effect_npc->bl.bl_id; entity_effect(&effect_npc->bl, effect, tdelay); Timer(gettick() + delay, @@ -325,7 +325,7 @@ int op_instaheal(env_t *env, int, val_t *args) if (!caster) caster = subject; - if (caster->type == BL::PC && subject->type == BL::PC) + if (caster->bl_type == BL::PC && subject->bl_type == BL::PC) { character_t *caster_pc = (character_t *) caster; character_t *subject_pc = (character_t *) subject; @@ -341,7 +341,7 @@ static int op_itemheal(env_t *env, int args_nr, val_t *args) { entity_t *subject = ARGENTITY(0); - if (subject->type == BL::PC) + if (subject->bl_type == BL::PC) { pc_itemheal((struct map_session_data *) subject, ARGINT(1), ARGINT(2)); @@ -365,7 +365,7 @@ ENUM_BITWISE_OPERATORS(Shroud) using e::Shroud; // differs from ARGPC by checking -#define ARGCHAR(n) (ARGENTITY(n)->type == BL::PC) ? (character_t *)(ARGENTITY(n)) : NULL +#define ARGCHAR(n) (ENTITY_TYPE(n) == BL::PC) ? (character_t *)(ARGENTITY(n)) : NULL static int op_shroud(env_t *, int, val_t *args) @@ -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.id) + npc->bl.bl_id) ).detach(); return 0; @@ -436,10 +436,10 @@ int op_messenger_npc(env_t *, int, val_t *args) static void entity_warp(entity_t *target, int destm, int destx, int desty) { - if (target->type == BL::PC || target->type == BL::MOB) + if (target->bl_type == BL::PC || target->bl_type == BL::MOB) { - switch (target->type) + switch (target->bl_type) { case BL::PC: { @@ -447,26 +447,26 @@ void entity_warp(entity_t *target, int destm, int destx, int desty) char *map_name; clif_clearchar(&character->bl, BeingRemoveWhy::WARPED); map_delblock(&character->bl); - character->bl.x = destx; - character->bl.y = desty; - character->bl.m = destm; + character->bl.bl_x = destx; + character->bl.bl_y = desty; + character->bl.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.m].name; + map_name = map[character->bl.bl_m].name; // Warp part #1: update relevant data, interrupt trading etc.: - pc_setpos(character, map_name, character->bl.x, character->bl.y, BeingRemoveWhy::GONE); + pc_setpos(character, map_name, character->bl.bl_x, character->bl.bl_y, BeingRemoveWhy::GONE); // Warp part #2: now notify the client clif_changemap(character, map_name, - character->bl.x, character->bl.y); + character->bl.bl_x, character->bl.bl_y); break; } case BL::MOB: - target->x = destx; - target->y = desty; - target->m = destm; + target->bl_x = destx; + target->bl_y = desty; + target->bl_m = destm; clif_fixmobpos((struct mob_data *) target); break; } @@ -479,11 +479,11 @@ int op_move(env_t *, int, val_t *args) entity_t *subject = ARGENTITY(0); DIR dir = ARGDIR(1); - int newx = subject->x + dirx[dir]; - int newy = subject->y + diry[dir]; + int newx = subject->bl_x + dirx[dir]; + int newy = subject->bl_y + diry[dir]; - if (!bool(map_getcell(subject->m, newx, newy) & MapCell::UNWALKABLE)) - entity_warp(subject, subject->m, newx, newy); + if (!bool(map_getcell(subject->bl_m, newx, newy) & MapCell::UNWALKABLE)) + entity_warp(subject, subject->bl_m, newx, newy); return 0; } @@ -504,7 +504,7 @@ int op_banish(env_t *, int, val_t *args) { entity_t *subject = ARGENTITY(0); - if (subject->type == BL::MOB) + if (subject->bl_type == BL::MOB) { struct mob_data *mob = (struct mob_data *) subject; @@ -545,8 +545,8 @@ int op_status_change(env_t *env, int, val_t *args) ARGINT(2), static_cast<interval_t>(ARGINT(6)), invocation_id); - if (invocation && subject->type == BL::PC) - record_status_change(invocation, subject->id, StatusChange(ARGINT(1))); + if (invocation && subject->bl_type == BL::PC) + record_status_change(invocation, subject->bl_id, StatusChange(ARGINT(1))); return 0; } @@ -574,7 +574,7 @@ int op_override_attack(env_t *env, int, val_t *args) int stopattack = ARGINT(6); character_t *subject; - if (psubject->type != BL::PC) + if (psubject->bl_type != BL::PC) return 0; subject = (character_t *) psubject; @@ -588,7 +588,7 @@ int op_override_attack(env_t *env, int, val_t *args) } subject->attack_spell_override = - trigger_spell(subject->bl.id, VAR(VAR_INVOCATION).v.v_int); + trigger_spell(subject->bl.bl_id, VAR(VAR_INVOCATION).v.v_int); subject->attack_spell_charges = charges; if (subject->attack_spell_override) @@ -616,7 +616,7 @@ int op_create_item(env_t *, int, val_t *args) if (count <= 0) return 0; - if (entity->type == BL::PC) + if (entity->bl_type == BL::PC) subject = (character_t *) entity; else return 0; @@ -651,7 +651,7 @@ int op_aggravate(env_t *, int, val_t *args) entity_t *target = ARGENTITY(0); struct mob_data *other; - if (target->type == BL::MOB) + if (target->bl_type == BL::MOB) other = (struct mob_data *) target; else return 0; @@ -663,8 +663,8 @@ int op_aggravate(env_t *, int, val_t *args) if (AGGRAVATION_MODE_ATTACKS_CASTER(mode)) { - other->target_id = victim->id; - other->attacked_id = victim->id; + other->target_id = victim->bl_id; + other->attacked_id = victim->bl_id; } return 0; @@ -691,7 +691,7 @@ int op_spawn(env_t *, int, val_t *args) character_t *owner = NULL; if (monster_attitude == MonsterAttitude::SERVANT - && owner_e->type == BL::PC) + && owner_e->bl_type == BL::PC) owner = (character_t *) owner_e; for (i = 0; i < monster_count; i++) @@ -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.id; - mob->attacked_id = owner->bl.id; + mob->target_id = owner->bl.bl_id; + mob->attacked_id = owner->bl.bl_id; } break; @@ -745,7 +745,7 @@ int op_spawn(env_t *, int, val_t *args) if (owner) { - mob->master_id = owner->bl.id; + mob->master_id = owner->bl.bl_id; mob->master_dist = 6; } } @@ -779,7 +779,10 @@ int op_injure(env_t *env, int, val_t *args) int target_hp = battle_get_hp(target); int mdef = battle_get_mdef(target); - if (target->type == BL::PC && !map[target->m].flag.pvp && !((character_t *) target)->special_state.killable && (caster->type != BL::PC || !((character_t *) caster)->special_state.killer)) + if (target->bl_type == BL::PC + && !map[target->bl_m].flag.pvp + && !((character_t *) target)->special_state.killable + && (caster->bl_type != BL::PC || !((character_t *) caster)->special_state.killer)) return 0; /* Cannot damage other players outside of pvp */ if (target != caster) @@ -799,15 +802,15 @@ int op_injure(env_t *env, int, val_t *args) gettick(), interval_t::zero(), interval_t::zero(), damage_caused, 0, DamageType::NORMAL, 0); - if (caster->type == BL::PC) + if (caster->bl_type == BL::PC) { character_t *caster_pc = (character_t *) caster; - if (target->type == BL::MOB) + if (target->bl_type == BL::MOB) { struct mob_data *mob = (struct mob_data *) target; MAP_LOG_PC(caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s", - mob->bl.id, mob->mob_class, damage_caused, + mob->bl.bl_id, mob->mob_class, damage_caused, get_invocation_name(env)); } } @@ -979,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.type != BL::SPELL) + if (!invocation || invocation->bl.bl_type != BL::SPELL) return; for (i = 0; i < invocation->status_change_refs_nr; i++) @@ -995,7 +998,7 @@ void spell_effect_report_termination(int invocation_id, int bl_id, if (index == -1) { entity_t *entity = map_id2bl(bl_id); - if (entity->type == BL::PC) + if (entity->bl_type == BL::PC) FPRINTF(stderr, "[magic] INTERNAL ERROR: spell-effect-report-termination: tried to terminate on unexpected bl %d, sc %d\n", bl_id, sc_id); @@ -1131,14 +1134,14 @@ void find_entities_in_area_c(entity_t *target, } \ (*entities_p)[(*entities_nr_p)++] = e; - switch (target->type) + switch (target->bl_type) { case BL::PC: if (filter == FOREACH_FILTER::PC || filter == FOREACH_FILTER::ENTITY || (filter == FOREACH_FILTER::TARGET - && map[target->m].flag.pvp)) + && map[target->bl_m].flag.pvp)) break; else if (filter == FOREACH_FILTER::SPELL) { /* Check all spells bound to the caster */ @@ -1147,7 +1150,7 @@ void find_entities_in_area_c(entity_t *target, while (invoc) { - ADD_ENTITY(invoc->bl.id); + ADD_ENTITY(invoc->bl.bl_id); invoc = invoc->next_invocation; } } @@ -1185,7 +1188,7 @@ void find_entities_in_area_c(entity_t *target, return; } - ADD_ENTITY(target->id); + ADD_ENTITY(target->bl_id); #undef ADD_ENTITY } @@ -1405,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.id; + const int invocation_id = invocation->bl.bl_id; #define REFRESH_INVOCATION invocation = (invocation_t *) map_id2bl(invocation_id); if (!invocation) return interval_t::zero(); #ifdef DEBUG @@ -1493,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.id) + && recipient->npc_id != invocation->bl.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.id); + invocation->bl.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.id, + invocation->bl.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.id; + recipient->npc_id = invocation->bl.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.id, BeingRemoveWhy::DEAD, caster->fd); + clif_clearchar_id(invocation->bl.bl_id, BeingRemoveWhy::DEAD, caster->fd); } REFRESH_INVOCATION; // Script may have killed the caster break; @@ -1581,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.id)); + invocation->bl.bl_id)); } /* If 0, the script cleaned itself. If -1(wait-for-script), we must wait for the user. */ @@ -1635,7 +1638,7 @@ int spell_attack(int caster_id, int target_id) caster->attack_spell_charges--; } - if (invocation && caster->attack_spell_override != invocation->bl.id) + if (invocation && caster->attack_spell_override != invocation->bl.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 6f8a357..2d0c1de 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -151,41 +151,41 @@ int map_addblock(struct block_list *bl) nullpo_ret(bl); - if (bl->prev != NULL) + if (bl->bl_prev != NULL) { if (battle_config.error_log) - PRINTF("map_addblock error : bl->prev!=NULL\n"); + PRINTF("map_addblock error : bl->bl_prev!=NULL\n"); return 0; } - m = bl->m; - x = bl->x; - y = bl->y; + m = bl->bl_m; + x = bl->bl_x; + y = bl->bl_y; if (m < 0 || m >= map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys) return 1; - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { - bl->next = + bl->bl_next = map[m].block_mob[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs]; - bl->prev = &bl_head; - if (bl->next) - bl->next->prev = bl; + bl->bl_prev = &bl_head; + if (bl->bl_next) + bl->bl_next->bl_prev = bl; map[m].block_mob[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs] = bl; map[m].block_mob_count[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs]++; } else { - bl->next = + bl->bl_next = map[m].block[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs]; - bl->prev = &bl_head; - if (bl->next) - bl->next->prev = bl; + bl->bl_prev = &bl_head; + if (bl->bl_next) + bl->bl_next->bl_prev = bl; map[m].block[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs] = bl; map[m].block_count[x / BLOCK_SIZE + (y / BLOCK_SIZE) * map[m].bxs]++; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) map[m].users++; } @@ -203,46 +203,46 @@ int map_delblock(struct block_list *bl) nullpo_ret(bl); // 既にblocklistから抜けている - if (bl->prev == NULL) + if (bl->bl_prev == NULL) { - if (bl->next != NULL) + if (bl->bl_next != NULL) { // prevがNULLでnextがNULLでないのは有ってはならない if (battle_config.error_log) - PRINTF("map_delblock error : bl->next!=NULL\n"); + PRINTF("map_delblock error : bl->bl_next!=NULL\n"); } return 0; } - b = bl->x / BLOCK_SIZE + (bl->y / BLOCK_SIZE) * map[bl->m].bxs; + b = bl->bl_x / BLOCK_SIZE + (bl->bl_y / BLOCK_SIZE) * map[bl->bl_m].bxs; - if (bl->type == BL::PC) - map[bl->m].users--; + if (bl->bl_type == BL::PC) + map[bl->bl_m].users--; - if (bl->next) - bl->next->prev = bl->prev; - if (bl->prev == &bl_head) + if (bl->bl_next) + bl->bl_next->bl_prev = bl->bl_prev; + if (bl->bl_prev == &bl_head) { // リストの頭なので、map[]のblock_listを更新する - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { - map[bl->m].block_mob[b] = bl->next; - if ((map[bl->m].block_mob_count[b]--) < 0) - map[bl->m].block_mob_count[b] = 0; + map[bl->bl_m].block_mob[b] = bl->bl_next; + if ((map[bl->bl_m].block_mob_count[b]--) < 0) + map[bl->bl_m].block_mob_count[b] = 0; } else { - map[bl->m].block[b] = bl->next; - if ((map[bl->m].block_count[b]--) < 0) - map[bl->m].block_count[b] = 0; + map[bl->bl_m].block[b] = bl->bl_next; + if ((map[bl->bl_m].block_count[b]--) < 0) + map[bl->bl_m].block_count[b] = 0; } } else { - bl->prev->next = bl->next; + bl->bl_prev->bl_next = bl->bl_next; } - bl->next = NULL; - bl->prev = NULL; + bl->bl_next = NULL; + bl->bl_prev = NULL; return 0; } @@ -265,16 +265,16 @@ int map_count_oncell(int m, int x, int y) bl = map[m].block[bx + by * map[m].bxs]; c = map[m].block_count[bx + by * map[m].bxs]; - for (i = 0; i < c && bl; i++, bl = bl->next) + for (i = 0; i < c && bl; i++, bl = bl->bl_next) { - if (bl->x == x && bl->y == y && bl->type == BL::PC) + if (bl->bl_x == x && bl->bl_y == y && bl->bl_type == BL::PC) count++; } bl = map[m].block_mob[bx + by * map[m].bxs]; c = map[m].block_mob_count[bx + by * map[m].bxs]; - for (i = 0; i < c && bl; i++, bl = bl->next) + for (i = 0; i < c && bl; i++, bl = bl->bl_next) { - if (bl->x == x && bl->y == y) + if (bl->bl_x == x && bl->bl_y == y) count++; } if (!count) @@ -312,14 +312,14 @@ void map_foreachinarea(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block[bx + by * map[m].bxs]; int c = map[m].block_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) + if (bl->bl_x >= x0 && bl->bl_x <= x1 + && bl->bl_y >= y0 && bl->bl_y <= y1) bl_list.push_back(bl); } } @@ -331,12 +331,12 @@ void map_foreachinarea(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block_mob[bx + by * map[m].bxs]; int c = map[m].block_mob_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) + if (bl->bl_x >= x0 && bl->bl_x <= x1 + && bl->bl_y >= y0 && bl->bl_y <= y1) bl_list.push_back(bl); } } @@ -345,7 +345,7 @@ void map_foreachinarea(std::function<void(struct block_list *)> func, MapBlockLock lock; for (struct block_list *bl : bl_list) - if (bl->prev) + if (bl->bl_prev) func(bl); } @@ -364,7 +364,7 @@ void map_foreachinmovearea(std::function<void(struct block_list *)> func, BL type) { std::vector<struct block_list *> bl_list; - // Note: the x0, y0, x1, y1 are bl.x, bl.y ± AREA_SIZE, + // Note: the x0, y0, x1, y1 are bl.bl_x, bl.bl_y ± AREA_SIZE, // but only a small subset actually needs to be done. if (dx == 0 || dy == 0) { @@ -398,26 +398,26 @@ void map_foreachinmovearea(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block[bx + by * map[m].bxs]; int c = map[m].block_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) + if (bl->bl_x >= x0 && bl->bl_x <= x1 + && bl->bl_y >= y0 && bl->bl_y <= y1) bl_list.push_back(bl); } bl = map[m].block_mob[bx + by * map[m].bxs]; c = map[m].block_mob_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1) + if (bl->bl_x >= x0 && bl->bl_x <= x1 + && bl->bl_y >= y0 && bl->bl_y <= y1) bl_list.push_back(bl); } } @@ -441,34 +441,34 @@ void map_foreachinmovearea(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block[bx + by * map[m].bxs]; int c = map[m].block_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (!(bl->x >= x0 && bl->x <= x1 - && bl->y >= y0 && bl->y <= y1)) + if (!(bl->bl_x >= x0 && bl->bl_x <= x1 + && bl->bl_y >= y0 && bl->bl_y <= y1)) continue; - if ((dx > 0 && bl->x < x0 + dx) - || (dx < 0 && bl->x > x1 + dx) - || (dy > 0 && bl->y < y0 + dy) - || (dy < 0 && bl->y > y1 + dy)) + if ((dx > 0 && bl->bl_x < x0 + dx) + || (dx < 0 && bl->bl_x > x1 + dx) + || (dy > 0 && bl->bl_y < y0 + dy) + || (dy < 0 && bl->bl_y > y1 + dy)) bl_list.push_back(bl); } bl = map[m].block_mob[bx + by * map[m].bxs]; c = map[m].block_mob_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (!(bl->x >= x0 && bl->x <= x1 && bl->y >= y0 - && bl->y <= y1)) + if (!(bl->bl_x >= x0 && bl->bl_x <= x1 && bl->bl_y >= y0 + && bl->bl_y <= y1)) continue; - if ((dx > 0 && bl->x < x0 + dx) - || (dx < 0 && bl->x > x1 + dx) - || (dy > 0 && bl->y < y0 + dy) - || (dy < 0 && bl->y > y1 + dy)) + if ((dx > 0 && bl->bl_x < x0 + dx) + || (dx < 0 && bl->bl_x > x1 + dx) + || (dy > 0 && bl->bl_y < y0 + dy) + || (dy < 0 && bl->bl_y > y1 + dy)) bl_list.push_back(bl); } } @@ -479,7 +479,7 @@ void map_foreachinmovearea(std::function<void(struct block_list *)> func, MapBlockLock lock; for (struct block_list *bl : bl_list) - if (bl->prev) + if (bl->bl_prev) func(bl); } @@ -500,13 +500,13 @@ void map_foreachincell(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block[bx + by * map[m].bxs]; int c = map[m].block_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (type != BL::NUL && bl->type != type) + if (type != BL::NUL && bl->bl_type != type) continue; - if (bl->x == x && bl->y == y) + if (bl->bl_x == x && bl->bl_y == y) bl_list.push_back(bl); } } @@ -515,11 +515,11 @@ void map_foreachincell(std::function<void(struct block_list *)> func, { struct block_list *bl = map[m].block_mob[bx + by * map[m].bxs]; int c = map[m].block_mob_count[bx + by * map[m].bxs]; - for (int i = 0; i < c && bl; i++, bl = bl->next) + for (int i = 0; i < c && bl; i++, bl = bl->bl_next) { if (!bl) continue; - if (bl->x == x && bl->y == y) + if (bl->bl_x == x && bl->bl_y == y) bl_list.push_back(bl); } } @@ -527,7 +527,7 @@ void map_foreachincell(std::function<void(struct block_list *)> func, MapBlockLock lock; for (struct block_list *bl : bl_list) - if (bl->prev) + if (bl->bl_prev) func(bl); } @@ -535,7 +535,7 @@ void map_foreachincell(std::function<void(struct block_list *)> func, * 床アイテムやエフェクト用の一時obj割り当て * object[]への保存とid_db登録まで * - * bl->idもこの中で設定して問題無い? + * bl->bl_idもこの中で設定して問題無い? *------------------------------------------ */ int map_addobject(struct block_list *bl) @@ -575,11 +575,11 @@ int map_delobjectnofree(int id, BL type) if (object[id] == NULL) return 0; - if (object[id]->type != type) + if (object[id]->bl_type != type) { FPRINTF(stderr, "Incorrect type: expected %d, got %d\n", type, - object[id]->type); + object[id]->bl_type); abort(); } @@ -613,7 +613,7 @@ int map_delobject(int id, BL type) return 0; map_delobjectnofree(id, type); - if (obj->type == BL::PC) // [Fate] Not sure where else to put this... I'm not sure where delobject for PCs is called from + if (obj->bl_type == BL::PC) // [Fate] Not sure where else to put this... I'm not sure where delobject for PCs is called from pc_cleanup((struct map_session_data *) obj); MapBlockLock::freeblock(obj); @@ -635,7 +635,7 @@ void map_foreachobject(std::function<void(struct block_list *)> func, if (!object[i]) continue; { - if (type != BL::NUL && object[i]->type != type) + if (type != BL::NUL && object[i]->bl_type != type) continue; bl_list.push_back(object[i]); } @@ -644,7 +644,7 @@ void map_foreachobject(std::function<void(struct block_list *)> func, MapBlockLock lock; for (struct block_list *bl : bl_list) - if (bl->prev || bl->next) + if (bl->bl_prev || bl->bl_next) func(bl); } @@ -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.type != BL::ITEM) + if (fitem == NULL || fitem->bl.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.id, BL::ITEM); + map_delobject(fitem->bl.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.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->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->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.id = map_addobject(&fitem->bl); - if (fitem->bl.id == 0) + fitem->bl.bl_id = map_addobject(&fitem->bl); + if (fitem->bl.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.id; + fitem->first_get_id = owners[0]->bl.bl_id; fitem->first_get_tick = tick + owner_protection[0]; if (owners[1]) - fitem->second_get_id = owners[1]->bl.id; + fitem->second_get_id = owners[1]->bl.bl_id; fitem->second_get_tick = tick + owner_protection[1]; if (owners[2]) - fitem->third_get_id = owners[2]->bl.id; + fitem->third_get_id = owners[2]->bl.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.id)); + fitem->bl.bl_id)); map_addblock(&fitem->bl); clif_dropflooritem(fitem); - return fitem->bl.id; + return fitem->bl.bl_id; } int map_addflooritem(struct item *item_data, int amount, @@ -808,7 +808,7 @@ void map_addiddb(struct block_list *bl) { nullpo_retv(bl); - id_db.put(bl->id, bl); + id_db.put(bl->bl_id, bl); } /*========================================== @@ -819,7 +819,7 @@ void map_deliddb(struct block_list *bl) { nullpo_retv(bl); - id_db.put(bl->id, nullptr); + id_db.put(bl->bl_id, nullptr); } /*========================================== @@ -882,7 +882,7 @@ void map_quit(struct map_session_data *sd) map_delblock(&sd->bl); - id_db.put(sd->bl.id, nullptr); + id_db.put(sd->bl.bl_id, nullptr); nick_db.put(sd->status.name, nullptr); charid_db.erase(sd->status.char_id); } @@ -905,7 +905,7 @@ struct map_session_data *map_id2sd(int id) struct block_list *bl; bl=numdb_search(id_db,id); - if (bl && bl->type==BL::PC) + if (bl && bl->bl_type==BL::PC) return (struct map_session_data*)bl; return NULL; */ @@ -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.id == id) + if (sd->bl.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.id, (struct block_list *)nd); + id_db.put(nd->bl.bl_id, (struct block_list *)nd); return i; } @@ -1108,8 +1108,8 @@ void map_removenpc(void) { clif_clearchar(&map[m].npc[i]->bl, BeingRemoveWhy::QUIT); map_delblock(&map[m].npc[i]->bl); - id_db.put(map[m].npc[i]->bl.id, nullptr); - if (map[m].npc[i]->bl.subtype == NpcSubtype::SCRIPT) + id_db.put(map[m].npc[i]->bl.bl_id, nullptr); + if (map[m].npc[i]->npc_subtype == NpcSubtype::SCRIPT) { // free(map[m].npc[i]->u.scr.script); // free(map[m].npc[i]->u.scr.label_list); @@ -1179,8 +1179,8 @@ DIR map_calc_dir(struct block_list *src, int x, int y) nullpo_retr(DIR::S, src); - dx = x - src->x; - dy = y - src->y; + dx = x - src->bl_x; + dy = y - src->bl_y; if (dx == 0 && dy == 0) { dir = DIR::S; @@ -1621,7 +1621,7 @@ void cleanup_sub(struct block_list *bl) { nullpo_retv(bl); - switch (bl->type) + switch (bl->bl_type) { case BL::PC: map_delblock(bl); // There is something better... @@ -1633,7 +1633,7 @@ void cleanup_sub(struct block_list *bl) mob_delete((struct mob_data *) bl); break; case BL::ITEM: - map_clearflooritem(bl->id); + map_clearflooritem(bl->bl_id); break; case BL::SPELL: spell_free_invocation((struct invocation *) bl); @@ -1763,7 +1763,7 @@ int map_scriptcont(struct map_session_data *sd, int id) if (!bl) return 0; - switch (bl->type) + switch (bl->bl_type) { case BL::NPC: return npc_scriptcont(sd, id); diff --git a/src/map/map.hpp b/src/map/map.hpp index ae96eb3..ff8da3a 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -37,11 +37,10 @@ constexpr interval_t DEFAULT_AUTOSAVE_INTERVAL = std::chrono::minutes(1); struct block_list { - struct block_list *next, *prev; - int id; - short m, x, y; - BL type; - NpcSubtype subtype; + struct block_list *bl_next, *bl_prev; + int bl_id; + short bl_m, bl_x, bl_y; + BL bl_type; }; struct walkpath_data @@ -281,6 +280,7 @@ struct npc_item_list struct npc_data { struct block_list bl; + NpcSubtype npc_subtype; short n; short npc_class; DIR dir; @@ -535,7 +535,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.m, sd->bl.x, sd->bl.y, ## __VA_ARGS__) + sd->status.char_id, sd->bl.bl_m, sd->bl.bl_x, sd->bl.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 58641a2..5f1b29e 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.prev = NULL; - md->bl.next = NULL; + md->bl.bl_prev = NULL; + md->bl.bl_next = NULL; md->n = 0; md->mob_class = mob_class; - md->bl.id = npc_get_new_npc_id(); + md->bl.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.m; + m = sd->bl.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.x; + x = sd->bl.bl_x; if (y <= 0) - y = sd->bl.y; + y = sd->bl.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.m = m; - md->bl.x = x; - md->bl.y = y; + md->bl.bl_m = m; + md->bl.bl_x = x; + md->bl.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.type = BL::MOB; + md->bl.bl_type = BL::MOB; map_addiddb(&md->bl); - mob_spawn(md->bl.id); + mob_spawn(md->bl.bl_id); } - return (amount > 0) ? md->bl.id : 0; + return (amount > 0) ? md->bl.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.m; + m = sd->bl.bl_m; else m = map_mapname2mapid(mapname); @@ -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.x; - y = md->bl.y; - if (bool(map_getcell(md->bl.m, x, y) & MapCell::UNWALKABLE)) + x = md->bl.bl_x; + y = md->bl.bl_y; + if (bool(map_getcell(md->bl.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.m, x + dx, y + dy) + if (bool(map_getcell(md->bl.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.m, x - AREA_SIZE, y - AREA_SIZE, + md->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, dx, dy, BL::PC); @@ -629,13 +629,13 @@ int mob_walk(struct mob_data *md, tick_t tick, unsigned char data) if (moveblock) map_delblock(&md->bl); - md->bl.x = x; - md->bl.y = y; + md->bl.bl_x = x; + md->bl.bl_y = y; if (moveblock) map_addblock(&md->bl); map_foreachinmovearea(std::bind(clif_mobinsight, ph::_1, md), - md->bl.m, x - AREA_SIZE, y - AREA_SIZE, + md->bl.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.id, md->walkpath.path_pos)); + md->bl.bl_id, md->walkpath.path_pos)); md->state.state = MS::WALK; if (md->walkpath.path_pos >= md->walkpath.path_len) @@ -690,9 +690,9 @@ int mob_check_attack(struct mob_data *md) return 0; } - if (tbl->type == BL::PC) + if (tbl->bl_type == BL::PC) tsd = (struct map_session_data *) tbl; - else if (tbl->type == BL::MOB) + else if (tbl->bl_type == BL::MOB) tmd = (struct mob_data *) tbl; else return 0; @@ -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.m != tbl->m || tbl->prev == NULL - || distance(md->bl.x, md->bl.y, tbl->x, tbl->y) >= 13) + || 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) { 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.m != tbl->m || tbl->prev == NULL - || distance(md->bl.x, md->bl.y, tbl->x, tbl->y) >= 13) + 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) { 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.x, md->bl.y, tbl->x, tbl->y) > range) + if (distance(md->bl.bl_x, md->bl.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->x, tbl->y); // 向き設定 + md->dir = map_calc_dir(&md->bl, tbl->bl_x, tbl->bl_y); // 向き設定 //clif_fixmobpos(md); @@ -789,16 +789,16 @@ int mob_attack(struct mob_data *md, tick_t 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->type == BL::PC && !map[tbl->m].flag.town) + 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), - tbl->m, tbl->x - radius, tbl->y - radius, - tbl->x + radius, tbl->y + radius, BL::PC); + 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->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.id, 0)); + md->bl.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.id, 0)); + md->bl.bl_id, 0)); } else md->state.state = MS::IDLE; @@ -853,20 +853,20 @@ 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.id, 0)); + md->bl.bl_id, 0)); else if (type) { md->attackabletime = tick + battle_get_amotion(&md->bl); md->timer = Timer(md->attackabletime, std::bind(mob_timer, ph::_1, ph::_2, - md->bl.id, 0)); + md->bl.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.id, 0)); + md->bl.bl_id, 0)); } } break; @@ -876,7 +876,7 @@ int mob_changestate(struct mob_data *md, MS state, bool type) 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.id)); + 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. md->deletetimer.cancel(); md->hp = md->target_id = md->attacked_id = 0; @@ -904,12 +904,12 @@ void mob_timer(TimerData *, tick_t tick, int id, unsigned char data) return; } - if (bl->type == BL::NUL || bl->type != BL::MOB) + if (bl->bl_type == BL::NUL || bl->bl_type != BL::MOB) return; md = (struct mob_data *) bl; - if (md->bl.prev == NULL || md->state.state == MS::DEAD) + if (md->bl.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.m, md->bl.x, md->bl.y, md->to_x, md->to_y, + if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.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.m, md->bl.x, md->bl.y, x, y, easy)) + && path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, x, y, easy)) return 1; md->state.walk_easy = easy; @@ -1006,13 +1006,13 @@ int mob_setdelayspawn(int id) if ((bl = map_id2bl(id)) == NULL) return -1; - if (!bl || bl->type == BL::NUL || bl->type != BL::MOB) + if (!bl || bl->bl_type == BL::NUL || bl->bl_type != BL::MOB) return -1; md = (struct mob_data *) bl; nullpo_retr(-1, md); - if (!md || md->bl.type != BL::MOB) + if (!md || md->bl.bl_type != BL::MOB) return -1; // Processing of MOB which is not revitalized @@ -1056,30 +1056,30 @@ int mob_spawn(int id) bl = map_id2bl(id); nullpo_retr(-1, bl); - if (!bl || bl->type == BL::NUL || bl->type != BL::MOB) + if (!bl || bl->bl_type == BL::NUL || bl->bl_type != BL::MOB) return -1; md = (struct mob_data *) bl; nullpo_retr(-1, md); - if (!md || md->bl.type == BL::NUL || md->bl.type != BL::MOB) + if (!md || md->bl.bl_type == BL::NUL || md->bl.bl_type != BL::MOB) return -1; md->last_spawntime = tick; - if (md->bl.prev != NULL) + if (md->bl.bl_prev != NULL) { map_delblock(&md->bl); } - md->bl.m = md->m; + md->bl.bl_m = md->m; { int i = 0; do { if (md->x0 == 0 && md->y0 == 0) { - x = random_::in(1, map[md->bl.m].xs - 2); - y = random_::in(1, map[md->bl.m].ys - 2); + x = random_::in(1, map[md->bl.bl_m].xs - 2); + y = random_::in(1, map[md->bl.bl_m].ys - 2); } else { @@ -1090,13 +1090,13 @@ int mob_spawn(int id) } i++; } - while (bool(map_getcell(md->bl.m, x, y) & MapCell::UNWALKABLE) + while (bool(map_getcell(md->bl.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.m].name); + // PRINTF("MOB spawn error %d @ %s\n",id,map[md->bl.bl_m].name); Timer(tick + std::chrono::seconds(5), std::bind(mob_delayspawn, ph::_1, ph::_2, id) @@ -1105,8 +1105,8 @@ int mob_spawn(int id) } } - md->to_x = md->bl.x = x; - md->to_y = md->bl.y = y; + md->to_x = md->bl.bl_x = x; + md->to_y = md->bl.bl_y = y; md->dir = DIR::S; map_addblock(&md->bl); @@ -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.x; + dx = md->to_x - md->bl.bl_x; if (dx < 0) dx = -1; else if (dx > 0) dx = 1; - dy = md->to_y - md->bl.y; + dy = md->to_y - md->bl.bl_y; if (dy < 0) dy = -1; else if (dy > 0) dy = 1; } - md->to_x = md->bl.x + dx; - md->to_y = md->bl.y + dy; + md->to_x = md->bl.bl_x + dx; + md->to_y = md->bl.bl_y + dy; if (dx != 0 || dy != 0) { mob_walktoxy_sub(md); @@ -1256,45 +1256,45 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range) nullpo_ret(md); nullpo_ret(bl); - dx = abs(bl->x - md->bl.x); - dy = abs(bl->y - md->bl.y); + dx = abs(bl->bl_x - md->bl.bl_x); + dy = abs(bl->bl_y - md->bl.bl_y); - if (bl && bl->type == BL::PC && battle_config.monsters_ignore_gm == 1) + if (bl && bl->bl_type == BL::PC && battle_config.monsters_ignore_gm == 1) { // option to have monsters ignore GMs [Valaris] struct map_session_data *sd; if ((sd = (struct map_session_data *) bl) != NULL && pc_isGM(sd)) return 0; } - if (md->bl.m != bl->m) // 違うャbプ + if (md->bl.bl_m != bl->bl_m) // 違うャbプ return 0; if (range > 0 && range < ((dx > dy) ? dx : dy)) // 遠すぎる return 0; - if (md->bl.x == bl->x && md->bl.y == bl->y) // 同じャX + if (md->bl.bl_x == bl->bl_x && md->bl.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.m, md->bl.x, md->bl.y, bl->x, bl->y, 0) != + if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, bl->bl_x, bl->bl_y, 0) != -1) return 1; - if (bl->type != BL::PC && bl->type != BL::MOB) + if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB) return 0; // 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.m, md->bl.x, md->bl.y, bl->x - dx, bl->y - dy, 0) != -1) + 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) return 1; for (i = 0; i < 9; i++) { - if (path_search(&wpd, md->bl.m, md->bl.x, md->bl.y, bl->x - 1 + i / 3, - bl->y - 1 + i % 3, 0) != -1) + if (path_search(&wpd, md->bl.bl_m, md->bl.bl_x, md->bl.bl_y, bl->bl_x - 1 + i / 3, + bl->bl_y - 1 + i % 3, 0) != -1) return 1; } return 0; @@ -1342,7 +1342,7 @@ int mob_target(struct mob_data *md, struct block_list *bl, int dist) || race == Race::_insect || race == Race::_demon)) { - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { sd = (struct map_session_data *) bl; nullpo_ret(sd); @@ -1353,8 +1353,8 @@ int mob_target(struct mob_data *md, struct block_list *bl, int dist) return 0; } - md->target_id = bl->id; // Since there was no disturbance, it locks on to target. - if (bl->type == BL::PC || bl->type == BL::MOB) + md->target_id = bl->bl_id; // Since there was no disturbance, it locks on to target.bl_ + if (bl->bl_type == BL::PC || bl->bl_type == BL::MOB) md->state.attackable = true; else md->state.attackable = false; @@ -1382,9 +1382,9 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, nullpo_retv(smd); nullpo_retv(pcc); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) tsd = (struct map_session_data *) bl; - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) tmd = (struct mob_data *) bl; else return; @@ -1405,11 +1405,11 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, //対象がPCの場合 if (tsd && !pc_isdead(tsd) && - tsd->bl.m == smd->bl.m && + tsd->bl.bl_m == smd->bl.bl_m && !tsd->invincible_timer && !pc_isinvisible(tsd) && (dist = - distance(smd->bl.x, smd->bl.y, tsd->bl.x, tsd->bl.y)) < 9) + distance(smd->bl.bl_x, smd->bl.bl_y, tsd->bl.bl_x, tsd->bl.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.id; + smd->target_id = tsd->bl.bl_id; smd->state.attackable = true; smd->min_chase = 13; } @@ -1430,16 +1430,16 @@ void mob_ai_sub_hard_activesearch(struct block_list *bl, } //対象がMobの場合 else if (tmd && - tmd->bl.m == smd->bl.m && + tmd->bl.bl_m == smd->bl.bl_m && (dist = - distance(smd->bl.x, smd->bl.y, tmd->bl.x, tmd->bl.y)) < 9) + distance(smd->bl.bl_x, smd->bl.bl_y, tmd->bl.bl_x, tmd->bl.bl_y)) < 9) { // 到達可能性判定 if (mob_can_reach(smd, bl, 12) && random_::chance({1, ++*pcc})) { // 範囲内で等確率にする - smd->target_id = bl->id; + smd->target_id = bl->bl_id; smd->state.attackable = true; smd->min_chase = 13; } @@ -1474,15 +1474,15 @@ 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->m == md->bl.m - && (dist = distance(md->bl.x, md->bl.y, bl->x, bl->y)) < 9) + 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) { // Reachability judging if (mob_can_reach(md, bl, 12) && random_::chance({1, ++*itc})) { // It is made a probability, such as within the limits PC. - md->target_id = bl->id; + md->target_id = bl->bl_id; md->state.attackable = false; md->min_chase = 13; } @@ -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.m == md->bl.m + && tmd->bl.bl_m == md->bl.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.type != BL::MOB || mmd->bl.id != md->master_id) + if (!mmd || mmd->bl.bl_type != BL::MOB || mmd->bl.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.m != md->bl.m) + if (mmd->bl.bl_m != md->bl.bl_m) { - mob_warp(md, mmd->bl.m, mmd->bl.x, mmd->bl.y, BeingRemoveWhy::WARPED); + mob_warp(md, mmd->bl.bl_m, mmd->bl.bl_x, mmd->bl.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.x, md->bl.y, mmd->bl.x, mmd->bl.y); + md->master_dist = distance(md->bl.bl_x, md->bl.bl_y, mmd->bl.bl_x, mmd->bl.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.x, mmd->bl.y, BeingRemoveWhy::WARPED); + mob_warp(md, -1, mmd->bl.bl_x, mmd->bl.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.x - md->bl.x; - dy = mmd->bl.y - md->bl.y; + dx = mmd->bl.bl_x - md->bl.bl_x; + dy = mmd->bl.bl_y - md->bl.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.x - md->bl.x + random_::in(-3, 3); - dy = mmd->bl.y - md->bl.y + random_::in(-3, 3); + 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); } - ret = mob_walktoxy(md, md->bl.x + dx, md->bl.y + dy, 0); + ret = mob_walktoxy(md, md->bl.bl_x + dx, md->bl.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.x; - dy += mmd->bl.y; + dx += mmd->bl.bl_x; + dy += mmd->bl.bl_y; - ret = mob_walktoxy(md, mmd->bl.x + dx, mmd->bl.y + dy, 0); + ret = mob_walktoxy(md, mmd->bl.bl_x + dx, mmd->bl.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.id; + md->target_id = sd->bl.bl_id; md->state.attackable = true; md->min_chase = - 5 + distance(md->bl.x, md->bl.y, sd->bl.x, sd->bl.y); + 5 + distance(md->bl.bl_x, md->bl.bl_y, sd->bl.bl_x, sd->bl.bl_y); md->state.master_check = 1; } } @@ -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.x + random_::in(-d, d); - y = md->bl.y + random_::in(-d, d); - if (!bool(map_getcell(md->bl.m, x, y) & MapCell::UNWALKABLE) + 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) && 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.id, md->mob_class); + md->bl.bl_id, md->mob_class); md->move_fail_count = 0; - mob_spawn(md->bl.id); + mob_spawn(md->bl.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.prev == NULL) + if (md->skilltimer || md->bl.bl_prev == NULL) { // Under a skill aria and death if (tick > md->next_walktime + MIN_MOBTHINKTIME) @@ -1779,8 +1779,8 @@ 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.m, md->bl.x - 13, md->bl.y - 13, - md->bl.x + 13, md->bl.y + 13, BL::MOB); + 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); } } } @@ -1794,12 +1794,12 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) struct map_session_data *asd = NULL; if (abl) { - if (abl->type == BL::PC) + if (abl->bl_type == BL::PC) asd = (struct map_session_data *) abl; - if (asd == NULL || md->bl.m != abl->m || abl->prev == NULL + if (asd == NULL || md->bl.bl_m != abl->bl_m || abl->bl_prev == NULL || asd->invincible_timer || pc_isinvisible(asd) || (dist = - distance(md->bl.x, md->bl.y, abl->x, abl->y)) >= 32 + distance(md->bl.bl_x, md->bl.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.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, + 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::NUL); } else { map_foreachinarea(std::bind(mob_ai_sub_hard_activesearch, ph::_1, md, &i), - 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); + 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); } } @@ -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.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); + 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); } // It will attack, if the candidate for an attack is. @@ -1857,16 +1857,16 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) { if ((tbl = map_id2bl(md->target_id))) { - if (tbl->type == BL::PC) + if (tbl->bl_type == BL::PC) tsd = (struct map_session_data *) tbl; - else if (tbl->type == BL::MOB) + else if (tbl->bl_type == BL::MOB) tmd = (struct mob_data *) tbl; if (tsd || tmd) { - if (tbl->m != md->bl.m || tbl->prev == NULL + if (tbl->bl_m != md->bl.bl_m || tbl->bl_prev == NULL || (dist = - distance(md->bl.x, md->bl.y, tbl->x, - tbl->y)) >= md->min_chase) + distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, + tbl->bl_y)) >= md->min_chase) mob_unlocktarget(md, tick); // 別マップか、視界外 else if (tsd && !bool(mode & MobMode::BOSS) && (tsd->state.gangsterparadise @@ -1887,7 +1887,7 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) mobskill_use(md, tick, MobSkillCondition::ANY); if (md->timer && md->state.state != MS::ATTACK && (md->next_walktime < tick - || distance(md->to_x, md->to_y, tbl->x, tbl->y) < 2)) + || distance(md->to_x, md->to_y, tbl->bl_x, tbl->bl_y) < 2)) return; // 既に移動中 if (!mob_can_reach(md, tbl, (md->min_chase > 13) ? md->min_chase : 13)) mob_unlocktarget(md, tick); // 移動できないのでタゲ解除(IWとか?) @@ -1901,8 +1901,8 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) if (i == 0) { // 最初はAEGISと同じ方法で検索 - dx = tbl->x - md->bl.x; - dy = tbl->y - md->bl.y; + dx = tbl->bl_x - md->bl.bl_x; + dy = tbl->bl_y - md->bl.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->x - md->bl.x + random_::in(-1, 1); - dy = tbl->y - md->bl.y + random_::in(-1, 1); + dx = tbl->bl_x - md->bl.bl_x + random_::in(-1, 1); + dy = tbl->bl_y - md->bl.bl_y + random_::in(-1, 1); } - ret = mob_walktoxy(md, md->bl.x + dx, md->bl.y + dy, 0); + ret = mob_walktoxy(md, md->bl.bl_x + dx, md->bl.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.x + dx, md->bl.y + dy, + mob_walktoxy(md, md->bl.bl_x + dx, md->bl.bl_y + dy, 0); } } @@ -1952,10 +1952,10 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) } else { // ルートモンスター処理 - if (tbl == NULL || tbl->type != BL::ITEM || tbl->m != md->bl.m + if (tbl == NULL || tbl->bl_type != BL::ITEM || tbl->bl_m != md->bl.bl_m || (dist = - distance(md->bl.x, md->bl.y, tbl->x, - tbl->y)) >= md->min_chase || !md->lootitem) + distance(md->bl.bl_x, md->bl.bl_y, tbl->bl_x, + tbl->bl_y)) >= md->min_chase || !md->lootitem) { // 遠すぎるかアイテムがなくなった mob_unlocktarget(md, tick); @@ -1975,12 +1975,12 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) mobskill_use(md, tick, MobSkillCondition::ANY); if (md->timer && md->state.state != MS::ATTACK && (md->next_walktime < tick - || distance(md->to_x, md->to_y, tbl->x, tbl->y) <= 0)) + || 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->x - md->bl.x; - dy = tbl->y - md->bl.y; - ret = mob_walktoxy(md, md->bl.x + dx, md->bl.y + dy, 0); + 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); if (ret) mob_unlocktarget(md, tick); // 移動できないのでタゲ解除(IWとか?) } @@ -2008,7 +2008,7 @@ void mob_ai_sub_hard(struct block_list *bl, tick_t tick) memcpy(&md->lootitem[LOOTITEM_SIZE - 1], &fitem->item_data, sizeof(md->lootitem[0])); } - map_clearflooritem(tbl->id); + map_clearflooritem(tbl->bl_id); mob_unlocktarget(md, tick); } return; @@ -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.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); + 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); } /*========================================== @@ -2087,7 +2087,7 @@ void mob_ai_sub_lazy(struct block_list *bl, tick_t tick) { nullpo_retv(bl); - if (bl->type != BL::MOB) + if (bl->bl_type != BL::MOB) return; struct mob_data *md = (struct mob_data *)bl; @@ -2096,7 +2096,7 @@ void mob_ai_sub_lazy(struct block_list *bl, tick_t tick) return; md->last_thinktime = tick; - if (md->bl.prev == NULL || md->skilltimer) + if (md->bl.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.m].users > 0) + if (map[md->bl.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.id); + mob_spawn(md->bl.bl_id); } else @@ -2254,13 +2254,13 @@ int mob_delete(struct mob_data *md) { nullpo_retr(1, md); - if (md->bl.prev == NULL) + if (md->bl.bl_prev == NULL) return 1; mob_changestate(md, MS::DEAD, 0); clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); map_delblock(&md->bl); mob_deleteslave(md); - mob_setdelayspawn(md->bl.id); + mob_setdelayspawn(md->bl.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.prev == NULL) + if (md->bl.bl_prev == NULL) return 1; mob_changestate(md, MS::DEAD, 0); clif_clearchar(&md->bl, type); map_delblock(&md->bl); - mob_setdelayspawn(md->bl.id); + mob_setdelayspawn(md->bl.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.id), - md->bl.m, 0, 0, - map[md->bl.m].xs, map[md->bl.m].ys, BL::MOB); + 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); return 0; } @@ -2349,19 +2349,19 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, nullpo_ret(md); //srcはNULLで呼ばれる場合もあるので、他でチェック - if (src && src->id == md->master_id + if (src && src->bl_id == md->master_id && bool(md->mode & MobMode::TURNS_AGAINST_BAD_MASTER)) { /* If the master hits a monster, have the monster turn against him */ md->master_id = 0; md->mode = MobMode::war; /* Regular war mode */ - md->target_id = src->id; - md->attacked_id = src->id; + md->target_id = src->bl_id; + md->attacked_id = src->bl_id; } max_hp = battle_get_max_hp(&md->bl); - if (src && src->type == BL::PC) + if (src && src->bl_type == BL::PC) { sd = (struct map_session_data *) src; mvp_sd = sd; @@ -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.prev == NULL) + if (md->bl.bl_prev == NULL) { if (battle_config.error_log == 1) PRINTF("mob_damage : BlockError!!\n"); @@ -2378,7 +2378,7 @@ 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.prev != NULL) + if (md->bl.bl_prev != NULL) { mob_changestate(md, MS::DEAD, 0); // It is skill at the time of death. @@ -2386,7 +2386,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); map_delblock(&md->bl); - mob_setdelayspawn(md->bl.id); + mob_setdelayspawn(md->bl.bl_id); } return 0; } @@ -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.id) + if (md->dmglog[i].id == sd->bl.bl_id) break; if (md->dmglog[i].id == 0) { @@ -2427,23 +2427,23 @@ 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.id; + md->dmglog[minpos].id = sd->bl.bl_id; md->dmglog[minpos].dmg = damage; } if (md->attacked_id <= 0 && md->state.special_mob_ai == 0) - md->attacked_id = sd->bl.id; + md->attacked_id = sd->bl.bl_id; } - if (src && src->type == BL::MOB + if (src && src->bl_type == BL::MOB && ((struct mob_data *) src)->state.special_mob_ai) { struct mob_data *md2 = (struct mob_data *) src; struct block_list *master_bl = map_id2bl(md2->master_id); - if (master_bl && master_bl->type == BL::PC) + if (master_bl && master_bl->bl_type == BL::PC) { 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.id, md2->mob_class, md->bl.id, md->mob_class, + md2->bl.bl_id, md2->mob_class, md->bl.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.id); + MAP_LOG("MOB%d DEAD", md->bl.bl_id); // ----- ここから死亡処理 ----- @@ -2500,7 +2500,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, max_hp = battle_get_max_hp(&md->bl); - if (src && src->type == BL::MOB) + if (src && src->bl_type == BL::MOB) mob_unlocktarget((struct mob_data *) src, tick); // map外に消えた人は計算から除くので @@ -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.m != md->bl.m || pc_isdead(tmpsd[i])) + if (tmpsd[i]->bl.bl_m != md->bl.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.m].flag.pvp == 0) || (battle_config.pvp_exp == 1)) + if ((map[md->bl.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.m != md->bl.m) + if (tmpsd[i] == NULL || tmpsd[i]->bl.bl_m != md->bl.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.m, pt[i].base_exp, + party_exp_share(pt[i].p, md->bl.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.m; - ditem->x = md->bl.x; - ditem->y = md->bl.y; + ditem->m = md->bl.bl_m; + ditem->x = md->bl.bl_x; + ditem->y = md->bl.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.m; - ditem->x = md->bl.x; - ditem->y = md->bl.y; + ditem->m = md->bl.bl_m; + ditem->x = md->bl.bl_x; + ditem->y = md->bl.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.m == tmp_sd->bl.m) + if (md->bl.bl_m == tmp_sd->bl.bl_m) { sd = tmp_sd; break; @@ -2716,7 +2716,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, clif_clearchar(&md->bl, BeingRemoveWhy::DEAD); map_delblock(&md->bl); mob_deleteslave(md); - mob_setdelayspawn(md->bl.id); + mob_setdelayspawn(md->bl.bl_id); return 0; } @@ -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.id, md->bl.x, md->bl.y), - md->bl.m, x - AREA_SIZE, y - AREA_SIZE, + 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, x + AREA_SIZE, y + AREA_SIZE, BL::MOB); return 0; } @@ -2777,15 +2777,15 @@ int mob_warp(struct mob_data *md, int m, int x, int y, BeingRemoveWhy type) nullpo_ret(md); - if (md->bl.prev == NULL) + if (md->bl.bl_prev == NULL) return 0; if (m < 0) - m = md->bl.m; + m = md->bl.bl_m; if (type != BeingRemoveWhy::NEGATIVE1) { - if (map[md->bl.m].flag.monster_noteleport) + if (map[md->bl.bl_m].flag.monster_noteleport) return 0; clif_clearchar(&md->bl, type); } @@ -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.x = md->to_x = x; - md->bl.y = md->to_y = y; - md->bl.m = m; + md->bl.bl_x = md->to_x = x; + md->bl.bl_y = md->to_y = y; + md->bl.bl_m = m; } else { if (battle_config.error_log == 1) - PRINTF("MOB %d warp failed, mob_class = %d\n", md->bl.id, md->mob_class); + PRINTF("MOB %d warp failed, mob_class = %d\n", md->bl.bl_id, md->mob_class); } md->target_id = 0; // タゲを解除する @@ -2837,7 +2837,7 @@ 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.id, x, y, + PRINTF("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl.bl_id, x, y, md->mob_class); } @@ -2845,7 +2845,7 @@ int mob_warp(struct mob_data *md, int m, int x, int y, BeingRemoveWhy type) if (type != BeingRemoveWhy::GONE && type != BeingRemoveWhy::NEGATIVE1) { clif_spawnmob(md); - mob_warpslave(md, md->bl.x, md->bl.y); + mob_warpslave(md, md->bl.bl_x, md->bl.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.id, &c), - md->bl.m, 0, 0, - map[md->bl.m].xs - 1, map[md->bl.m].ys - 1, BL::MOB); + 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); 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.x; - by = md2->bl.y; - m = md2->bl.m; + bx = md2->bl.bl_x; + by = md2->bl.bl_y; + m = md2->bl.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.prev = NULL; - md->bl.next = NULL; - md->bl.m = m; - md->bl.x = x; - md->bl.y = y; + 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->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.type = BL::MOB; + md->bl.bl_type = BL::MOB; map_addiddb(&md->bl); - mob_spawn(md->bl.id); + mob_spawn(md->bl.bl_id); if (flag) - md->master_id = md2->bl.id; + md->master_id = md2->bl.bl_id; } } return 0; @@ -2976,16 +2976,16 @@ void mob_counttargeted_sub(struct block_list *bl, nullpo_retv(bl); nullpo_retv(c); - if (id == bl->id || (src && id == src->id)) + if (id == bl->bl_id || (src && id == src->bl_id)) return; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; if (sd && sd->attacktarget == id && sd->attacktimer && sd->attacktarget_lv >= target_lv) (*c)++; } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { struct mob_data *md = (struct mob_data *) bl; if (md && md->target_id == id && md->timer @@ -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.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, + 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, BL::NUL); return c; } @@ -3031,10 +3031,10 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id) return; if ((md = (struct mob_data *) mbl) == NULL) { - PRINTF("mobskill_castend_id nullpo mbl->id:%d\n", mbl->id); + PRINTF("mobskill_castend_id nullpo mbl->bl_id:%d\n", mbl->bl_id); return; } - if (md->bl.type != BL::MOB || md->bl.prev == NULL) + if (md->bl.bl_type != BL::MOB || md->bl.bl_prev == NULL) return; if (bool(md->opt1)) @@ -3043,12 +3043,12 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id) if (md->skillid != SkillID::NPC_EMOTION) md->last_thinktime = tick + battle_get_adelay(&md->bl); - if ((bl = map_id2bl(md->skilltarget)) == NULL || bl->prev == NULL) + if ((bl = map_id2bl(md->skilltarget)) == NULL || bl->bl_prev == NULL) { //スキルターゲットが存在しない //PRINTF("mobskill_castend_id nullpo\n");//ターゲットがいないときはnullpoじゃなくて普通に終了 return; } - if (md->bl.m != bl->m) + if (md->bl.bl_m != bl->bl_m) return; if (((skill_get_inf(md->skillid) & 1) || (skill_get_inf2(md->skillid) & 4)) && // 彼我敵対関係チェック @@ -3057,7 +3057,7 @@ void mobskill_castend_id(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.x, md->bl.y, bl->x, bl->y)) + if (range + battle_config.mob_skill_add_range < distance(md->bl.bl_x, md->bl.bl_y, bl->bl_x, bl->bl_y)) return; md->skilldelay[md->skillidx] = tick; @@ -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.type != BL::MOB || md->bl.prev == NULL) + if (md->bl.bl_type != BL::MOB || md->bl.bl_prev == NULL) return; if (bool(md->opt1)) @@ -3109,7 +3109,7 @@ 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.x, md->bl.y, md->skillx, md->skilly)) + if (range + battle_config.mob_skill_add_range < distance(md->bl.bl_x, md->bl.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->prev == NULL || md->bl.prev == NULL) + if (target->bl_prev == NULL || md->bl.bl_prev == NULL) return 0; skill_id = ms->skill_id; @@ -3147,7 +3147,7 @@ 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.id == target->id) + if (skill_get_inf2(skill_id) & 0x200 && md->bl.bl_id == target->bl_id) return 0; // 射程と障害物チェック @@ -3166,13 +3166,13 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target, if (battle_config.mob_skill_log == 1) PRINTF("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n", - target->id, skill_id, skill_lv, + target->bl_id, skill_id, skill_lv, static_cast<uint32_t>(casttime.count()), md->mob_class); if (casttime <= interval_t::zero()) // 詠唱の無いものはキャンセルされない md->state.skillcastcancel = 0; - md->skilltarget = target->id; + md->skilltarget = target->bl_id; md->skillx = 0; md->skilly = 0; md->skillid = skill_id; @@ -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.id)); + md->bl.bl_id)); } else { assert (!md->skilltimer); - mobskill_castend_id(nullptr, gettick(), md->bl.id); + mobskill_castend_id(nullptr, gettick(), md->bl.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.prev == NULL) + if (md->bl.bl_prev == NULL) return 0; SkillID skill_id = ms->skill_id; @@ -3221,10 +3221,10 @@ int mobskill_use_pos(struct mob_data *md, return 0; // 射程と障害物チェック - bl.type = BL::NUL; - bl.m = md->bl.m; - bl.x = skill_x; - bl.y = skill_y; + bl.bl_type = BL::NUL; + bl.bl_m = md->bl.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); @@ -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.id)); + md->bl.bl_id)); } else { assert (!md->skilltimer); - mobskill_castend_pos(nullptr, gettick(), md->bl.id); + mobskill_castend_pos(nullptr, gettick(), md->bl.bl_id); } return 1; @@ -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.m].flag.town; + flag = !map[md->bl.bl_m].flag.town; break; case MobSkillCondition::MSC_SLAVELT: // slave < num flag = (mob_countslave(md) < ms[ii].cond2i); @@ -3343,8 +3343,8 @@ int mobskill_use(struct mob_data *md, tick_t tick, if (bl) { - x = bl->x; - y = bl->y; + x = bl->bl_x; + y = bl->bl_y; } } if (x <= 0 || y <= 0) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 440d1a1..6c0c842 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -68,16 +68,16 @@ void npc_enable_sub(struct block_list *bl, struct npc_data *nd) nullpo_retv(bl); - if (bl->type == BL::PC && (sd = (struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && (sd = (struct map_session_data *) bl)) { if (nd->flag & 1) // 無効化されている return; memcpy(name, nd->name, sizeof(nd->name)); - if (sd->areanpc_id == nd->bl.id) + if (sd->areanpc_id == nd->bl.bl_id) return; // TODO fix leak of 'name' - sd->areanpc_id = nd->bl.id; + sd->areanpc_id = nd->bl.bl_id; npc_event(sd, strcat(name, "::OnTouch"), 0); } free(name); @@ -101,8 +101,8 @@ int npc_enable(const char *name, bool flag) } if (flag && (nd->u.scr.xs > 0 || nd->u.scr.ys > 0)) map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), - 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); + 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); return 0; } @@ -148,7 +148,7 @@ int npc_delete(struct npc_data *nd) { nullpo_retr(1, nd); - if (nd->bl.prev == NULL) + if (nd->bl.bl_prev == NULL) return 1; clif_clearchar(&nd->bl, BeingRemoveWhy::DEAD); @@ -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.id, nd->bl.id); + run_script(nd->u.scr.script, ev->pos, nd->bl.bl_id, nd->bl.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.id, argc, + run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.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.id, argc, + run_script_l(ev->nd->u.scr.script, ev->pos, rid, ev->nd->bl.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.id); + run_script(nd->u.scr.script, te->pos, 0, nd->bl.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.id, next)); + nd->bl.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.m != sd->bl.m) + if (nd->bl.bl_m != sd->bl.bl_m) return 1; if (xs > 0 - && (sd->bl.x < nd->bl.x - xs / 2 || nd->bl.x + xs / 2 < sd->bl.x)) + && (sd->bl.bl_x < nd->bl.bl_x - xs / 2 || nd->bl.bl_x + xs / 2 < sd->bl.bl_x)) return 1; if (ys > 0 - && (sd->bl.y < nd->bl.y - ys / 2 || nd->bl.y + ys / 2 < sd->bl.y)) + && (sd->bl.bl_y < nd->bl.bl_y - ys / 2 || nd->bl.bl_y + ys / 2 < sd->bl.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.id; + sd->npc_id = nd->bl.bl_id; sd->npc_pos = - run_script(nd->u.scr.script, ev->pos, sd->bl.id, nd->bl.id); + run_script(nd->u.scr.script, ev->pos, sd->bl.bl_id, nd->bl.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.id); + run_script(ev->nd->u.scr.script, ev->pos, 0, ev->nd->bl.bl_id); } } @@ -533,7 +533,7 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y) continue; } - switch (map[m].npc[i]->bl.subtype) + switch (map[m].npc[i]->npc_subtype) { case NpcSubtype::WARP: xs = map[m].npc[i]->u.warp.xs; @@ -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.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) + 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) break; } if (i == map[m].npc_num) @@ -562,7 +562,7 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y) } return 1; } - switch (map[m].npc[i]->bl.subtype) + switch (map[m].npc[i]->npc_subtype) { case NpcSubtype::WARP: skill_stop_dancing(&sd->bl, 0); @@ -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.id) + if (sd->areanpc_id == map[m].npc[i]->bl.bl_id) return 1; // TODO fix leak of 'name' - sd->areanpc_id = map[m].npc[i]->bl.id; + sd->areanpc_id = map[m].npc[i]->bl.bl_id; if (npc_event(sd, strcat(name, "::OnTouch"), 0) > 0) - npc_click(sd, map[m].npc[i]->bl.id); + npc_click(sd, map[m].npc[i]->bl.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.type != BL::NPC) + if (nd == NULL || nd->bl.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.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) + 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) return 1; return 0; @@ -648,14 +648,14 @@ int npc_click(struct map_session_data *sd, int id) return 1; sd->npc_id = id; - switch (nd->bl.subtype) + switch (nd->npc_subtype) { case NpcSubtype::SHOP: clif_npcbuysell(sd, id); npc_event_dequeue(sd); break; case NpcSubtype::SCRIPT: - sd->npc_pos = run_script(nd->u.scr.script, 0, sd->bl.id, id); + sd->npc_pos = run_script(nd->u.scr.script, 0, sd->bl.bl_id, id); break; case NpcSubtype::MESSAGE: if (nd->u.message) @@ -688,14 +688,14 @@ int npc_scriptcont(struct map_session_data *sd, int id) nd = (struct npc_data *) map_id2bl(id); - if (!nd /* NPC was disposed? */ || nd->bl.subtype == NpcSubtype::MESSAGE) + if (!nd /* NPC was disposed? */ || nd->npc_subtype == NpcSubtype::MESSAGE) { clif_scriptclose(sd, id); npc_event_dequeue(sd); return 0; } - sd->npc_pos = run_script(nd->u.scr.script, sd->npc_pos, sd->bl.id, id); + sd->npc_pos = run_script(nd->u.scr.script, sd->npc_pos, sd->bl.bl_id, id); return 0; } @@ -714,7 +714,7 @@ int npc_buysellsel(struct map_session_data *sd, int id, int type) return 1; nd = (struct npc_data *) map_id2bl(id); - if (nd->bl.subtype != NpcSubtype::SHOP) + if (nd->npc_subtype != NpcSubtype::SHOP) { if (battle_config.error_log) PRINTF("no such shop npc : %d\n", id); @@ -755,7 +755,7 @@ int npc_buylist(struct map_session_data *sd, int n, return 3; nd = (struct npc_data *) map_id2bl(sd->npc_shopid); - if (nd->bl.subtype != NpcSubtype::SHOP) + if (nd->npc_subtype != NpcSubtype::SHOP) return 3; for (i = 0, w = 0, z = 0; i < n; i++) @@ -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.id = npc_get_new_npc_id(); + nd->bl.bl_id = npc_get_new_npc_id(); nd->n = map_addnpc(m, nd); - nd->bl.prev = nd->bl.next = NULL; - nd->bl.m = m; - nd->bl.x = x; - nd->bl.y = y; + 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->dir = DIR::S; nd->flag = 0; memcpy(nd->name, w3, 24); @@ -1020,10 +1020,10 @@ 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.id); +// PRINTF("warp npc %s %d read done\n",mapname,nd->bl.bl_id); npc_warp++; - nd->bl.type = BL::NPC; - nd->bl.subtype = NpcSubtype::WARP; + nd->bl.bl_type = BL::NPC; + nd->npc_subtype = NpcSubtype::WARP; map_addblock(&nd->bl); 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.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->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->dir = dir; nd->flag = 0; memcpy(nd->name, w3, 24); @@ -1124,10 +1124,10 @@ 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.id); + //PRINTF("shop npc %s %d read done\n",mapname,nd->bl.bl_id); npc_shop++; - nd->bl.type = BL::NPC; - nd->bl.subtype = NpcSubtype::SHOP; + nd->bl.bl_type = BL::NPC; + nd->npc_subtype = NpcSubtype::SHOP; nd->n = map_addnpc(m, nd); map_addblock(&nd->bl); clif_spawnnpc(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.id; + src_id = nd2->bl.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.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->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->dir = dir; nd->flag = 0; nd->npc_class = npc_class; @@ -1367,10 +1367,10 @@ 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.id,nd->class); + //PRINTF("script npc %s %d %d read done\n",mapname,nd->bl.bl_id,nd->class); npc_script++; - nd->bl.type = BL::NPC; - nd->bl.subtype = NpcSubtype::SCRIPT; + nd->bl.bl_type = BL::NPC; + nd->npc_subtype = NpcSubtype::SCRIPT; if (m >= 0) { nd->n = map_addnpc(m, nd); @@ -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.prev = NULL; - md->bl.next = NULL; - md->bl.m = m; - md->bl.x = x; - md->bl.y = y; + 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; 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.id = npc_get_new_npc_id(); + md->bl.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.type = BL::MOB; + md->bl.bl_type = BL::MOB; map_addiddb(&md->bl); - mob_spawn(md->bl.id); + mob_spawn(md->bl.bl_id); npc_mob++; } - //PRINTF("warp npc %s %d read done\n",mapname,nd->bl.id); + //PRINTF("warp npc %s %d read done\n",mapname,nd->bl.bl_id); return 0; } @@ -1772,12 +1772,12 @@ 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.id = npc_get_new_npc_id(); - retval->bl.x = x; - retval->bl.y = y; - retval->bl.m = m; - retval->bl.type = BL::NPC; - retval->bl.subtype = NpcSubtype::MESSAGE; + 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->npc_subtype = NpcSubtype::MESSAGE; strncpy(retval->name, name, 23); strncpy(retval->exname, name, 23); @@ -1807,7 +1807,7 @@ void npc_free_internal(struct npc_data *nd) free(cd); cd = NULL; } - if (nd->bl.subtype == NpcSubtype::SCRIPT) + if (nd->npc_subtype == NpcSubtype::SCRIPT) { if (nd->u.scr.timer_event) free(nd->u.scr.timer_event); @@ -1825,7 +1825,7 @@ void npc_free_internal(struct npc_data *nd) } } } - else if (nd->bl.subtype == NpcSubtype::MESSAGE && nd->u.message) + else if (nd->npc_subtype == NpcSubtype::MESSAGE && nd->u.message) { free(nd->u.message); } @@ -1836,8 +1836,8 @@ static void npc_propagate_update(struct npc_data *nd) { map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), - 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); + 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); } void npc_free(struct npc_data *nd) diff --git a/src/map/party.cpp b/src/map/party.cpp index 893beb1..c2dc5c4 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.x || sd->party_y != sd->bl.y) + if (sd->party_x != sd->bl.bl_x || sd->party_y != sd->bl.bl_y) { clif_party_xy(p, sd); - sd->party_x = sd->bl.x; - sd->party_y = sd->bl.y; + sd->party_x = sd->bl.bl_x; + sd->party_y = sd->bl.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.m == mapid) + if ((sd = p->member[i].sd) != NULL && sd->bl.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.m == mapid) + if ((sd = p->member[i].sd) != NULL && sd->bl.bl_m == mapid) pc_gainexp_reason(sd, base_exp / c + 1, job_exp / c + 1, PC_GAINEXP_REASON::SHARING); return 0; @@ -740,21 +740,21 @@ void party_foreachsamemap(std::function<void(struct block_list *)> func, if ((p = party_search(sd->status.party_id)) == NULL) return; - x0 = sd->bl.x - AREA_SIZE; - y0 = sd->bl.y - AREA_SIZE; - x1 = sd->bl.x + AREA_SIZE; - y1 = sd->bl.y + AREA_SIZE; + 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; for (i = 0; i < MAX_PARTY; i++) { struct party_member *m = &p->member[i]; if (m->sd != NULL) { - if (sd->bl.m != m->sd->bl.m) + if (sd->bl.bl_m != m->sd->bl.bl_m) continue; if (type != 0 && - (m->sd->bl.x < x0 || m->sd->bl.y < y0 || - m->sd->bl.x > x1 || m->sd->bl.y > y1)) + (m->sd->bl.bl_x < x0 || m->sd->bl.bl_y < y0 || + m->sd->bl.bl_x > x1 || m->sd->bl.bl_y > y1)) continue; list[blockcount++] = &m->sd->bl; } @@ -763,6 +763,6 @@ void party_foreachsamemap(std::function<void(struct block_list *)> func, MapBlockLock lock; for (i = 0; i < blockcount; i++) - if (list[i]->prev) // 有効かどうかチェック + if (list[i]->bl_prev) // 有効かどうかチェック func(list[i]); } diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 2518041..79a1222 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.type != BL::PC) + if (src->bl.bl_type != BL::PC) return 0; if (src->special_state.killer) return 1; - if (target->bl.type != BL::PC) + if (target->bl.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.type == BL::PC); + assert (sd->bl.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.id)); + sd->bl.bl_id)); return 0; } @@ -367,16 +367,16 @@ void pc_counttargeted_sub(struct block_list *bl, { nullpo_retv(bl); - if (id == bl->id || (src && id == src->id)) + if (id == bl->bl_id || (src && id == src->bl_id)) return; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; if (sd->attacktarget == id && sd->attacktimer && sd->attacktarget_lv >= target_lv) (*c)++; } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { struct mob_data *md = (struct mob_data *) bl; if (md->target_id == id && md->timer @@ -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.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); + 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); 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.x; - sd->status.last_point.y = sd->bl.y; + sd->status.last_point.x = sd->bl.bl_x; + sd->status.last_point.y = sd->bl.bl_y; } // セーブ禁止マップだったので指定位置に移動 - if (map[sd->bl.m].flag.nosave) + if (map[sd->bl.bl_m].flag.nosave) { - struct map_data *m = &map[sd->bl.m]; + struct map_data *m = &map[sd->bl.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.id = account_id; + sd->bl.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.type = BL::PC; + sd->bl.bl_type = BL::PC; sd->canact_tick = sd->canmove_tick = gettick(); sd->canlog_tick = gettick(); sd->state.waitingdisconnect = 0; @@ -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.m].flag.pvp + if (map[sd->bl.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.prev = sd->bl.next = NULL; + sd->bl.bl_prev = sd->bl.bl_next = NULL; sd->weapontype1 = sd->weapontype2 = ItemLook::NONE; sd->speed = DEFAULT_WALK_SPEED; @@ -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.id, + run_script_l(itemdb_equipscript(c), 0, sd->bl.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.id, + run_script_l(itemdb_equipscript(c), 0, sd->bl.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.id, 0, 2, arg); + sd->bl.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.id, 0, 2, arg); + sd->bl.bl_id, 0, 2, arg); } } else if (sd->inventory_data[index]->type == ItemType::ARMOR) @@ -1199,7 +1199,7 @@ 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.id, 0, 2, arg); + sd->bl.bl_id, 0, 2, arg); } } } @@ -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.id, + run_script_l(sd->inventory_data[index]->equip_script, 0, sd->bl.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.m, sd->bl.x, sd->bl.y, + sd->bl.bl_m, sd->bl.bl_x, sd->bl.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.id == other_id || !other_id) + if (!self || self->bl.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.m != self->bl.m) + if (other->bl.bl_m != self->bl.bl_m) return 1; else { - int distance_x = abs(other->bl.x - self->bl.x); - int distance_y = abs(other->bl.y - self->bl.y); + 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 = (distance_x > distance_y) ? distance_x : distance_y; return distance > battle_config.drop_pickup_safety_zone; @@ -2247,7 +2247,7 @@ 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.id); + map_clearflooritem(fitem->bl.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.m].flag.noteleport)) + && (map[sd->bl.bl_m].flag.noteleport)) { return 0; } - if (nameid == 602 && map[sd->bl.m].flag.noreturn) + if (nameid == 602 && map[sd->bl.bl_m].flag.noreturn) return 0; if (nameid == 604 - && (map[sd->bl.m].flag.nobranch)) + && (map[sd->bl.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.id, 0); + run_script(sd->inventory_data[n]->use_script, 0, sd->bl.bl_id, 0); clif_useitemack(sd, n, amount - 1, 1); pc_delitem(sd, n, 1, 1); @@ -2398,8 +2398,8 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y skill_gangsterparadise(sd, 0); map_delblock(&sd->bl); memcpy(sd->mapname, mapname, 24); - sd->bl.x = x; - sd->bl.y = y; + sd->bl.bl_x = x; + sd->bl.bl_y = y; sd->state.waitingdisconnect = 1; pc_makesavestatus(sd); //The storage close routines save the char data. [Skotlex] @@ -2437,7 +2437,7 @@ 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.prev != NULL) + if (sd->mapname[0] && sd->bl.bl_prev != NULL) { clif_clearchar(&sd->bl, clrtype); skill_gangsterparadise(sd, 0); @@ -2446,14 +2446,14 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y } memcpy(sd->mapname, mapname, 24); - sd->bl.m = m; + sd->bl.bl_m = m; sd->to_x = x; sd->to_y = y; // moved and changed dance effect stopping - sd->bl.x = x; - sd->bl.y = y; + sd->bl.bl_x = x; + sd->bl.bl_y = y; // map_addblock(&sd->bl); // ブロック登録とspawnは // clif_spawnpc(sd); @@ -2472,9 +2472,9 @@ int pc_randomwarp(struct map_session_data *sd, BeingRemoveWhy type) nullpo_ret(sd); - m = sd->bl.m; + m = sd->bl.bl_m; - if (map[sd->bl.m].flag.noteleport) // テレポート禁止 + if (map[sd->bl.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.x == x && sd->bl.y == y) // 同じマス + if (sd->bl.bl_x == x && sd->bl.bl_y == y) // 同じマス return 1; // 障害物判定 wpd.path_len = 0; wpd.path_pos = 0; wpd.path_half = 0; - return (path_search(&wpd, sd->bl.m, sd->bl.x, sd->bl.y, x, y, 0) != + return (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.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.x; - y = sd->bl.y; - if (bool(map_getcell(sd->bl.m, x, y) & MapCell::UNWALKABLE)) + x = sd->bl.bl_x; + y = sd->bl.bl_y; + if (bool(map_getcell(sd->bl.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.m, x + dx, y + dy) + if (bool(map_getcell(sd->bl.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.m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, dx, dy, BL::NUL); @@ -2599,13 +2599,13 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) if (moveblock) map_delblock(&sd->bl); - sd->bl.x = x; - sd->bl.y = y; + sd->bl.bl_x = x; + sd->bl.bl_y = y; if (moveblock) map_addblock(&sd->bl); map_foreachinmovearea(std::bind(clif_pcinsight, ph::_1, sd), - sd->bl.m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl.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.m, x - AREA_SIZE, y - AREA_SIZE, + sd->bl.bl_m, x - AREA_SIZE, y - AREA_SIZE, x + AREA_SIZE, y + AREA_SIZE, -dx, -dy, BL::PC); @@ -2635,8 +2635,8 @@ void pc_walk(TimerData *, tick_t tick, int id, unsigned char data) break; } - if (bool(map_getcell(sd->bl.m, x, y) & MapCell::NPC_NEAR)) - npc_touch_areanpc(sd, sd->bl.m, x, y); + if (bool(map_getcell(sd->bl.bl_m, x, y) & MapCell::NPC_NEAR)) + npc_touch_areanpc(sd, sd->bl.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.m, sd->bl.x, sd->bl.y, sd->to_x, sd->to_y, 0)) + if (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.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.id, 0)); + sd->bl.bl_id, 0)); } clif_movechar(sd); @@ -2724,8 +2724,8 @@ int pc_stop_walking(struct map_session_data *sd, int type) sd->walktimer.cancel(); sd->walkpath.path_len = 0; - sd->to_x = sd->bl.x; - sd->to_y = sd->bl.y; + sd->to_x = sd->bl.bl_x; + sd->to_y = sd->bl.bl_y; if (type & 0x01) clif_fixpos(&sd->bl); if (type & 0x02 && battle_config.pc_damage_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.m, sd->bl.x, sd->bl.y) & MapCell::NPC_NEAR)) - npc_touch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); + 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); 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.m, sd->bl.x, sd->bl.y, dst_x, dst_y, 0)) + if (path_search(&wpd, sd->bl.bl_m, sd->bl.bl_x, sd->bl.bl_y, dst_x, dst_y, 0)) return 1; sd->dir = sd->head_dir = map_calc_dir(&sd->bl, dst_x, dst_y); - dx = dst_x - sd->bl.x; - dy = dst_y - sd->bl.y; + dx = dst_x - sd->bl.bl_x; + dy = dst_y - sd->bl.bl_y; - moveblock = (sd->bl.x / BLOCK_SIZE != dst_x / BLOCK_SIZE - || sd->bl.y / BLOCK_SIZE != dst_y / BLOCK_SIZE); + moveblock = (sd->bl.bl_x / BLOCK_SIZE != dst_x / BLOCK_SIZE + || sd->bl.bl_y / BLOCK_SIZE != dst_y / BLOCK_SIZE); map_foreachinmovearea(std::bind(clif_pcoutsight, 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, + 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, dx, dy, BL::NUL); if (moveblock) map_delblock(&sd->bl); - sd->bl.x = dst_x; - sd->bl.y = dst_y; + sd->bl.bl_x = dst_x; + sd->bl.bl_y = dst_y; if (moveblock) map_addblock(&sd->bl); map_foreachinmovearea(std::bind(clif_pcinsight, 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, + 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, -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.m, sd->bl.x - AREA_SIZE, sd->bl.y - AREA_SIZE, - sd->bl.x + AREA_SIZE, sd->bl.y + AREA_SIZE, + 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, -dx, -dy, BL::PC); if (flag) @@ -2858,19 +2858,19 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) if (sd == NULL) return; - if (sd->bl.prev == NULL) + if (sd->bl.bl_prev == NULL) return; bl = map_id2bl(sd->attacktarget); - if (bl == NULL || bl->prev == NULL) + if (bl == NULL || bl->bl_prev == NULL) return; - if (bl->type == BL::PC && pc_isdead((struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && pc_isdead((struct map_session_data *) bl)) return; // 同じmapでないなら攻撃しない // PCが死んでても攻撃しない - if (sd->bl.m != bl->m || pc_isdead(sd)) + if (sd->bl.bl_m != bl->bl_m || pc_isdead(sd)) return; // 異常などで攻撃できない @@ -2903,29 +2903,29 @@ void pc_attack_timer(TimerData *, tick_t tick, int id) } else { - dist = distance(sd->bl.x, sd->bl.y, bl->x, bl->y); + dist = distance(sd->bl.bl_x, sd->bl.bl_y, bl->bl_x, bl->bl_y); range = sd->attackrange; if (sd->status.weapon != ItemLook::BOW) range++; if (dist > range) { // 届 かないので移動 - //if(pc_can_reach(sd,bl->x,bl->y)) + //if(pc_can_reach(sd,bl->bl_x,bl->bl_y)) //clif_movetoattack(sd,bl); return; } if (dist <= range && !battle_check_range(&sd->bl, bl, range)) { - if (pc_can_reach(sd, bl->x, bl->y) && sd->canmove_tick < tick) + if (pc_can_reach(sd, bl->bl_x, bl->bl_y) && sd->canmove_tick < tick) // TMW client doesn't support this - //pc_walktoxy(sd,bl->x,bl->y); + //pc_walktoxy(sd,bl->bl_x,bl->bl_y); clif_movetoattack(sd, bl); sd->attackabletime = tick + (sd->aspd * 2); } else { if (battle_config.pc_attack_direction_change) - sd->dir = sd->head_dir = map_calc_dir(&sd->bl, bl->x, bl->y); // 向き設定 + sd->dir = sd->head_dir = map_calc_dir(&sd->bl, bl->bl_x, bl->bl_y); // 向き設定 if (sd->walktimer) pc_stop_walking(sd, 1); @@ -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.id)); + sd->bl.bl_id)); } } @@ -2964,7 +2964,7 @@ int pc_attack(struct map_session_data *sd, int target_id, int type) if (bl == NULL) return 1; - if (bl->type == BL::NPC) + if (bl->bl_type == BL::NPC) { // monster npcs [Valaris] npc_click(sd, RFIFOL(sd->fd, 2)); return 0; @@ -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.id)); + sd->bl.bl_id)); } else { // 本来timer関数なので引数を合わせる - pc_attack_timer(nullptr, gettick(), sd->bl.id); + pc_attack_timer(nullptr, gettick(), sd->bl.bl_id); } return 0; @@ -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.prev == NULL || pc_isdead(sd)) + if (sd->bl.bl_prev == NULL || pc_isdead(sd)) return 0; - if ((battle_config.pvp_exp == 0) && map[sd->bl.m].flag.pvp) // [MouseJstr] + if ((battle_config.pvp_exp == 0) && map[sd->bl.bl_m].flag.pvp) // [MouseJstr] return 0; // no exp on pvp maps earray<const char *, PC_GAINEXP_REASON, PC_GAINEXP_REASON::COUNT> reasons //= @@ -3519,7 +3519,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, if (src) { - if (src->type == BL::PC) + if (src->bl_type == BL::PC) { MAP_LOG_PC(sd, "INJURED-BY PC%d FOR %d", ((struct map_session_data *) src)->status.char_id, @@ -3527,7 +3527,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, } else { - MAP_LOG_PC(sd, "INJURED-BY MOB%d FOR %d", src->id, damage); + MAP_LOG_PC(sd, "INJURED-BY MOB%d FOR %d", src->bl_id, damage); } } else @@ -3588,14 +3588,14 @@ 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.m].flag.nopenalty) + if (!map[sd->bl.bl_m].flag.nopenalty) { if (battle_config.death_penalty_type == 1 && battle_config.death_penalty_base > 0) sd->status.base_exp -= (double) pc_nextbaseexp(sd) * (double) battle_config.death_penalty_base / 10000; - if (battle_config.pk_mode && src && src->type == BL::PC) + if (battle_config.pk_mode && src && src->bl_type == BL::PC) sd->status.base_exp -= (double) pc_nextbaseexp(sd) * (double) battle_config.death_penalty_base / 10000; @@ -3606,7 +3606,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, sd->status.base_exp -= (double) sd->status.base_exp * (double) battle_config.death_penalty_base / 10000; - if (battle_config.pk_mode && src && src->type == BL::PC) + if (battle_config.pk_mode && src && src->bl_type == BL::PC) sd->status.base_exp -= (double) sd->status.base_exp * (double) battle_config.death_penalty_base / 10000; @@ -3620,7 +3620,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, sd->status.job_exp -= (double) pc_nextjobexp(sd) * (double) battle_config.death_penalty_job / 10000; - if (battle_config.pk_mode && src && src->type == BL::PC) + if (battle_config.pk_mode && src && src->bl_type == BL::PC) sd->status.job_exp -= (double) pc_nextjobexp(sd) * (double) battle_config.death_penalty_job / 10000; @@ -3631,7 +3631,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, sd->status.job_exp -= (double) sd->status.job_exp * (double) battle_config.death_penalty_job / 10000; - if (battle_config.pk_mode && src && src->type == BL::PC) + if (battle_config.pk_mode && src && src->bl_type == BL::PC) sd->status.job_exp -= (double) sd->status.job_exp * (double) battle_config.death_penalty_job / 10000; @@ -3643,13 +3643,13 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, } // pvp - if (map[sd->bl.m].flag.pvp && !battle_config.pk_mode) + if (map[sd->bl.bl_m].flag.pvp && !battle_config.pk_mode) { // disable certain pvp functions on pk_mode [Valaris] //ランキング計算 - if (!map[sd->bl.m].flag.pvp_nocalcrank) + if (!map[sd->bl.bl_m].flag.pvp_nocalcrank) { sd->pvp_point -= 5; - if (src && src->type == BL::PC) + if (src && src->bl_type == BL::PC) ((struct map_session_data *) src)->pvp_point++; //} //fixed wrong '{' placement by Lupus pc_setdead(sd); @@ -3665,20 +3665,20 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, } } - if (src && src->type == BL::PC) + if (src && src->bl_type == BL::PC) { // [Fate] PK death, trigger scripts argrec_t arg[3]; arg[0].name = "@killerrid"; - arg[0].v.i = src->id; + arg[0].v.i = src->bl_id; arg[1].name = "@victimrid"; - arg[1].v.i = sd->bl.id; + arg[1].v.i = sd->bl.bl_id; arg[2].name = "@victimlvl"; arg[2].v.i = sd->status.base_level; - npc_event_doall_l("OnPCKilledEvent", sd->bl.id, 3, arg); - npc_event_doall_l("OnPCKillEvent", src->id, 3, arg); + npc_event_doall_l("OnPCKilledEvent", sd->bl.bl_id, 3, arg); + npc_event_doall_l("OnPCKillEvent", src->bl_id, 3, arg); } - npc_event_doall_l("OnPCDieEvent", sd->bl.id, 0, NULL); + npc_event_doall_l("OnPCDieEvent", sd->bl.bl_id, 0, NULL); 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.id, evname)); + sd->bl.bl_id, evname)); return 1; } @@ -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.id, sd->status.name); + sd->bl.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.id, sd->status.name); + sd->bl.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.m].flag.pvp + && map[sd->bl.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.m]; + m = &map[sd->bl.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.m, 0, 0, m->xs, m->ys, + sd->bl.bl_m, 0, 0, m->xs, m->ys, BL::PC); return sd->pvp_rank; } @@ -5468,7 +5468,7 @@ void pc_invisibility(struct map_session_data *sd, int enabled) { sd->status.option &= ~Option::INVISIBILITY; clif_status_change(&sd->bl, StatusChange::CLIF_OPTION_SC_INVISIBILITY, 0); - pc_setpos(sd, map[sd->bl.m].name, sd->bl.x, sd->bl.y, BeingRemoveWhy::WARPED); + pc_setpos(sd, map[sd->bl.bl_m].name, sd->bl.bl_x, sd->bl.bl_y, BeingRemoveWhy::WARPED); } } diff --git a/src/map/script.cpp b/src/map/script.cpp index 43bcebf..0c56bc7 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.x) - && (y == sd->bl.y) && (!strcmp(str, map[sd->bl.m].name))); + (x == sd->bl.bl_x) + && (y == sd->bl.bl_y) && (!strcmp(str, map[sd->bl.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.m].flag.noreturn) // 蝶禁止 + if (map[sd->bl.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.m].flag.noreturn) // 蝶禁止 + if (map[sd->bl.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.m, sd->bl.x, sd->bl.y, + sd->bl.bl_m, sd->bl.bl_x, sd->bl.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.m; + m = sd->bl.bl_m; else m = map_mapname2mapid(mapname); @@ -3039,7 +3039,7 @@ void builtin_getusers(ScriptState *st) switch (flag & 0x07) { case 0: - val = map[bl->m].users; + val = map[bl->bl_m].users; break; case 1: val = map_getusers(); @@ -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.id, drop->bl.type); + map_delobject(drop->bl.bl_id, drop->bl.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.m && !pl_sd->pvp_timer) + if (m == pl_sd->bl.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.id)); + pl_sd->bl.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.m) + if (m == pl_sd->bl.bl_m) { pl_sd->pvp_timer.cancel(); } @@ -4065,18 +4065,18 @@ void builtin_npcwarp(ScriptState *st) if (!nd) return; - short m = nd->bl.m; + short m = nd->bl.bl_m; /* Crude sanity checks. */ - if (m < 0 || !nd->bl.prev + if (m < 0 || !nd->bl.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.x = x; - nd->bl.y = y; + nd->bl.bl_x = x; + nd->bl.bl_y = y; map_addblock(&nd->bl); npc_enable(npc, 1); @@ -4253,9 +4253,9 @@ void builtin_isin(ScriptState *st) return; push_val(st->stack, ScriptCode::INT, - (sd->bl.x >= x1 && sd->bl.x <= x2) - && (sd->bl.y >= y1 && sd->bl.y <= y2) - && (!strcmp(str, map[sd->bl.m].name))); + (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))); } @@ -4274,7 +4274,7 @@ void builtin_shop(ScriptState *st) return; builtin_close(st); - clif_npcbuysell(sd, nd->bl.id); + clif_npcbuysell(sd, nd->bl.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.x); + push_val(st->stack, ScriptCode::INT, sd->bl.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.y); + push_val(st->stack, ScriptCode::INT, sd->bl.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.m].name); + push_str(st->stack, ScriptCode::CONSTSTR, map[sd->bl.bl_m].name); } // diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp index c225ebe..65b8ae0 100644 --- a/src/map/skill-pools.cpp +++ b/src/map/skill-pools.cpp @@ -118,7 +118,7 @@ int skill_power(struct map_session_data *sd, SkillID skill_id) int skill_power_bl(struct block_list *bl, SkillID skill) { - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) return skill_power((struct map_session_data *) bl, skill); else return 0; diff --git a/src/map/skill.cpp b/src/map/skill.cpp index f157d5b..724228a 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -163,12 +163,12 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl, if (skilllv < 0) return 0; - if (src->type == BL::PC) + if (src->bl_type == BL::PC) { sd = (struct map_session_data *) src; nullpo_ret(sd); } - else if (src->type == BL::MOB) + else if (src->bl_type == BL::MOB) { md = (struct mob_data *) src; nullpo_ret(md); //未使用? @@ -188,7 +188,7 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl, //自分の耐性 luk = battle_get_luk(src); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { if (sc_def_mdef > 50) sc_def_mdef = 50; @@ -245,15 +245,15 @@ int skill_attack(BF attack_type, struct block_list *src, sc_data = battle_get_sc_data(bl); //何もしない判定ここから - if (dsrc->m != bl->m) //対象が同じマップにいなければ何もしない + if (dsrc->bl_m != bl->bl_m) //対象が同じマップにいなければ何もしない return 0; - if (src->prev == NULL || dsrc->prev == NULL || bl->prev == NULL) //prevよくわからない※ + if (src->bl_prev == NULL || dsrc->bl_prev == NULL || bl->bl_prev == NULL) //prevよくわからない※ return 0; - if (src->type == BL::PC && pc_isdead((struct map_session_data *) src)) //術者?がPCですでに死んでいたら何もしない + if (src->bl_type == BL::PC && pc_isdead((struct map_session_data *) src)) //術者?がPCですでに死んでいたら何もしない return 0; - if (dsrc->type == BL::PC && pc_isdead((struct map_session_data *) dsrc)) //術者?がPCですでに死んでいたら何もしない + if (dsrc->bl_type == BL::PC && pc_isdead((struct map_session_data *) dsrc)) //術者?がPCですでに死んでいたら何もしない return 0; - if (bl->type == BL::PC && pc_isdead((struct map_session_data *) bl)) //対象がPCですでに死んでいたら何もしない + if (bl->bl_type == BL::PC && pc_isdead((struct map_session_data *) bl)) //対象がPCですでに死んでいたら何もしない return 0; //何もしない判定ここまで @@ -286,15 +286,15 @@ int skill_attack(BF attack_type, struct block_list *src, battle_damage(src, bl, damage, 0); /* ダメージがあるなら追加効果判定 */ - if (bl->prev != NULL) + if (bl->bl_prev != NULL) { struct map_session_data *sd = (struct map_session_data *) bl; nullpo_ret(sd); - if (bl->type != BL::PC || (sd && !pc_isdead(sd))) + if (bl->bl_type != BL::PC || (sd && !pc_isdead(sd))) { if (damage > 0) skill_additional_effect(src, bl, skillid, skilllv); - if (bl->type == BL::MOB && src != bl) /* スキル使用条件のMOBスキル */ + if (bl->bl_type == BL::MOB && src != bl) /* スキル使用条件のMOBスキル */ { struct mob_data *md = (struct mob_data *) bl; nullpo_ret(md); @@ -302,8 +302,8 @@ int skill_attack(BF attack_type, struct block_list *src, { int target; target = md->target_id; - if (src->type == BL::PC) - md->target_id = src->id; + if (src->bl_type == BL::PC) + md->target_id = src->bl_id; mobskill_use(md, tick, MobSkillCondition::ANY); md->target_id = target; } @@ -313,7 +313,7 @@ int skill_attack(BF attack_type, struct block_list *src, } } - if (src->type == BL::PC + if (src->bl_type == BL::PC && bool(dmg.flag & BF::WEAPON) && src != bl && src == dsrc @@ -360,7 +360,7 @@ void skill_area_sub(struct block_list *bl, { nullpo_retv(bl); - if (bl->type != BL::PC && bl->type != BL::MOB) + if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB) return; if (battle_check_target(src, bl, flag) > 0) @@ -391,14 +391,14 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, nullpo_retr(1, src); nullpo_retr(1, bl); - if (src->type == BL::PC) + if (src->bl_type == BL::PC) sd = (struct map_session_data *) src; if (sd && pc_isdead(sd)) return 1; - if (bl->prev == NULL) + if (bl->bl_prev == NULL) return 1; - if (bl->type == BL::PC && pc_isdead((struct map_session_data *) bl)) + if (bl->bl_type == BL::PC && pc_isdead((struct map_session_data *) bl)) return 1; MapBlockLock lock; @@ -413,12 +413,12 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, if (flag.lo & 1) { /* 個別にダメージを与える */ - if (src->type == BL::MOB) + if (src->bl_type == BL::MOB) { struct mob_data *mb = (struct mob_data *) src; nullpo_retr(1, mb); mb->hp = skill_area_temp_hp; - if (bl->id != skill_area_temp_id) + if (bl->bl_id != skill_area_temp_id) skill_attack(BF::MISC, src, src, bl, SkillID::NPC_SELFDESTRUCTION, skilllv, tick, flag); @@ -430,12 +430,12 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, struct mob_data *md; if ((md = (struct mob_data *) src)) { - skill_area_temp_id = bl->id; + skill_area_temp_id = bl->bl_id; skill_area_temp_hp = battle_get_hp(src); map_foreachinarea(std::bind(skill_area_sub, ph::_1, src, skillid, skilllv, tick, flag | BCT_ENEMY | BCT_lo_x01, skill_castend_damage_id), - bl->m, bl->x - 5, bl->y - 5, - bl->x + 5, bl->y + 5, BL::NUL); + bl->bl_m, bl->bl_x - 5, bl->bl_y - 5, + bl->bl_x + 5, bl->bl_y + 5, BL::NUL); battle_damage(src, src, md->hp, 0); } } @@ -447,18 +447,18 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl, { if (flag.lo & 3) { - if (bl->id != skill_area_temp_id) + if (bl->bl_id != skill_area_temp_id) skill_attack(BF::WEAPON, src, src, bl, skillid, skilllv, tick, BCT_mid_x05); } else { // TODO does this happen? - skill_area_temp_id = bl->id; + skill_area_temp_id = bl->bl_id; map_foreachinarea(std::bind(skill_area_sub, ph::_1, src, skillid, skilllv, tick, flag | BCT_ENEMY | BCT_lo_x01, skill_castend_damage_id), - bl->m, bl->x - 0, bl->y - 0, - bl->x + 0, bl->y + 0, BL::NUL); + bl->bl_m, bl->bl_x - 0, bl->bl_y - 0, + bl->bl_x + 0, bl->bl_y + 0, BL::NUL); } } break; @@ -488,9 +488,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, nullpo_retr(1, src); nullpo_retr(1, bl); - if (src->type == BL::PC) + if (src->bl_type == BL::PC) sd = (struct map_session_data *) src; - else if (src->type == BL::MOB) + else if (src->bl_type == BL::MOB) md = (struct mob_data *) src; sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl) / 3); @@ -498,12 +498,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl) / 3); strip_fix = battle_get_dex(src) - battle_get_dex(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { dstsd = (struct map_session_data *) bl; nullpo_retr(1, dstsd); } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { dstmd = (struct mob_data *) bl; nullpo_retr(1, dstmd); @@ -519,7 +519,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, if (strip_fix < 0) strip_fix = 0; - if (bl == NULL || bl->prev == NULL) + if (bl == NULL || bl->bl_prev == NULL) return 1; if (sd && pc_isdead(sd)) return 1; @@ -564,7 +564,7 @@ interval_t skill_castfix(struct block_list *bl, interval_t interval) nullpo_retr(interval_t::zero(), bl); - if (bl->type == BL::MOB) + if (bl->bl_type == BL::MOB) { // Crash fix [Valaris] md = (struct mob_data *) bl; skill = md->skillid; @@ -586,9 +586,9 @@ interval_t skill_castfix(struct block_list *bl, interval_t interval) if (interval == interval_t::zero()) return interval_t::zero(); - if (castnodex > 0 && bl->type == BL::PC) + if (castnodex > 0 && bl->bl_type == BL::PC) castrate = 100; - else if (castnodex <= 0 && bl->type == BL::PC) + else if (castnodex <= 0 && bl->bl_type == BL::PC) { castrate = 100; interval = @@ -615,7 +615,7 @@ interval_t skill_delayfix(struct block_list *bl, interval_t interval) if (interval <= interval_t::zero()) return interval_t::zero(); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { if (battle_config.delay_dependon_dex) /* dexの影響を計算する */ interval = @@ -636,7 +636,7 @@ int skill_castcancel(struct block_list *bl, int) { nullpo_ret(bl); - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { struct map_session_data *sd = (struct map_session_data *) bl; tick_t tick = gettick(); @@ -645,7 +645,7 @@ int skill_castcancel(struct block_list *bl, int) return 0; } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { struct mob_data *md = (struct mob_data *) bl; if (md->skilltimer) @@ -676,7 +676,7 @@ 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.id != 0/* was something else - TODO remove this */) + || (md->bl.bl_id != 0/* was something else - TODO remove this */) || skill_devotion3(&md->bl, 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->x, bl->y, sd->bl.x, sd->bl.y); + r = distance(bl->bl_x, bl->bl_y, sd->bl.bl_x, sd->bl.bl_y); if ( + 6 < r) { // 許容範囲を超えてた @@ -738,7 +738,7 @@ int skill_status_change_active(struct block_list *bl, StatusChange type) eptr<struct status_change, StatusChange> sc_data; nullpo_ret(bl); - if (bl->type != BL::PC && bl->type != BL::MOB) + if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB) { if (battle_config.error_log) PRINTF("skill_status_change_active: neither MOB nor PC !\n"); @@ -763,7 +763,7 @@ void skill_status_change_end(struct block_list *bl, StatusChange type, TimerData Opt3 *opt3; nullpo_retv(bl); - if (bl->type != BL::PC && bl->type != BL::MOB) + if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB) { if (battle_config.error_log) PRINTF("skill_status_change_end: neither MOB nor PC !\n"); @@ -816,7 +816,7 @@ void skill_status_change_end(struct block_list *bl, StatusChange type, TimerData break; } - if (bl->type == BL::PC && type < StatusChange::SC_SENDMAX) + if (bl->bl_type == BL::PC && type < StatusChange::SC_SENDMAX) clif_status_change(bl, type, 0); /* アイコン消去 */ switch (type) @@ -847,7 +847,7 @@ void skill_status_change_end(struct block_list *bl, StatusChange type, TimerData if (opt_flag) /* optionの変更を伝える */ clif_changeoption(bl); - if (bl->type == BL::PC && calc_flag) + if (bl->bl_type == BL::PC && calc_flag) pc_calcstatus((struct map_session_data *) bl, 0); /* ステータス再計算 */ } @@ -888,7 +888,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange if (not sc_data) return; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) sd = (struct map_session_data *) bl; //sc_count=battle_get_sc_count(bl); //使ってない? @@ -896,7 +896,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange if (sc_data[type].spell_invocation) { // Must report termination spell_effect_report_termination(sc_data[type].spell_invocation, - bl->id, type, 0); + bl->bl_id, type, 0); sc_data[type].spell_invocation = 0; } @@ -916,12 +916,12 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange int hp = battle_get_max_hp(bl); if (battle_get_hp(bl) > hp >> 4) { - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { hp = 3 + hp * 3 / 200; pc_heal((struct map_session_data *) bl, -hp, 0); } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { struct mob_data *md; if ((md = ((struct mob_data *) bl)) == NULL) @@ -932,7 +932,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange } sc_data[type].timer = Timer(tick + std::chrono::seconds(1), std::bind(skill_status_change_timer, ph::_1, ph::_2, - bl->id, type)); + bl->bl_id, type)); return; } } @@ -940,7 +940,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange { sc_data[type].timer = Timer(tick + std::chrono::seconds(2), std::bind(skill_status_change_timer, ph::_1, ph::_2, - bl->id, type)); + bl->bl_id, type)); return; } break; @@ -954,7 +954,7 @@ void skill_status_change_timer(TimerData *tid, tick_t tick, int id, StatusChange case StatusChange::SC_BROKNARMOR: sc_data[type].timer = Timer(tick + std::chrono::minutes(10), std::bind(skill_status_change_timer, ph::_1, ph::_2, - bl->id, type)); + bl->bl_id, type)); return; case StatusChange::SC_FLYING_BACKPACK: @@ -1015,11 +1015,11 @@ int skill_status_effect(struct block_list *bl, StatusChange type, } if (scdef >= 100) return 0; - if (bl->type == BL::PC) + if (bl->bl_type == BL::PC) { sd = (struct map_session_data *) bl; } - else if (bl->type == BL::MOB) + else if (bl->bl_type == BL::MOB) { } else @@ -1105,7 +1105,7 @@ int skill_status_effect(struct block_list *bl, StatusChange type, return 0; } - if (bl->type == BL::PC && type < StatusChange::SC_SENDMAX) + if (bl->bl_type == BL::PC && type < StatusChange::SC_SENDMAX) clif_status_change(bl, type, 1); /* アイコン表示 */ /* optionの変更 */ @@ -1134,19 +1134,19 @@ int skill_status_effect(struct block_list *bl, StatusChange type, sc_data[type].val1 = val1; if (sc_data[type].spell_invocation) // Supplant by newer spell spell_effect_report_termination(sc_data[type].spell_invocation, - bl->id, type, 1); + bl->bl_id, type, 1); sc_data[type].spell_invocation = spell_invocation; /* タイマー設定 */ sc_data[type].timer = Timer(gettick() + tick, std::bind(skill_status_change_timer, ph::_1, ph::_2, - bl->id, type)); + bl->bl_id, type)); - if (bl->type == BL::PC && calc_flag) + if (bl->bl_type == BL::PC && calc_flag) pc_calcstatus(sd, 0); /* ステータス再計算 */ - if (bl->type == BL::PC && updateflag != SP::ZERO) + if (bl->bl_type == BL::PC && updateflag != SP::ZERO) clif_updatestatus(sd, updateflag); /* ステータスをクライアントに送る */ return 0; diff --git a/src/map/trade.cpp b/src/map/trade.cpp index 6e81602..13f7a4d 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.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)) + 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)) { clif_tradestart(sd, 0); //too far } |