Refactored Party Booking defines (fixes #1018)
* Adjusted the name of the defines to better suit their purpose. Thanks to @Artuvazro!
This commit is contained in:
parent
0fb78d45b7
commit
ed7157c80b
@ -12811,10 +12811,10 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd){
|
|||||||
short level = RFIFOW(fd,info->pos[0]);
|
short level = RFIFOW(fd,info->pos[0]);
|
||||||
short mapid = RFIFOW(fd,info->pos[1]);
|
short mapid = RFIFOW(fd,info->pos[1]);
|
||||||
int idxpbj = info->pos[2];
|
int idxpbj = info->pos[2];
|
||||||
short job[PARTY_BOOKING_JOBS];
|
short job[MAX_PARTY_BOOKING_JOBS];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<PARTY_BOOKING_JOBS; i++)
|
for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
job[i] = RFIFOB(fd,idxpbj+i*2);
|
job[i] = RFIFOB(fd,idxpbj+i*2);
|
||||||
|
|
||||||
party_booking_register(sd, level, mapid, job);
|
party_booking_register(sd, level, mapid, job);
|
||||||
@ -12874,7 +12874,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results,
|
|||||||
WFIFOL(fd,i*size+33) = pb_ad->starttime; // FIXME: This is expire time
|
WFIFOL(fd,i*size+33) = pb_ad->starttime; // FIXME: This is expire time
|
||||||
WFIFOW(fd,i*size+37) = pb_ad->p_detail.level;
|
WFIFOW(fd,i*size+37) = pb_ad->p_detail.level;
|
||||||
WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid;
|
WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid;
|
||||||
for(j=0; j<PARTY_BOOKING_JOBS; j++)
|
for(j=0; j<MAX_PARTY_BOOKING_JOBS; j++)
|
||||||
WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j];
|
WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j];
|
||||||
}
|
}
|
||||||
WFIFOSET(fd,WFIFOW(fd,2));
|
WFIFOSET(fd,WFIFOW(fd,2));
|
||||||
@ -12912,11 +12912,11 @@ void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag)
|
|||||||
/// 0808 { <job>.W }*6
|
/// 0808 { <job>.W }*6
|
||||||
void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd)
|
void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd)
|
||||||
{
|
{
|
||||||
short job[PARTY_BOOKING_JOBS];
|
short job[MAX_PARTY_BOOKING_JOBS];
|
||||||
int i;
|
int i;
|
||||||
int idxpbu = packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0];
|
int idxpbu = packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0];
|
||||||
|
|
||||||
for(i=0; i<PARTY_BOOKING_JOBS; i++)
|
for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
job[i] = RFIFOW(fd,idxpbu+i*2);
|
job[i] = RFIFOW(fd,idxpbu+i*2);
|
||||||
|
|
||||||
party_booking_update(sd, job);
|
party_booking_update(sd, job);
|
||||||
@ -12928,7 +12928,7 @@ 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)
|
void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8 buf[38+PARTY_BOOKING_JOBS*2];
|
uint8 buf[38+MAX_PARTY_BOOKING_JOBS*2];
|
||||||
|
|
||||||
if(pb_ad == NULL) return;
|
if(pb_ad == NULL) return;
|
||||||
|
|
||||||
@ -12938,7 +12938,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo
|
|||||||
WBUFL(buf,30) = pb_ad->starttime; // FIXME: This is expire time
|
WBUFL(buf,30) = pb_ad->starttime; // FIXME: This is expire time
|
||||||
WBUFW(buf,34) = pb_ad->p_detail.level;
|
WBUFW(buf,34) = pb_ad->p_detail.level;
|
||||||
WBUFW(buf,36) = pb_ad->p_detail.mapid;
|
WBUFW(buf,36) = pb_ad->p_detail.mapid;
|
||||||
for(i=0; i<PARTY_BOOKING_JOBS; i++)
|
for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i];
|
WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i];
|
||||||
|
|
||||||
clif_send(buf, packet_len(0x809), &sd->bl, ALL_CLIENT);
|
clif_send(buf, packet_len(0x809), &sd->bl, ALL_CLIENT);
|
||||||
@ -12950,13 +12950,13 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo
|
|||||||
void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad)
|
void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8 buf[6+PARTY_BOOKING_JOBS*2];
|
uint8 buf[6+MAX_PARTY_BOOKING_JOBS*2];
|
||||||
|
|
||||||
if(pb_ad == NULL) return;
|
if(pb_ad == NULL) return;
|
||||||
|
|
||||||
WBUFW(buf,0) = 0x80a;
|
WBUFW(buf,0) = 0x80a;
|
||||||
WBUFL(buf,2) = pb_ad->index;
|
WBUFL(buf,2) = pb_ad->index;
|
||||||
for(i=0; i<PARTY_BOOKING_JOBS; i++)
|
for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i];
|
WBUFW(buf,6+i*2) = pb_ad->p_detail.job[i];
|
||||||
clif_send(buf,packet_len(0x80a),&sd->bl,ALL_CLIENT); // Now UPDATE all client.
|
clif_send(buf,packet_len(0x80a),&sd->bl,ALL_CLIENT); // Now UPDATE all client.
|
||||||
}
|
}
|
||||||
|
@ -1278,7 +1278,7 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi
|
|||||||
pb_ad->p_detail.level = level;
|
pb_ad->p_detail.level = level;
|
||||||
pb_ad->p_detail.mapid = mapid;
|
pb_ad->p_detail.mapid = mapid;
|
||||||
|
|
||||||
for(i = 0; i < PARTY_BOOKING_JOBS; i++)
|
for(i = 0; i < MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
if(job[i] != 0xFF)
|
if(job[i] != 0xFF)
|
||||||
pb_ad->p_detail.job[i] = job[i];
|
pb_ad->p_detail.job[i] = job[i];
|
||||||
else pb_ad->p_detail.job[i] = -1;
|
else pb_ad->p_detail.job[i] = -1;
|
||||||
@ -1299,7 +1299,7 @@ void party_booking_update(struct map_session_data *sd, short* job)
|
|||||||
|
|
||||||
pb_ad->starttime = (int)time(NULL);// Update time.
|
pb_ad->starttime = (int)time(NULL);// Update time.
|
||||||
|
|
||||||
for(i = 0; i < PARTY_BOOKING_JOBS; i++)
|
for(i = 0; i < MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
if(job[i] != 0xFF)
|
if(job[i] != 0xFF)
|
||||||
pb_ad->p_detail.job[i] = job[i];
|
pb_ad->p_detail.job[i] = job[i];
|
||||||
else
|
else
|
||||||
@ -1312,7 +1312,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
|
|||||||
{
|
{
|
||||||
struct party_booking_ad_info *pb_ad;
|
struct party_booking_ad_info *pb_ad;
|
||||||
int i, count=0;
|
int i, count=0;
|
||||||
struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS];
|
struct party_booking_ad_info* result_list[MAX_PARTY_BOOKING_RESULTS];
|
||||||
bool more_result = false;
|
bool more_result = false;
|
||||||
DBIterator* iter = db_iterator(party_booking_db);
|
DBIterator* iter = db_iterator(party_booking_db);
|
||||||
|
|
||||||
@ -1322,7 +1322,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
|
|||||||
if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
|
if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (count >= PARTY_BOOKING_RESULTS) {
|
if (count >= MAX_PARTY_BOOKING_RESULTS) {
|
||||||
more_result = true;
|
more_result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1330,7 +1330,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
|
|||||||
if (mapid == 0 && job == -1)
|
if (mapid == 0 && job == -1)
|
||||||
result_list[count] = pb_ad;
|
result_list[count] = pb_ad;
|
||||||
else if (mapid == 0) {
|
else if (mapid == 0) {
|
||||||
for(i=0; i<PARTY_BOOKING_JOBS; i++)
|
for(i=0; i<MAX_PARTY_BOOKING_JOBS; i++)
|
||||||
if (pb_ad->p_detail.job[i] == job && job != -1)
|
if (pb_ad->p_detail.job[i] == job && job != -1)
|
||||||
result_list[count] = pb_ad;
|
result_list[count] = pb_ad;
|
||||||
} else if (job == -1) {
|
} else if (job == -1) {
|
||||||
|
@ -12,8 +12,8 @@ struct item;
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define PARTY_BOOKING_JOBS 6
|
#define MAX_PARTY_BOOKING_JOBS 6
|
||||||
#define PARTY_BOOKING_RESULTS 10
|
#define MAX_PARTY_BOOKING_RESULTS 10
|
||||||
|
|
||||||
struct party_member_data {
|
struct party_member_data {
|
||||||
struct map_session_data *sd;
|
struct map_session_data *sd;
|
||||||
@ -37,7 +37,7 @@ struct party_data {
|
|||||||
struct party_booking_detail {
|
struct party_booking_detail {
|
||||||
short level;
|
short level;
|
||||||
short mapid;
|
short mapid;
|
||||||
short job[PARTY_BOOKING_JOBS];
|
short job[MAX_PARTY_BOOKING_JOBS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct party_booking_ad_info {
|
struct party_booking_ad_info {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user