Explorar el Código

- The last bug in Adoption system.
- Fixed a bug on trade, if you received a trade without accept it do logout... the other player cannot trade anymore 'til restart.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12396 54d463be-8e91-2dee-dedb-b68131a5f0ec

zephyrus hace 17 años
padre
commit
2c8b8a0715
Se han modificado 4 ficheros con 10 adiciones y 4 borrados
  1. 2 2
      src/map/clif.c
  2. 1 1
      src/map/pc.c
  3. 6 1
      src/map/trade.c
  4. 1 0
      src/map/unit.c

+ 2 - 2
src/map/clif.c

@@ -12043,7 +12043,7 @@ void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *sr
 {
 	int fd = sd->fd;
 
-	WFIFOSET(fd,34);
+	WFIFOHEAD(fd,34);
 	WFIFOW(fd,0) = 0x01f6;
 	WFIFOL(fd,2) = src->status.account_id;
 	WFIFOL(fd,6) = p_id;
@@ -12055,7 +12055,7 @@ void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
 {
 	struct map_session_data *tsd = map_id2sd(RFIFOL(fd,2)), *p_sd = map_charid2sd(sd->status.partner_id);
 
-	if( pc_can_Adopt(sd, tsd, p_sd) )
+	if( pc_can_Adopt(sd, p_sd, tsd) )
 	{
 		tsd->adopt_invite = sd->status.account_id;
 		clif_Adopt_request(tsd, sd, p_sd->status.account_id);

+ 1 - 1
src/map/pc.c

@@ -645,7 +645,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
 
 		// Parents Skills
 		pc_skill(p1_sd, WE_CALLBABY, 1, 0);
-		pc_skill(p1_sd, WE_CALLBABY, 1, 0);
+		pc_skill(p2_sd, WE_CALLBABY, 1, 0);
 		
 		return true;
 	}

+ 6 - 1
src/map/trade.c

@@ -443,8 +443,14 @@ void trade_tradecancel(struct map_session_data *sd)
 	struct map_session_data *target_sd;
 	int trade_i;
 
+	target_sd = map_id2sd(sd->trade_partner);
+
 	if(!sd->state.trading)
+	{ // Not trade acepted
+		if( target_sd ) target_sd->trade_partner = 0;
+		sd->trade_partner = 0;
 		return;
+	}
 	
 	for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual)
 		if (!sd->deal.item[trade_i].amount)
@@ -458,7 +464,6 @@ void trade_tradecancel(struct map_session_data *sd)
 		sd->deal.zeny = 0;
 	}
 
-	target_sd = map_id2sd(sd->trade_partner);
 	sd->state.deal_locked = 0;
 	sd->state.trading = 0;
 	sd->trade_partner = 0;

+ 1 - 0
src/map/unit.c

@@ -1672,6 +1672,7 @@ int unit_remove_map(struct block_list *bl, int clrtype)
 			sd->menuskill_id = sd->menuskill_val = 0;
 
 		sd->npc_shopid = 0;
+		sd->adopt_invite = 0;
 
 		if(sd->pvp_timer!=-1) {
 			delete_timer(sd->pvp_timer,pc_calc_pvprank_timer);