Little optimization on MVP tombstone system, maybe fix insane CPU usage spikes(bugreport:5968).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16318 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
d0be1bc79e
commit
3c161255d2
@ -131,9 +131,12 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
|
|||||||
{
|
{
|
||||||
struct npc_data *nd;
|
struct npc_data *nd;
|
||||||
|
|
||||||
|
if (md->tomb_npc != NULL)
|
||||||
|
mvptomb_destroy(md);
|
||||||
|
|
||||||
CREATE(nd, struct npc_data, 1);
|
CREATE(nd, struct npc_data, 1);
|
||||||
|
|
||||||
nd->bl.id = md->tomb_nid = npc_get_new_npc_id();
|
nd->bl.id = npc_get_new_npc_id();
|
||||||
|
|
||||||
nd->ud.dir = md->ud.dir;
|
nd->ud.dir = md->ud.dir;
|
||||||
nd->bl.m = md->bl.m;
|
nd->bl.m = md->bl.m;
|
||||||
@ -161,16 +164,18 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
|
|||||||
status_change_init(&nd->bl);
|
status_change_init(&nd->bl);
|
||||||
unit_dataset(&nd->bl);
|
unit_dataset(&nd->bl);
|
||||||
clif_spawn(&nd->bl);
|
clif_spawn(&nd->bl);
|
||||||
|
|
||||||
|
md->tomb_npc = nd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mvptomb_destroy(struct mob_data *md)
|
void mvptomb_destroy(struct mob_data *md)
|
||||||
{
|
{
|
||||||
struct npc_data *nd = (struct npc_data *)map_id2bl(md->tomb_nid);
|
struct npc_data *nd = md->tomb_npc;
|
||||||
|
|
||||||
if (nd)
|
if (nd)
|
||||||
npc_unload(nd,true);
|
npc_unload(nd,true);
|
||||||
|
|
||||||
md->tomb_nid = 0;
|
md->tomb_npc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
@ -966,7 +971,7 @@ int mob_spawn (struct mob_data *md)
|
|||||||
md->sc.option = md->db->option;
|
md->sc.option = md->db->option;
|
||||||
|
|
||||||
// MvP tomb [GreenBox]
|
// MvP tomb [GreenBox]
|
||||||
if (md->tomb_nid)
|
if (md->tomb_npc)
|
||||||
mvptomb_destroy(md);
|
mvptomb_destroy(md);
|
||||||
|
|
||||||
map_addblock(&md->bl);
|
map_addblock(&md->bl);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "map.h" // struct status_data, struct view_data, struct mob_skill
|
#include "map.h" // struct status_data, struct view_data, struct mob_skill
|
||||||
#include "status.h" // struct status data, struct status_change
|
#include "status.h" // struct status data, struct status_change
|
||||||
#include "unit.h" // unit_stop_walking(), unit_stop_attack()
|
#include "unit.h" // unit_stop_walking(), unit_stop_attack()
|
||||||
|
#include "npc.h"
|
||||||
|
|
||||||
#define MAX_RANDOMMONSTER 4
|
#define MAX_RANDOMMONSTER 4
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ struct mob_data {
|
|||||||
**/
|
**/
|
||||||
bool can_summon : 1;
|
bool can_summon : 1;
|
||||||
|
|
||||||
int tomb_nid;
|
struct npc_data *tomb_npc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2331,7 +2331,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
|
|||||||
}
|
}
|
||||||
if( mob_is_clone(md->class_) )
|
if( mob_is_clone(md->class_) )
|
||||||
mob_clone_delete(md);
|
mob_clone_delete(md);
|
||||||
if( md->tomb_nid )
|
if( md->tomb_npc )
|
||||||
mvptomb_destroy(md);
|
mvptomb_destroy(md);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user