diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-19 22:02:26 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-19 22:02:26 +0000 |
commit | 4718c2c268bacd011912a5a3a483f192995eee9a (patch) | |
tree | b7ba043c17232df91183382e38cd29a2b35785fe /src/map/mob.c | |
parent | 566c55b79cfb5f09bd9ba9543eca1ff74786578c (diff) | |
download | hercules-4718c2c268bacd011912a5a3a483f192995eee9a.tar.gz hercules-4718c2c268bacd011912a5a3a483f192995eee9a.tar.bz2 hercules-4718c2c268bacd011912a5a3a483f192995eee9a.tar.xz hercules-4718c2c268bacd011912a5a3a483f192995eee9a.zip |
Changed the dynamic mobs system to also unload mobs that have respawn time but are already spawned - 22M less mem usage (bugreport:1197).
Also added a check to not respawn mobs on maps with no players (potentially unsafe operation, needs further inspection).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12402 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index a26726b21..36efd6614 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -888,6 +888,13 @@ int mob_spawn (struct mob_data *md) md->bl.x = md->spawn->x; md->bl.y = md->spawn->y; + if( map[md->spawn->m].users == 0 && md->spawn->state.dynamic ) + {// cache the mob instead of spawning it + //FIXME: deleting 'md' is a potentially dangerous operation + unit_free(&md->bl,0); + return 0; + } + if ((md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys) { //Monster can be spawned on an area. if (!map_search_freecell(&md->bl, -1, |