diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-28 21:06:17 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-28 21:06:17 +0000 |
commit | fcf5b330c38bc7a48e774163c5624428f25aead6 (patch) | |
tree | 5f0d076be684181fd06d9aacc2708d11e4f9300e /src/map | |
parent | 1bedc59cb03ac68564d55a8e4e3b184d46a7656c (diff) | |
download | hercules-fcf5b330c38bc7a48e774163c5624428f25aead6.tar.gz hercules-fcf5b330c38bc7a48e774163c5624428f25aead6.tar.bz2 hercules-fcf5b330c38bc7a48e774163c5624428f25aead6.tar.xz hercules-fcf5b330c38bc7a48e774163c5624428f25aead6.zip |
* Resolved multiple issues with the party booking system (bugreport:4573, since r14412).
- Fixed recruitments were limited to party leaders.
- Fixed recruitment index was party id instead of an auto-increment value, causing sorting by age not working.
- Fixed search result packet being sent on recruitment creation (probably to work-around next problem).
- Fixed packet 0x0805 not getting sent, because of commented entries in packet_db.txt (packet ver. restriction of clif_send).
- Fixed recruitment creation notice being sent to the recruiter only.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14516 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 22 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rw-r--r-- | src/map/party.c | 61 | ||||
-rw-r--r-- | src/map/party.h | 2 |
4 files changed, 28 insertions, 59 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 8f7971b29..151c63e65 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10857,7 +10857,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) { - if(party_booking_delete(sd, false)) + if(party_booking_delete(sd)) clif_PartyBookingDeleteAck(sd, 0); } @@ -10888,26 +10888,26 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) { int i; + uint8 buf[38+PARTY_BOOKING_JOBS*2]; if(pb_ad == NULL) return; - WFIFOHEAD(sd->fd,packet_len(0x809)); - WFIFOW(sd->fd,0) = 0x809; - WFIFOL(sd->fd,2) = pb_ad->index; - memcpy(WFIFOP(sd->fd,6),pb_ad->charname,NAME_LENGTH); - WFIFOL(sd->fd,30) = pb_ad->starttime; - WFIFOW(sd->fd,34) = pb_ad->p_detail.level; - WFIFOW(sd->fd,36) = pb_ad->p_detail.mapid; + WBUFW(buf,0) = 0x809; + WBUFL(buf,2) = pb_ad->index; + memcpy(WBUFP(buf,6),pb_ad->charname,NAME_LENGTH); + WBUFL(buf,30) = pb_ad->starttime; + WBUFW(buf,34) = pb_ad->p_detail.level; + WBUFW(buf,36) = pb_ad->p_detail.mapid; for(i=0; i<PARTY_BOOKING_JOBS; i++) - WFIFOW(sd->fd,38+i*2) = pb_ad->p_detail.job[i]; + WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; - WFIFOSET(sd->fd,packet_len(0x809)); + clif_send(buf, packet_len(0x809), &sd->bl, ALL_CLIENT); } void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) { int i; - uint8 buf[18]; + uint8 buf[6+PARTY_BOOKING_JOBS*2]; if(pb_ad == NULL) return; diff --git a/src/map/map.c b/src/map/map.c index 309095ff0..b7b1c09b8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1665,7 +1665,7 @@ int map_quit(struct map_session_data *sd) } } - party_booking_delete(sd, true); // Party Booking [Spiria] + party_booking_delete(sd); // Party Booking [Spiria] pc_makesavestatus(sd); pc_clean_skilltree(sd); chrif_save(sd,1); diff --git a/src/map/party.c b/src/map/party.c index b86e52d98..cb83a36bb 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -30,8 +30,9 @@ static DBMap* party_db; // int party_id -> struct party_data* static DBMap* party_booking_db; // Party Booking [Spiria] +static unsigned long party_booking_nextid = 1; + int party_send_xy_timer(int tid, unsigned int tick, int id, intptr data); -bool check_party_leader(struct map_session_data *sd, struct party_data *p); // Party Booking [Spiria] /*========================================== * Fills the given party_member structure according to the sd provided. @@ -515,11 +516,6 @@ int party_leave(struct map_session_data *sd) if( i == MAX_PARTY ) return 0; - if( check_party_leader(sd, p) ){ // when party leader leaves party, cancel booking. - party_booking_delete(sd,true); - clif_PartyBookingDeleteAck(sd,0); - } - intif_party_leave(p->party.party_id,sd->status.account_id,sd->status.char_id); return 1; } @@ -665,8 +661,6 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts //Update info. intif_party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id); clif_party_info(p,NULL); - party_booking_delete(sd, true); // Party Booking [Spiria] - clif_PartyBookingDeleteAck(sd, 0); // Close small window return true; } @@ -1070,45 +1064,25 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess * Party Booking in KRO [Spiria] *------------------------------------------*/ -static struct party_booking_ad_info* create_party_booking_data(int party_id) +static struct party_booking_ad_info* create_party_booking_data(void) { struct party_booking_ad_info *pb_ad; CREATE(pb_ad, struct party_booking_ad_info, 1); - pb_ad->index = party_id; + pb_ad->index = party_booking_nextid++; return pb_ad; } -bool check_party_leader(struct map_session_data *sd, struct party_data *p) -{ - int i; - - if (!sd || !sd->status.party_id) return false; - - if( p == NULL ) return false; - - ARR_FIND(0, MAX_PARTY, i, p->party.member[i].leader && p->party.member[i].online && p->data[i].sd == sd); - if(i == MAX_PARTY) return false; - - return true; -} - void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job) { struct party_booking_ad_info *pb_ad; - struct party_data *p=party_search(sd->status.party_id); int i; - if (!check_party_leader(sd, p)) { - clif_PartyBookingRegisterAck(sd, 1); - return; - } - - pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, p->party.party_id); + pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); if( pb_ad == NULL ) { - pb_ad = create_party_booking_data(p->party.party_id); - idb_put(party_booking_db, pb_ad->index, pb_ad); + pb_ad = create_party_booking_data(); + idb_put(party_booking_db, sd->status.char_id, pb_ad); } memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH); @@ -1123,20 +1097,14 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi clif_PartyBookingRegisterAck(sd, 0); clif_PartyBookingInsertNotify(sd, pb_ad); // Notice - clif_PartyBookingSearchAck(sd->fd, &pb_ad, 1, false); // Update Client! } void party_booking_update(struct map_session_data *sd, short* job) { int i; - struct party_data *p=party_search(sd->status.party_id); struct party_booking_ad_info *pb_ad; - if (!check_party_leader(sd, p)) { - return; - } - - pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, p->party.party_id); + pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); if( pb_ad == NULL ) return; @@ -1185,13 +1153,14 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, clif_PartyBookingSearchAck(sd->fd, result_list, count, more_result); } -bool party_booking_delete(struct map_session_data *sd, bool force_delete) +bool party_booking_delete(struct map_session_data *sd) { - struct party_data *p=party_search(sd->status.party_id); - if (!check_party_leader(sd, p) && !force_delete) { - return false; + struct party_booking_ad_info* pb_ad; + + if((pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id))!=NULL) + { + clif_PartyBookingDeleteNotify(sd, pb_ad->index); + idb_remove(party_booking_db,sd->status.char_id); } - clif_PartyBookingDeleteNotify(sd, sd->status.party_id); - idb_remove(party_booking_db,sd->status.party_id); return true; } diff --git a/src/map/party.h b/src/map/party.h index a9df002e7..31e46f5ec 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -89,6 +89,6 @@ int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_ses void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job); void party_booking_update(struct map_session_data *sd, short* job); void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount); -bool party_booking_delete(struct map_session_data *sd, bool force_delete); +bool party_booking_delete(struct map_session_data *sd); #endif /* _PARTY_H_ */ |