summaryrefslogtreecommitdiff
path: root/src/char/int_party.c
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-10-09 13:19:06 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-10-09 13:19:06 +0000
commita8ee3c14340344c50c34514520c165aa283e91e0 (patch)
tree2602ffcb2197395e3bd14004a6504093a20c5a6e /src/char/int_party.c
parent5e97766aa1488444f53f55e4a08569da6f88c726 (diff)
downloadhercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.gz
hercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.bz2
hercules-a8ee3c14340344c50c34514520c165aa283e91e0.tar.xz
hercules-a8ee3c14340344c50c34514520c165aa283e91e0.zip
* Rework some party code.
- add leader argument to party_fill_member - add party_getmemberid - add requester char_id to packets 0x3021 and 0x3821 (party info) - diff members when replacing party info - remove fixup all-player-iteration when receiving a party for the first time - send 'party info' before 'party created' - send 'party info' before 'party member added' - update empty party_id when checking the player of a party git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14968 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/int_party.c')
-rw-r--r--src/char/int_party.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/char/int_party.c b/src/char/int_party.c
index b340aa9cf..2ae9e5319 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -309,29 +309,29 @@ int mapif_party_created(int fd,int account_id, int char_id, struct party *p)
}
// パ?ティ情報見つからず
-int mapif_party_noinfo(int fd, int party_id) {
- WFIFOHEAD(fd, 8);
+static void mapif_party_noinfo(int fd, int party_id, int char_id)
+{
+ WFIFOHEAD(fd, 12);
WFIFOW(fd,0) = 0x3821;
- WFIFOW(fd,2) = 8;
- WFIFOL(fd,4) = party_id;
- WFIFOSET(fd,8);
- ShowWarning("int_party: info not found %d\n", party_id);
-
- return 0;
+ WFIFOW(fd,2) = 12;
+ WFIFOL(fd,4) = char_id;
+ WFIFOL(fd,8) = party_id;
+ WFIFOSET(fd,12);
+ ShowWarning("int_party: info not found (party_id=%d char_id=%d)\n", party_id, char_id);
}
// パ?ティ情報まとめ送り
-int mapif_party_info(int fd, struct party *p) {
- unsigned char buf[2048];
-
+static void mapif_party_info(int fd, struct party* p, int char_id)
+{
+ unsigned char buf[8 + sizeof(struct party)];
WBUFW(buf,0) = 0x3821;
- memcpy(buf + 4, p, sizeof(struct party));
- WBUFW(buf,2) = 4 + sizeof(struct party);
+ WBUFW(buf,2) = 8 + sizeof(struct party);
+ WBUFL(buf,4) = char_id;
+ memcpy(WBUFP(buf,8), p, sizeof(struct party));
if (fd < 0)
mapif_sendall(buf, WBUFW(buf,2));
else
mapif_send(fd, buf, WBUFW(buf,2));
- return 0;
}
// パ?ティメンバ追加可否
@@ -472,25 +472,23 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
int_party_calc_state(p);
idb_put(party_db, p->party.party_id, p);
+ mapif_party_info(fd, &p->party, 0);
mapif_party_created(fd, leader->account_id, leader->char_id, &p->party);
- mapif_party_info(fd, &p->party);
return 0;
}
// パ?ティ情報要求
-int mapif_parse_PartyInfo(int fd, int party_id)
+static void mapif_parse_PartyInfo(int fd, int party_id, int char_id)
{
struct party_data *p;
p = (struct party_data*)idb_get(party_db, party_id);
if (p != NULL)
- mapif_party_info(fd, &p->party);
+ mapif_party_info(fd, &p->party, char_id);
else {
- mapif_party_noinfo(fd, party_id);
+ mapif_party_noinfo(fd, party_id, char_id);
}
-
- return 0;
}
// パーティ追加要求
@@ -524,8 +522,8 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
int_party_check_lv(p);
}
+ mapif_party_info(-1, &p->party, 0);
mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 0);
- mapif_party_info(-1, &p->party);
return 0;
}
@@ -574,7 +572,7 @@ int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id)
int_party_check_lv(p);
}
if (party_check_empty(&p->party) == 0)
- mapif_party_info(-1, &p->party);
+ mapif_party_info(-1, &p->party, 0);
return 0;
}
}
@@ -679,7 +677,7 @@ int inter_party_parse_frommap(int fd) {
RFIFOHEAD(fd);
switch(RFIFOW(fd,0)) {
case 0x3020: mapif_parse_CreateParty(fd, (char*)RFIFOP(fd,4), RFIFOB(fd,28), RFIFOB(fd,29), (struct party_member*)RFIFOP(fd,30)); break;
- case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2)); break;
+ case 0x3021: mapif_parse_PartyInfo(fd, RFIFOL(fd,2), RFIFOL(fd,6)); break;
case 0x3022: mapif_parse_PartyAddMember(fd, RFIFOL(fd,4), (struct party_member*)RFIFOP(fd,8)); break;
case 0x3023: mapif_parse_PartyChangeOption(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOW(fd,10), RFIFOW(fd,12)); break;
case 0x3024: mapif_parse_PartyLeave(fd, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10)); break;