summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/clif.c14
-rw-r--r--src/map/party.c10
-rw-r--r--src/map/party.h5
4 files changed, 17 insertions, 13 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index d6d27173c..9e12607c3 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/11/28
+ * Replaced literal constants related to the party booking system with defines. [Ai4rei]
* Fixed pets derived from immobile monsters not being able to walk (bugreport:3377, since r13789). [Ai4rei]
- This also fixes pets using original monster walk speed, instead of the one defined in pet db.
- Fixed pets not being able to attack (pet_attack_support and pet_damage_support) when derived from a monster, which is not able to attack.
diff --git a/src/map/clif.c b/src/map/clif.c
index 4e777d714..7917d5b8b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10796,10 +10796,10 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd)
{
short level = RFIFOW(fd,2);
short mapid = RFIFOW(fd,4);
- short job[6];
+ short job[PARTY_BOOKING_JOBS];
int i;
- for(i=0; i<6; i++)
+ for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOB(fd,6+i*2);
party_booking_register(sd, level, mapid, job);
@@ -10850,7 +10850,7 @@ void clif_PartyBookingSearchAck(int fd, unsigned long *index, int count, bool mo
WFIFOL(fd,i*size+33) = pb_ad->starttime;
WFIFOW(fd,i*size+37) = pb_ad->p_detail.level;
WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid;
- for(j=0; j<6; j++)
+ for(j=0; j<PARTY_BOOKING_JOBS; j++)
WFIFOW(fd,i*size+41+j*2) = pb_ad->p_detail.job[j];
}
WFIFOSET(fd,WFIFOW(fd,2));
@@ -10877,10 +10877,10 @@ void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag)
void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd)
{
- short job[6];
+ short job[PARTY_BOOKING_JOBS];
int i;
- for(i=0; i<6; i++)
+ for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOW(fd,2+i*2);
party_booking_update(sd, job);
@@ -10899,7 +10899,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo
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;
- for(i=0; i<6; i++)
+ for(i=0; i<PARTY_BOOKING_JOBS; i++)
WFIFOW(sd->fd,38+i*2) = pb_ad->p_detail.job[i];
WFIFOSET(sd->fd,packet_len(0x809));
@@ -10914,7 +10914,7 @@ void clif_PartyBookingUpdateNotify(struct map_session_data* sd, struct party_boo
WBUFW(buf,0) = 0x80a;
WBUFL(buf,2) = pb_ad->index;
- for(i=0; i<6; i++)
+ for(i=0; i<PARTY_BOOKING_JOBS; 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.
}
diff --git a/src/map/party.c b/src/map/party.c
index f7aca94dd..9e2ee5c7b 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -1123,7 +1123,7 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi
pb_ad->p_detail.level = level;
pb_ad->p_detail.mapid = mapid;
- for(i=0;i<6;i++)
+ for(i=0;i<PARTY_BOOKING_JOBS;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
@@ -1151,7 +1151,7 @@ void party_booking_update(struct map_session_data *sd, short* job)
pb_ad->starttime = (int)time(NULL);// Update time.
- for(i=0;i<6;i++)
+ for(i=0;i<PARTY_BOOKING_JOBS;i++)
if(job[i] != 0xFF)
pb_ad->p_detail.job[i] = job[i];
else pb_ad->p_detail.job[i] = -1;
@@ -1164,7 +1164,7 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid,
{
struct party_booking_ad_info *pb_ad;
int i, count=0;
- unsigned long index_list[10];
+ unsigned long index_list[PARTY_BOOKING_RESULTS];
bool more_result = false;
DBIterator* iter = party_booking_db->iterator(party_booking_db);
@@ -1174,14 +1174,14 @@ 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)))
continue;
- if (count >= 10){
+ if (count >= PARTY_BOOKING_RESULTS){
more_result = true;
break;
}
if (mapid == 0 && job == -1)
index_list[count] = pb_ad->index;
else if (mapid == 0) {
- for(i=0; i<6; i++)
+ for(i=0; i<PARTY_BOOKING_JOBS; i++)
if (pb_ad->p_detail.job[i] == job && job != -1)
index_list[count] = pb_ad->index;
} else if (job == -1){
diff --git a/src/map/party.h b/src/map/party.h
index d396d0fe6..db8339bd2 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -12,6 +12,9 @@ struct item;
#include <stdarg.h>
+#define PARTY_BOOKING_JOBS 6
+#define PARTY_BOOKING_RESULTS 10
+
struct party_member_data {
struct map_session_data *sd;
unsigned int hp; //For HP,x,y refreshing.
@@ -34,7 +37,7 @@ struct party_data {
struct party_booking_detail {
short level;
short mapid;
- short job[6];
+ short job[PARTY_BOOKING_JOBS];
};
struct party_booking_ad_info {