summaryrefslogtreecommitdiff
path: root/src/char/int_party.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/int_party.c')
-rw-r--r--src/char/int_party.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 50d6b0d6a..64facec47 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -519,36 +519,39 @@ int mapif_parse_PartyInfo(int fd, int party_id) {
return 0;
}
-// パ?ティ追加要求
-int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member) {
+// パーティ追加要求
+int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member)
+{
struct party_data *p;
int i;
p = idb_get(party_db, party_id);
- if (p == NULL || p->size == MAX_PARTY) {
+ if( p == NULL || p->size == MAX_PARTY ) {
mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1);
return 0;
}
- for(i = 0; i < MAX_PARTY; i++) {
- if (p->party.member[i].account_id == 0) {
- memcpy(&p->party.member[i], member, sizeof(struct party_member));
- p->party.member[i].leader = 0;
- if (p->party.member[i].online) p->party.count++;
- p->size++;
- if (p->size == 3) //Check family state.
- int_party_calc_state(p);
- else //Check even share range.
- if (member->lv < p->min_lv || member->lv > p->max_lv || p->family) {
- if (p->family) p->family = 0; //Family state broken.
- int_party_check_lv(p);
- }
- mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 0);
- mapif_party_info(-1, &p->party);
- return 0;
- }
+ ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == 0 );
+ if( i == MAX_PARTY )
+ {// Party full
+ mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1);
+ return 0;
}
- mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1);
+
+ memcpy(&p->party.member[i], member, sizeof(struct party_member));
+ p->party.member[i].leader = 0;
+ if (p->party.member[i].online) p->party.count++;
+ p->size++;
+ if (p->size == 3) //Check family state.
+ int_party_calc_state(p);
+ else //Check even share range.
+ if (member->lv < p->min_lv || member->lv > p->max_lv || p->family) {
+ if (p->family) p->family = 0; //Family state broken.
+ int_party_check_lv(p);
+ }
+
+ mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 0);
+ mapif_party_info(-1, &p->party);
return 0;
}