Bläddra i källkod

* Fixed bugreport:8632 http://rathena.org/board/tracker/issue-8632-map-server-crash/
* Revert mvptomb_destroy changes at 5988c7a, bugreport:8634 http://rathena.org/board/tracker/issue-8634-memory-issues-with-update-consistent-and-persistent-lag/
* Fixed bugreport:8640 http://rathena.org/board/tracker/issue-8640-bonus-baddmonsteriddropitem/

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 11 år sedan
förälder
incheckning
01314ae5c5
3 ändrade filer med 18 tillägg och 6 borttagningar
  1. 13 1
      src/map/mob.c
  2. 3 3
      src/map/pc.c
  3. 2 2
      src/map/pc.h

+ 13 - 1
src/map/mob.c

@@ -168,11 +168,23 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
 
 }
 
+/** Destroys MVP Tomb
+* @param md
+*/
 void mvptomb_destroy(struct mob_data *md) {
 	struct npc_data *nd;
 
 	if ( (nd = map_id2nd(md->tomb_nid)) ) {
-		npc_remove_map(nd);
+		int16 m = nd->bl.m, i;
+		clif_clearunit_area(&nd->bl,CLR_OUTSIGHT);
+		map_delblock(&nd->bl);
+
+		ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
+		if( !(i == map[m].npc_num) ) {
+			map[m].npc_num--;
+			map[m].npc[i] = map[m].npc[map[m].npc_num];
+			map[m].npc[map[m].npc_num] = NULL;
+		}
 		map_deliddb(&nd->bl);
 		aFree(nd);
 	}

+ 3 - 3
src/map/pc.c

@@ -1909,7 +1909,7 @@ static int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, e
 * @param race: target race. if < 0, means monster_id
 * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
 */
-static void pc_bonus_item_drop(struct s_add_drop *drop, const short max, uint16 nameid, uint16 group, int class_, int race, int rate)
+static void pc_bonus_item_drop(struct s_add_drop *drop, const short max, uint16 nameid, uint16 group, int class_, short race, int rate)
 {
 	uint8 i;
 	if (nameid && !group && !itemdb_exists(nameid)) {
@@ -4004,7 +4004,7 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type,
  *------------------------------------------*/
 int pc_search_inventory(struct map_session_data *sd,int item_id)
 {
-	int i;
+	int16 i;
 	nullpo_retr(-1, sd);
 
 	ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0) );
@@ -4028,7 +4028,7 @@ int pc_search_inventory(struct map_session_data *sd,int item_id)
  */
 char pc_additem(struct map_session_data *sd,struct item *item,int amount,e_log_pick_type log_type) {
 	struct item_data *id;
-	uint16 i;
+	int16 i;
 	unsigned int w;
 
 	nullpo_retr(1, sd);

+ 2 - 2
src/map/pc.h

@@ -117,8 +117,8 @@ struct s_add_drop {
 	uint16 nameid, ///Item ID
 		group; ///Group ID
 	int rate; ///Rate, 1 ~ 10000, -1 ~ -100000
-	char race, ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
-		class_; ///Target Class, bitwise value of 1<<x
+	short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
+	char class_; ///Target Class, bitwise value of 1<<x
 };
 
 struct s_autobonus {