Bladeren bron

- Fixed overflow on the mob delay adjustment setting.
- Fixed characters being unable to trade again if you attempt a trade on someone who is on storage/npc when you accept the trade.


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

skotlex 18 jaren geleden
bovenliggende
commit
81e6fbf053
3 gewijzigde bestanden met toevoegingen van 15 en 7 verwijderingen
  1. 3 0
      Changelog-Trunk.txt
  2. 8 7
      src/map/npc.c
  3. 4 0
      src/map/trade.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2007/01/18
+	* Fixed overflow on the mob delay adjustment setting.
+	* Fixed characters being unable to trade again if you attempt a trade on
+	  someone who is on storage/npc when you accept the trade. [Skotlex]
 	* Fixed a crash when a castle from [0..MAX-1] wasn't in the db [ultramage]
 2007/01/17
 	* Corrected atcommand @homstats so it shows the correct minimum/maximum

+ 8 - 7
src/map/npc.c

@@ -2281,20 +2281,21 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
 	mode = mob_db(class_)->status.mode;
 	if (mode & MD_BOSS) {	//Bosses
 		if (battle_config.boss_spawn_delay != 100)
-		{
-			mob.delay1 = mob.delay1*battle_config.boss_spawn_delay/100;
-			mob.delay2 = mob.delay2*battle_config.boss_spawn_delay/100;
+		{	// Divide by 100 first to prevent overflows
+			//(precision loss is minimal as duration is in ms already)
+			mob.delay1 = mob.delay1/100*battle_config.boss_spawn_delay;
+			mob.delay2 = mob.delay2/100*battle_config.boss_spawn_delay;
 		}
 	} else if (mode&MD_PLANT) {	//Plants
 		if (battle_config.plant_spawn_delay != 100)
 		{
-			mob.delay1 = mob.delay1*battle_config.plant_spawn_delay/100;
-			mob.delay2 = mob.delay2*battle_config.plant_spawn_delay/100;
+			mob.delay1 = mob.delay1/100*battle_config.plant_spawn_delay;
+			mob.delay2 = mob.delay2/100*battle_config.plant_spawn_delay;
 		}
 	} else if (battle_config.mob_spawn_delay != 100)
 	{	//Normal mobs
-		mob.delay1 = mob.delay1*battle_config.mob_spawn_delay/100;
-		mob.delay2 = mob.delay2*battle_config.mob_spawn_delay/100;
+		mob.delay1 = mob.delay1/100*battle_config.mob_spawn_delay;
+		mob.delay2 = mob.delay2/100*battle_config.mob_spawn_delay;
 	}
 
 	// parse MOB_NAME,[MOB LEVEL]

+ 4 - 0
src/map/trade.c

@@ -132,6 +132,10 @@ void trade_tradeack(struct map_session_data *sd, int type) {
 	if (sd->npc_id || sd->vender_id || sd->state.storage_flag ||
 		tsd->npc_id || tsd->vender_id || tsd->state.storage_flag)
 	{	//Fail
+		sd->state.deal_locked = 0;
+		sd->trade_partner = 0;
+		tsd->state.deal_locked = 0;
+		tsd->trade_partner = 0;
 		clif_tradestart(sd, 2);
 		clif_tradestart(tsd, 2);
 		return;