summaryrefslogtreecommitdiff
path: root/src/map/trade.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-20 16:04:47 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-20 16:04:47 +0000
commitb5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c (patch)
tree455e9289ccd1981acdd35e459b099a1e79a3552d /src/map/trade.c
parentee340265a907f243c01588d86b47f244acf7e268 (diff)
downloadhercules-b5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c.tar.gz
hercules-b5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c.tar.bz2
hercules-b5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c.tar.xz
hercules-b5b4c77e5fff30072c7c24ed8a8d7316d08d8c9c.zip
- Added support for n to specify minutes to @charban.
- Fixed a logic typo on the way dummy_npc_id was defined. - Added state.trading to specify when a trading has started. Now you should be able to walk around until the trade is either rejected or started. - Armor defense is no longer reduced by the amount of characters targetting you. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6192 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/trade.c')
-rw-r--r--src/map/trade.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/map/trade.c b/src/map/trade.c
index eb870418d..e808083d1 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -45,7 +45,7 @@ void trade_traderequest(struct map_session_data *sd, int target_id) {
if ( pc_can_give_items(level) || pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade
{
clif_displaymessage(sd->fd, msg_txt(246));
- trade_tradecancel(sd); // GM is not allowed to trade
+ trade_tradecancel(sd); // GM is not allowed to trade
} else if ((target_sd->trade_partner != 0) || (sd->trade_partner != 0)) {
trade_tradecancel(sd); // person is in another trade
} else {
@@ -83,8 +83,9 @@ void trade_tradeack(struct map_session_data *sd, int type) {
target_sd->trade_partner = 0;
}
-
if (type == 3) { //Initiate trade
+ sd->state.trading = 1;
+ target_sd->state.trading = 1;
memset(&sd->deal, 0, sizeof(sd->deal));
memset(&target_sd->deal, 0, sizeof(target_sd->deal));
}
@@ -284,7 +285,7 @@ void trade_tradeadditem(struct map_session_data *sd, int index, int amount) {
int trade_i, trade_weight, nameid;
nullpo_retv(sd);
- if ((target_sd = map_id2sd(sd->trade_partner)) == NULL || sd->state.deal_locked > 0)
+ if (!sd->state.trading || (target_sd = map_id2sd(sd->trade_partner)) == NULL || sd->state.deal_locked > 0)
return; //Can't add stuff.
if (index == 0)
@@ -428,8 +429,10 @@ void trade_tradecancel(struct map_session_data *sd) {
}
sd->state.deal_locked = 0;
sd->trade_partner = 0;
+ sd->state.trading = 0;
target_sd->state.deal_locked = 0;
target_sd->trade_partner = 0;
+ target_sd->state.trading = 0;
clif_tradecancelled(sd);
clif_tradecancelled(target_sd);
}
@@ -446,7 +449,7 @@ void trade_tradecommit(struct map_session_data *sd) {
nullpo_retv(sd);
- if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) {
+ if (sd->state.trading && (target_sd = map_id2sd(sd->trade_partner)) != NULL) {
if ((sd->state.deal_locked >= 1) && (target_sd->state.deal_locked >= 1)) { // both have pressed 'ok'
if (sd->state.deal_locked < 2) { // set locked to 2
sd->state.deal_locked = 2;
@@ -545,8 +548,10 @@ void trade_tradecommit(struct map_session_data *sd) {
}
sd->state.deal_locked = 0;
sd->trade_partner = 0;
+ sd->state.trading = 0;
target_sd->state.deal_locked = 0;
target_sd->trade_partner = 0;
+ target_sd->state.trading = 0;
clif_tradecompleted(sd, 0);
clif_tradecompleted(target_sd, 0);
// save both player to avoid crash: they always have no advantage/disadvantage between the 2 players