Explorar el Código

* Fixed a crash when mob uses self-destruct skills (bugreport:2568) [Inkfish]

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13754 54d463be-8e91-2dee-dedb-b68131a5f0ec
Inkfish hace 16 años
padre
commit
c5b963aa46
Se han modificado 2 ficheros con 13 adiciones y 6 borrados
  1. 2 0
      Changelog-Trunk.txt
  2. 11 6
      src/map/mob.c

+ 2 - 0
Changelog-Trunk.txt

@@ -2,6 +2,8 @@ Date	Added
 
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+09/05/11
+	* Fixed a crash when mob uses self-destruct skill (bugreport:2874) [Inkfish]
 09/05/10
 	* Magnetic Earth will never stack (bugreport:2568) [Inkfish]
 	* Fixed Joint Beat incorrect DEF reduction (bugreport:3051) [Inkfish]

+ 11 - 6
src/map/mob.c

@@ -3010,10 +3010,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 				map_search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3);
 			}
 			md->skillidx = i;
-			if (!unit_skilluse_pos2(&md->bl, x, y,
-				ms[i].skill_id, ms[i].skill_lv,
-				ms[i].casttime, ms[i].cancel))
+			map_freeblock_lock();
+			if (!unit_skilluse_pos2(&md->bl, x, y, ms[i].skill_id, ms[i].skill_lv, ms[i].casttime, ms[i].cancel))
+			{
+				map_freeblock_unlock();
 				continue;
+			}
 		} else {
 			//Targetted skill
 			switch (ms[i].target) {
@@ -3044,10 +3046,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 			}
 			if (!bl) continue;
 			md->skillidx = i;
-			if (!unit_skilluse_id2(&md->bl, bl->id,
-				ms[i].skill_id, ms[i].skill_lv,
-				ms[i].casttime, ms[i].cancel))
+			map_freeblock_lock();
+			if (!unit_skilluse_id2(&md->bl, bl->id, ms[i].skill_id, ms[i].skill_lv, ms[i].casttime, ms[i].cancel))
+			{
+				map_freeblock_unlock();
 				continue;
+			}
 		}
 		//Skill used. Post-setups... 
 		if(!(battle_config.mob_ai&0x200))
@@ -3057,6 +3061,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
 					md->skilldelay[j]=tick;
 		} else
 			md->skilldelay[i]=tick;
+		map_freeblock_unlock();
 		return 1;
 	}
 	//No skill was used.