summaryrefslogtreecommitdiff
path: root/src/map/party.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/party.cpp')
-rw-r--r--src/map/party.cpp285
1 files changed, 152 insertions, 133 deletions
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 75c54cf..8713c60 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -21,8 +21,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-#include <cstring>
-
#include "../compat/nullpo.hpp"
#include "../strings/xstring.hpp"
@@ -31,23 +29,27 @@
#include "../io/cxxstdio.hpp"
-#include "../mmo/socket.hpp"
-#include "../mmo/timer.hpp"
+#include "../net/timer.hpp"
+
+#include "../mmo/ids.hpp"
+#include "../mmo/mmo.hpp"
#include "battle.hpp"
#include "clif.hpp"
#include "intif.hpp"
#include "map.hpp"
#include "pc.hpp"
-#include "tmw.hpp"
#include "../poison.hpp"
+
+namespace tmwa
+{
// 座標やHP送信の間隔
-constexpr interval_t PARTY_SEND_XYHP_INVERVAL = std::chrono::seconds(1);
+constexpr interval_t PARTY_SEND_XYHP_INVERVAL = 1_s;
static
-Map<int, struct party> party_db;
+Map<PartyId, PartyMost> party_db;
static
void party_check_conflict(dumb_ptr<map_session_data> sd);
@@ -64,31 +66,40 @@ void do_init_party(void)
}
// 検索
-struct party *party_search(int party_id)
+PartyPair party_search(PartyId party_id)
{
- return party_db.search(party_id);
+ PartyPair p;
+ p.party_most = party_db.search(party_id);
+ if (p)
+ p.party_id = party_id;
+ return p;
}
static
-void party_searchname_sub(struct party *p, PartyName str, struct party **dst)
+void party_searchname_sub(PartyPair p, PartyName str, PartyPair *dst)
{
if (p->name == str)
*dst = p;
}
// パーティ名検索
-struct party *party_searchname(PartyName str)
+PartyPair party_searchname(PartyName str)
{
- struct party *p = NULL;
+ PartyPair p;
for (auto& pair : party_db)
- party_searchname_sub(&pair.second, str, &p);
+ {
+ PartyPair tmp;
+ tmp.party_id = pair.first;
+ tmp.party_most = &pair.second;
+ party_searchname_sub(tmp, str, &p);
+ }
return p;
}
/* Process a party creation request. */
int party_create(dumb_ptr<map_session_data> sd, PartyName name)
{
- nullpo_ret(sd);
+ nullpo_retz(sd);
name = stringish<PartyName>(name.strip());
@@ -97,7 +108,7 @@ int party_create(dumb_ptr<map_session_data> sd, PartyName name)
clif_party_created(sd, 1);
/* Make sure the character isn't already in a party. */
- if (sd->status.party_id == 0)
+ if (!sd->status.party_id)
intif_create_party(sd, name);
else
clif_party_created(sd, 2);
@@ -106,10 +117,10 @@ int party_create(dumb_ptr<map_session_data> sd, PartyName name)
}
/* Relay the result of a party creation request. */
-void party_created(int account_id, int fail, int party_id, PartyName name)
+void party_created(AccountId account_id, int fail, PartyId party_id, PartyName name)
{
dumb_ptr<map_session_data> sd;
- sd = map_id2sd(account_id);
+ sd = map_id2sd(account_to_block(account_id));
nullpo_retv(sd);
@@ -118,15 +129,15 @@ void party_created(int account_id, int fail, int party_id, PartyName name)
{
sd->status.party_id = party_id;
- struct party *p = party_db.search(party_id);
- if (p != NULL)
+ PartyPair p = party_search(party_id);
+ if (p)
{
- PRINTF("party_created(): ID already exists!\n");
+ PRINTF("party_created(): ID already exists!\n"_fmt);
exit(1);
}
- p = party_db.init(party_id);
- p->party_id = party_id;
+ p.party_most = party_db.init(party_id);
+ p.party_id = party_id;
p->name = name;
/* The party was created successfully. */
@@ -138,16 +149,16 @@ void party_created(int account_id, int fail, int party_id, PartyName name)
}
// 情報要求
-void party_request_info(int party_id)
+void party_request_info(PartyId party_id)
{
intif_request_partyinfo(party_id);
}
// 所属キャラの確認
static
-int party_check_member(struct party *p)
+int party_check_member(PartyPair p)
{
- nullpo_ret(p);
+ nullpo_retz(p);
for (io::FD i : iter_fds())
{
@@ -157,7 +168,7 @@ int party_check_member(struct party *p)
map_session_data *sd = static_cast<map_session_data *>(s->session_data.get());
if (sd && sd->state.auth)
{
- if (sd->status.party_id == p->party_id)
+ if (sd->status.party_id == p.party_id)
{
int j, f = 1;
for (j = 0; j < MAX_PARTY; j++)
@@ -169,15 +180,15 @@ int party_check_member(struct party *p)
else
{
// I can prove it was already zeroed
- // p->member[j].sd = NULL; // 同垢別キャラだった
+ // p->member[j].sd = nullptr; // 同垢別キャラだった
}
}
}
if (f)
{
- sd->status.party_id = 0;
+ sd->status.party_id = PartyId();
if (battle_config.error_log)
- PRINTF("party: check_member %d[%s] is not member\n",
+ PRINTF("party: check_member %d[%s] is not member\n"_fmt,
sd->status_key.account_id, sd->status_key.name);
}
}
@@ -187,7 +198,7 @@ int party_check_member(struct party *p)
}
// 情報所得失敗(そのIDのキャラを全部未所属にする)
-int party_recv_noinfo(int party_id)
+int party_recv_noinfo(PartyId party_id)
{
for (io::FD i : iter_fds())
{
@@ -198,36 +209,36 @@ int party_recv_noinfo(int party_id)
if (sd && sd->state.auth)
{
if (sd->status.party_id == party_id)
- sd->status.party_id = 0;
+ sd->status.party_id = PartyId();
}
}
return 0;
}
// 情報所得
-int party_recv_info(const struct party *sp)
+int party_recv_info(const PartyPair sp)
{
int i;
- nullpo_ret(sp);
+ nullpo_retz(sp);
- struct party *p = party_db.search(sp->party_id);
- if (p == NULL)
+ PartyPair p = party_search(sp.party_id);
+ if (!p)
{
- p = party_db.init(sp->party_id);
+ p.party_most = party_db.init(sp.party_id);
// 最初のロードなのでユーザーのチェックを行う
- *p = *sp;
+ *p.party_most = *sp.party_most;
party_check_member(p);
}
else
- *p = *sp;
+ *p.party_most = *sp.party_most;
for (i = 0; i < MAX_PARTY; i++)
{ // sdの設定
- dumb_ptr<map_session_data> sd = map_id2sd(p->member[i].account_id);
- p->member[i].sd = (sd != NULL
- && sd->status.party_id == p->party_id) ? sd.operator->() : NULL;
+ dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(p->member[i].account_id));
+ p->member[i].sd = (sd != nullptr
+ && sd->status.party_id == p.party_id) ? sd.operator->() : nullptr;
}
clif_party_info(p, nullptr);
@@ -236,7 +247,7 @@ int party_recv_info(const struct party *sp)
{ // 設定情報の送信
// dumb_ptr<map_session_data> sd = map_id2sd(p->member[i].account_id);
dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd);
- if (sd != NULL && sd->party_sended == 0)
+ if (sd != nullptr && sd->party_sended == 0)
{
clif_party_option(p, sd, 0x100);
sd->party_sended = 1;
@@ -247,14 +258,14 @@ int party_recv_info(const struct party *sp)
}
/* Process party invitation from sd to account_id. */
-int party_invite(dumb_ptr<map_session_data> sd, int account_id)
+int party_invite(dumb_ptr<map_session_data> sd, AccountId account_id)
{
- dumb_ptr<map_session_data> tsd = map_id2sd(account_id);
- struct party *p = party_search(sd->status.party_id);
+ dumb_ptr<map_session_data> tsd = map_id2sd(account_to_block(account_id));
+ PartyPair p = party_search(sd->status.party_id);
int i;
int full = 1; /* Indicates whether or not there's room for one more. */
- nullpo_ret(sd);
+ nullpo_retz(sd);
if (!tsd || !p || !tsd->sess)
return 0;
@@ -271,7 +282,7 @@ int party_invite(dumb_ptr<map_session_data> sd, int account_id)
}
/* The target player is already in a party, or has a pending invitation. */
- if (tsd->status.party_id > 0 || tsd->party_invite > 0)
+ if (tsd->status.party_id || tsd->party_invite)
{
clif_party_inviteack(sd, tsd->status_key.name, 0);
return 0;
@@ -311,9 +322,9 @@ int party_invite(dumb_ptr<map_session_data> sd, int account_id)
}
/* Process response to party invitation. */
-int party_reply_invite(dumb_ptr<map_session_data> sd, int account_id, int flag)
+int party_reply_invite(dumb_ptr<map_session_data> sd, AccountId account_id, int flag)
{
- nullpo_ret(sd);
+ nullpo_retz(sd);
/* There is no pending invitation. */
if (!sd->party_invite || !sd->party_invite_account)
@@ -333,48 +344,48 @@ int party_reply_invite(dumb_ptr<map_session_data> sd, int account_id, int flag)
else
{
/* This is the player who sent the invitation. */
- dumb_ptr<map_session_data> tsd = NULL;
+ dumb_ptr<map_session_data> tsd = nullptr;
- sd->party_invite = 0;
- sd->party_invite_account = 0;
+ sd->party_invite = PartyId();
+ sd->party_invite_account = AccountId();
- if ((tsd = map_id2sd(account_id)))
+ if ((tsd = map_id2sd(account_to_block(account_id))))
clif_party_inviteack(tsd, sd->status_key.name, 1);
}
return 0;
}
// パーティが追加された
-int party_member_added(int party_id, int account_id, int flag)
+int party_member_added(PartyId party_id, AccountId account_id, int flag)
{
- dumb_ptr<map_session_data> sd = map_id2sd(account_id), sd2;
- struct party *p = party_search(party_id);
+ dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id)), sd2;
+ PartyPair p = party_search(party_id);
- if (sd == NULL)
+ if (sd == nullptr)
{
if (flag == 0)
{
if (battle_config.error_log)
- PRINTF("party: member added error %d is not online\n",
+ PRINTF("party: member added error %d is not online\n"_fmt,
account_id);
intif_party_leave(party_id, account_id); // キャラ側に登録できなかったため脱退要求を出す
}
return 0;
}
- sd2 = map_id2sd(sd->party_invite_account);
- sd->party_invite = 0;
- sd->party_invite_account = 0;
+ sd2 = map_id2sd(account_to_block(sd->party_invite_account));
+ sd->party_invite = PartyId();
+ sd->party_invite_account = AccountId();
- if (p == NULL)
+ if (!p)
{
- PRINTF("party_member_added: party %d not found.\n", party_id);
+ PRINTF("party_member_added: party %d not found.\n"_fmt, party_id);
intif_party_leave(party_id, account_id);
return 0;
}
if (flag == 1)
{ // 失敗
- if (sd2 != NULL)
+ if (sd2 != nullptr)
clif_party_inviteack(sd2, sd->status_key.name, 0);
return 0;
}
@@ -383,7 +394,7 @@ int party_member_added(int party_id, int account_id, int flag)
sd->party_sended = 0;
sd->status.party_id = party_id;
- if (sd2 != NULL)
+ if (sd2 != nullptr)
clif_party_inviteack(sd2, sd->status_key.name, 2);
// いちおう競合確認
@@ -395,28 +406,30 @@ int party_member_added(int party_id, int account_id, int flag)
}
// パーティ除名要求
-int party_removemember(dumb_ptr<map_session_data> sd, int account_id)
+int party_removemember(dumb_ptr<map_session_data> sd, AccountId account_id)
{
- struct party *p;
+ PartyPair p;
int i;
- nullpo_ret(sd);
+ nullpo_retz(sd);
- if ((p = party_search(sd->status.party_id)) == NULL)
+ if (!(p = party_search(sd->status.party_id)))
return 0;
for (i = 0; i < MAX_PARTY; i++)
{ // リーダーかどうかチェック
if (p->member[i].account_id == sd->status_key.account_id)
+ {
if (p->member[i].leader == 0)
return 0;
+ }
}
for (i = 0; i < MAX_PARTY; i++)
{ // 所属しているか調べる
if (p->member[i].account_id == account_id)
{
- intif_party_leave(p->party_id, account_id);
+ intif_party_leave(p.party_id, account_id);
return 0;
}
}
@@ -426,19 +439,19 @@ int party_removemember(dumb_ptr<map_session_data> sd, int account_id)
// パーティ脱退要求
int party_leave(dumb_ptr<map_session_data> sd)
{
- struct party *p;
+ PartyPair p;
int i;
- nullpo_ret(sd);
+ nullpo_retz(sd);
- if ((p = party_search(sd->status.party_id)) == NULL)
+ if (!(p = party_search(sd->status.party_id)))
return 0;
for (i = 0; i < MAX_PARTY; i++)
{ // 所属しているか
if (p->member[i].account_id == sd->status_key.account_id)
{
- intif_party_leave(p->party_id, sd->status_key.account_id);
+ intif_party_leave(p.party_id, sd->status_key.account_id);
return 0;
}
}
@@ -446,45 +459,45 @@ int party_leave(dumb_ptr<map_session_data> sd)
}
// パーティメンバが脱退した
-int party_member_leaved(int party_id, int account_id, CharName name)
+int party_member_leaved(PartyId party_id, AccountId account_id, CharName name)
{
- dumb_ptr<map_session_data> sd = map_id2sd(account_id);
- struct party *p = party_search(party_id);
- if (p != NULL)
+ dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id));
+ PartyPair p = party_search(party_id);
+ if (p)
{
int i;
for (i = 0; i < MAX_PARTY; i++)
if (p->member[i].account_id == account_id)
{
clif_party_leaved(p, sd, account_id, name, 0x00);
- p->member[i].account_id = 0;
- p->member[i].sd = NULL;
+ p->member[i].account_id = AccountId();
+ p->member[i].sd = nullptr;
}
}
- if (sd != NULL && sd->status.party_id == party_id)
+ if (sd != nullptr && sd->status.party_id == party_id)
{
- sd->status.party_id = 0;
+ sd->status.party_id = PartyId();
sd->party_sended = 0;
}
return 0;
}
// パーティ解散通知
-int party_broken(int party_id)
+int party_broken(PartyId party_id)
{
- struct party *p;
+ PartyPair p;
int i;
- if ((p = party_search(party_id)) == NULL)
+ if (!(p = party_search(party_id)))
return 0;
for (i = 0; i < MAX_PARTY; i++)
{
- if (p->member[i].sd != NULL)
+ if (p->member[i].sd != nullptr)
{
clif_party_leaved(p, dumb_ptr<map_session_data>(p->member[i].sd),
p->member[i].account_id, p->member[i].name,
0x10);
- p->member[i].sd->status.party_id = 0;
+ p->member[i].sd->status.party_id = PartyId();
p->member[i].sd->party_sended = 0;
}
}
@@ -495,12 +508,12 @@ int party_broken(int party_id)
// パーティの設定変更要求
int party_changeoption(dumb_ptr<map_session_data> sd, int exp, int item)
{
- struct party *p;
+ PartyPair p;
- nullpo_ret(sd);
+ nullpo_retz(sd);
- if (sd->status.party_id == 0
- || (p = party_search(sd->status.party_id)) == NULL)
+ if (!sd->status.party_id
+ || !(p = party_search(sd->status.party_id)))
return 0;
intif_party_changeoption(sd->status.party_id, sd->status_key.account_id, exp,
item);
@@ -508,12 +521,12 @@ int party_changeoption(dumb_ptr<map_session_data> sd, int exp, int item)
}
// パーティの設定変更通知
-int party_optionchanged(int party_id, int account_id, int exp, int item,
+int party_optionchanged(PartyId party_id, AccountId account_id, int exp, int item,
int flag)
{
- struct party *p;
- dumb_ptr<map_session_data> sd = map_id2sd(account_id);
- if ((p = party_search(party_id)) == NULL)
+ PartyPair p;
+ dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id));
+ if (!(p = party_search(party_id)))
return 0;
if (!(flag & 0x01))
@@ -525,19 +538,19 @@ int party_optionchanged(int party_id, int account_id, int exp, int item,
}
// パーティメンバの移動通知
-void party_recv_movemap(int party_id, int account_id, MapName mapname,
+void party_recv_movemap(PartyId party_id, AccountId account_id, MapName mapname,
int online, int lv)
{
- struct party *p;
+ PartyPair p;
int i;
- if ((p = party_search(party_id)) == NULL)
+ if (!(p = party_search(party_id)))
return;
for (i = 0; i < MAX_PARTY; i++)
{
- struct party_member *m = &p->member[i];
- if (m == NULL)
+ PartyMember *m = &p->member[i];
+ if (m == nullptr)
{
- PRINTF("party_recv_movemap nullpo?\n");
+ PRINTF("party_recv_movemap nullpo?\n"_fmt);
return;
}
if (m->account_id == account_id)
@@ -551,16 +564,16 @@ void party_recv_movemap(int party_id, int account_id, MapName mapname,
if (i == MAX_PARTY)
{
if (battle_config.error_log)
- PRINTF("party: not found member %d on %d[%s]", account_id,
+ PRINTF("party: not found member %d on %d[%s]"_fmt, account_id,
party_id, p->name);
return;
}
for (i = 0; i < MAX_PARTY; i++)
{ // sd再設定
- dumb_ptr<map_session_data> sd = map_id2sd(p->member[i].account_id);
- p->member[i].sd = (sd != NULL
- && sd->status.party_id == p->party_id) ? sd.operator->() : NULL;
+ dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(p->member[i].account_id));
+ p->member[i].sd = (sd != nullptr
+ && sd->status.party_id == p.party_id) ? sd.operator->() : nullptr;
}
party_send_xy_clear(p); // 座標再通知要請
@@ -571,11 +584,11 @@ void party_recv_movemap(int party_id, int account_id, MapName mapname,
// パーティメンバの移動
int party_send_movemap(dumb_ptr<map_session_data> sd)
{
- struct party *p;
+ PartyPair p;
- nullpo_ret(sd);
+ nullpo_retz(sd);
- if (sd->status.party_id == 0)
+ if (!sd->status.party_id)
return 0;
intif_party_changemap(sd, 1);
@@ -586,10 +599,10 @@ int party_send_movemap(dumb_ptr<map_session_data> sd)
party_check_conflict(sd);
// あるならパーティ情報送信
- if ((p = party_search(sd->status.party_id)) != NULL)
+ if ((p = party_search(sd->status.party_id)))
{
party_check_member(p); // 所属を確認する
- if (sd->status.party_id == p->party_id)
+ if (sd->status.party_id == p.party_id)
{
clif_party_info(p, sd->sess);
clif_party_option(p, sd, 0x100);
@@ -603,20 +616,20 @@ int party_send_movemap(dumb_ptr<map_session_data> sd)
// パーティメンバのログアウト
int party_send_logout(dumb_ptr<map_session_data> sd)
{
- struct party *p;
+ PartyPair p;
- nullpo_ret(sd);
+ nullpo_retz(sd);
- if (sd->status.party_id > 0)
+ if (sd->status.party_id)
intif_party_changemap(sd, 0);
// sdが無効になるのでパーティ情報から削除
- if ((p = party_search(sd->status.party_id)) != NULL)
+ if ((p = party_search(sd->status.party_id)))
{
int i;
for (i = 0; i < MAX_PARTY; i++)
if (dumb_ptr<map_session_data>(p->member[i].sd) == sd)
- p->member[i].sd = NULL;
+ p->member[i].sd = nullptr;
}
return 0;
@@ -625,16 +638,16 @@ int party_send_logout(dumb_ptr<map_session_data> sd)
// パーティメッセージ送信
void party_send_message(dumb_ptr<map_session_data> sd, XString mes)
{
- if (sd->status.party_id == 0)
+ if (!sd->status.party_id)
return;
intif_party_message(sd->status.party_id, sd->status_key.account_id, mes);
}
// パーティメッセージ受信
-void party_recv_message(int party_id, int account_id, XString mes)
+void party_recv_message(PartyId party_id, AccountId account_id, XString mes)
{
- struct party *p;
- if ((p = party_search(party_id)) == NULL)
+ PartyPair p;
+ if (!(p = party_search(party_id)))
return;
clif_party_message(p, account_id, mes);
}
@@ -650,7 +663,7 @@ void party_check_conflict(dumb_ptr<map_session_data> sd)
// 位置やHP通知用
static
-void party_send_xyhp_timer_sub(struct party *p)
+void party_send_xyhp_timer_sub(PartyPair p)
{
int i;
@@ -659,7 +672,7 @@ void party_send_xyhp_timer_sub(struct party *p)
for (i = 0; i < MAX_PARTY; i++)
{
dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd);
- if (sd != NULL)
+ if (sd != nullptr)
{
// 座標通知
if (sd->party_x != sd->bl_x || sd->party_y != sd->bl_y)
@@ -683,11 +696,16 @@ void party_send_xyhp_timer_sub(struct party *p)
void party_send_xyhp_timer(TimerData *, tick_t)
{
for (auto& pair : party_db)
- party_send_xyhp_timer_sub(&pair.second);
+ {
+ PartyPair tmp;
+ tmp.party_id = pair.first;
+ tmp.party_most = &pair.second;
+ party_send_xyhp_timer_sub(tmp);
+ }
}
// 位置通知クリア
-void party_send_xy_clear(struct party *p)
+void party_send_xy_clear(PartyPair p)
{
int i;
@@ -696,7 +714,7 @@ void party_send_xy_clear(struct party *p)
for (i = 0; i < MAX_PARTY; i++)
{
dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd);
- if (sd != NULL)
+ if (sd != nullptr)
{
sd->party_x = -1;
sd->party_y = -1;
@@ -706,7 +724,7 @@ void party_send_xy_clear(struct party *p)
}
// HP通知の必要性検査用(map_foreachinmoveareaから呼ばれる)
-void party_send_hp_check(dumb_ptr<block_list> bl, int party_id, int *flag)
+void party_send_hp_check(dumb_ptr<block_list> bl, PartyId party_id, int *flag)
{
dumb_ptr<map_session_data> sd;
@@ -721,17 +739,17 @@ void party_send_hp_check(dumb_ptr<block_list> bl, int party_id, int *flag)
}
// 経験値公平分配
-int party_exp_share(struct party *p, map_local *mapid, int base_exp, int job_exp)
+int party_exp_share(PartyPair p, map_local *mapid, int base_exp, int job_exp)
{
dumb_ptr<map_session_data> sd;
int i, c;
- nullpo_ret(p);
+ nullpo_retz(p);
for (i = c = 0; i < MAX_PARTY; i++)
{
sd = dumb_ptr<map_session_data>(p->member[i].sd);
- if (sd != NULL && sd->bl_m == mapid)
+ if (sd != nullptr && sd->bl_m == mapid)
c++;
}
if (c == 0)
@@ -739,7 +757,7 @@ int party_exp_share(struct party *p, map_local *mapid, int base_exp, int job_exp
for (i = 0; i < MAX_PARTY; i++)
{
sd = dumb_ptr<map_session_data>(p->member[i].sd);
- if (sd != NULL && sd->bl_m == mapid)
+ if (sd != nullptr && sd->bl_m == mapid)
pc_gainexp_reason(sd, base_exp / c + 1, job_exp / c + 1,
PC_GAINEXP_REASON::SHARING);
}
@@ -752,7 +770,7 @@ int party_exp_share(struct party *p, map_local *mapid, int base_exp, int job_exp
void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func,
dumb_ptr<map_session_data> sd, int type)
{
- struct party *p;
+ PartyPair p;
int i;
int x0, y0, x1, y1;
dumb_ptr<map_session_data> list[MAX_PARTY];
@@ -760,7 +778,7 @@ void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func,
nullpo_retv(sd);
- if ((p = party_search(sd->status.party_id)) == NULL)
+ if (!(p = party_search(sd->status.party_id)))
return;
x0 = sd->bl_x - AREA_SIZE;
@@ -770,8 +788,8 @@ void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func,
for (i = 0; i < MAX_PARTY; i++)
{
- struct party_member *m = &p->member[i];
- if (m->sd != NULL)
+ PartyMember *m = &p->member[i];
+ if (m->sd != nullptr)
{
if (sd->bl_m != m->sd->bl_m)
continue;
@@ -789,3 +807,4 @@ void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func,
if (list[i]->bl_prev) // 有効かどうかチェック
func(list[i]);
}
+} // namespace tmwa