diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-28 13:44:23 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-11-28 13:44:23 +0000 |
commit | e4c1f576bf32e13a640670de3656765bfa966198 (patch) | |
tree | 8742ec02945ec58e533100ff2d70b7b3a6c63f1a /src | |
parent | ea5bac422d3d0b257c2f6f877b9780ec20a782ed (diff) | |
download | hercules-e4c1f576bf32e13a640670de3656765bfa966198.tar.gz hercules-e4c1f576bf32e13a640670de3656765bfa966198.tar.bz2 hercules-e4c1f576bf32e13a640670de3656765bfa966198.tar.xz hercules-e4c1f576bf32e13a640670de3656765bfa966198.zip |
* Made the party booking search pass results as array of pointers, rather than array of indexes, which require further lookup.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14514 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 7 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/party.c | 23 | ||||
-rw-r--r-- | src/map/party.h | 1 |
4 files changed, 11 insertions, 22 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 7917d5b8b..8f7971b29 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10832,7 +10832,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) /*========================================== * more_result: 0 - no more, 1 - more *------------------------------------------*/ -void clif_PartyBookingSearchAck(int fd, unsigned long *index, int count, bool more_result) +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result) { int i, j; int size = sizeof(struct party_booking_ad_info); // structure size (48) @@ -10840,11 +10840,10 @@ void clif_PartyBookingSearchAck(int fd, unsigned long *index, int count, bool mo WFIFOHEAD(fd,size*count + 5); WFIFOW(fd,0) = 0x805; WFIFOW(fd,2) = size*count + 5; - WFIFOB(fd,4) = (bool)more_result; + WFIFOB(fd,4) = more_result; for(i=0; i<count; i++) { - pb_ad = party_booking_getdata(index[i]); - if(pb_ad == NULL) return; + pb_ad = results[i]; WFIFOL(fd,i*size+5) = pb_ad->index; memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,NAME_LENGTH); WFIFOL(fd,i*size+33) = pb_ad->starttime; diff --git a/src/map/clif.h b/src/map/clif.h index d3a3679f1..5989fa5c8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -469,7 +469,7 @@ void clif_progressbar_abort(struct map_session_data * sd); void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag); void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag); -void clif_PartyBookingSearchAck(int fd, unsigned long *index, int count, bool more_result); +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result); void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad); void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index); void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad); diff --git a/src/map/party.c b/src/map/party.c index 9e2ee5c7b..b86e52d98 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -1078,13 +1078,6 @@ static struct party_booking_ad_info* create_party_booking_data(int party_id) return pb_ad; } -struct party_booking_ad_info* party_booking_getdata(unsigned long index) -{ - struct party_booking_ad_info *pb_ad; - pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, index); - return pb_ad; -} - bool check_party_leader(struct map_session_data *sd, struct party_data *p) { int i; @@ -1130,8 +1123,7 @@ 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->index, 1, false); // Update Client! - return; + clif_PartyBookingSearchAck(sd->fd, &pb_ad, 1, false); // Update Client! } void party_booking_update(struct map_session_data *sd, short* job) @@ -1157,18 +1149,17 @@ void party_booking_update(struct map_session_data *sd, short* job) else pb_ad->p_detail.job[i] = -1; clif_PartyBookingUpdateNotify(sd, pb_ad); - return; } void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount) { struct party_booking_ad_info *pb_ad; int i, count=0; - unsigned long index_list[PARTY_BOOKING_RESULTS]; + struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS]; bool more_result = false; DBIterator* iter = party_booking_db->iterator(party_booking_db); - memset(index_list, 0, sizeof(index_list)); + memset(result_list, 0, sizeof(result_list)); for( pb_ad = (struct party_booking_ad_info*)iter->first(iter,NULL); iter->exists(iter); pb_ad = (struct party_booking_ad_info*)iter->next(iter,NULL) ) { @@ -1179,19 +1170,19 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, break; } if (mapid == 0 && job == -1) - index_list[count] = pb_ad->index; + result_list[count] = pb_ad; else if (mapid == 0) { for(i=0; i<PARTY_BOOKING_JOBS; i++) if (pb_ad->p_detail.job[i] == job && job != -1) - index_list[count] = pb_ad->index; + result_list[count] = pb_ad; } else if (job == -1){ if (pb_ad->p_detail.mapid == mapid) - index_list[count] = pb_ad->index; + result_list[count] = pb_ad; } count++; } iter->destroy(iter); - clif_PartyBookingSearchAck(sd->fd, index_list, count, more_result); + clif_PartyBookingSearchAck(sd->fd, result_list, count, more_result); } bool party_booking_delete(struct map_session_data *sd, bool force_delete) diff --git a/src/map/party.h b/src/map/party.h index db8339bd2..a9df002e7 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -86,7 +86,6 @@ int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_ses /*========================================== * Party Booking in KRO [Spiria] *------------------------------------------*/ -struct party_booking_ad_info* party_booking_getdata(unsigned long index); 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); |