summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-07 20:38:33 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-03-07 20:38:33 +0000
commitb2aec3fdf96913c1ebe69957d7c8d556988e6af2 (patch)
tree092c9193ace099c13eaea28af418fcfadcb1cdff /src/map
parent6b93f724139c3ab1e74c68ce79a79ecb525848f8 (diff)
downloadhercules-b2aec3fdf96913c1ebe69957d7c8d556988e6af2.tar.gz
hercules-b2aec3fdf96913c1ebe69957d7c8d556988e6af2.tar.bz2
hercules-b2aec3fdf96913c1ebe69957d7c8d556988e6af2.tar.xz
hercules-b2aec3fdf96913c1ebe69957d7c8d556988e6af2.zip
- Fixed some bugs on auction.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12318 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c19
-rw-r--r--src/map/intif.c2
-rw-r--r--src/map/intif.h1
3 files changed, 13 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 694e6d987..6470ebb86 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11769,12 +11769,11 @@ static void clif_Auction_setitem(int fd, int index, bool fail)
WFIFOSET(fd,packet_len(0x256));
}
-void clif_parse_Auction_registerwindow(int fd, struct map_session_data *sd)
+void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd)
{
- // RFIFOW(fd,2):
- // = 0 means player opened the register window
- // = 1 means player press the Cancel button, in that window.
- // But... if player just enter the register window and press X to close, no packet is send.
+ if( sd->auction.amount > 0 )
+ clif_additem(sd, sd->auction.index, sd->auction.amount, 0);
+
sd->auction.amount = 0;
}
@@ -11787,7 +11786,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
if( sd->auction.amount > 0 )
sd->auction.amount = 0;
- if( idx < 0 || idx > MAX_INVENTORY )
+ if( idx < 0 || idx >= MAX_INVENTORY )
{
ShowWarning("Character %s trying to set invalid item index in auctions.\n", sd->status.name);
return;
@@ -11813,7 +11812,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
sd->auction.index = idx;
sd->auction.amount = amount;
- clif_Auction_setitem(fd, idx, false);
+ clif_Auction_setitem(fd, idx + 2, false);
}
// 0 = You have failed to bid into the auction
@@ -11921,6 +11920,8 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd)
char search_text[NAME_LENGTH];
short type = RFIFOW(fd,2);
int price = RFIFOL(fd,4);
+
+ clif_parse_Auction_cancelreg(fd, sd);
safestrncpy(search_text, (char*)RFIFOP(fd,8), NAME_LENGTH);
intif_Auction_requestlist(sd->status.char_id, type, price, search_text);
@@ -11931,6 +11932,8 @@ void clif_parse_Auction_buysell(int fd, struct map_session_data* sd)
short type = RFIFOW(fd,2) + 6;
char search_text[NAME_LENGTH];
+ clif_parse_Auction_cancelreg(fd, sd);
+
memset(&search_text, '\0', NAME_LENGTH);
intif_Auction_requestlist(sd->status.char_id, type, 0, search_text);
}
@@ -12469,7 +12472,7 @@ static int packetdb_readdb(void)
{clif_parse_Auction_search,"auctionsearch"},
{clif_parse_Auction_buysell,"auctionbuysell"},
{clif_parse_Auction_setitem,"auctionsetitem"},
- {clif_parse_Auction_registerwindow,"auctionregisterwindow"},
+ {clif_parse_Auction_cancelreg,"auctioncancelreg"},
{clif_parse_Auction_register,"auctionregister"},
#endif
{clif_parse_cashshop_buy,"cashshopbuy"},
diff --git a/src/map/intif.c b/src/map/intif.c
index 6bf6f4ef8..a9fba59e9 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1732,7 +1732,7 @@ static void intif_parse_Auction_register(int fd)
return;
}
- memcpy(&auction, WFIFOP(fd,4), sizeof(struct auction_data));
+ memcpy(&auction, RFIFOP(fd,4), sizeof(struct auction_data));
if( (sd = map_charid2sd(auction.seller_id)) == NULL )
return;
diff --git a/src/map/intif.h b/src/map/intif.h
index 8628e752b..8f3cd1d9a 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -11,6 +11,7 @@ struct guild_position;
struct s_pet;
struct s_homunculus;
struct mail_message;
+struct auction_data;
int intif_parse(int fd);