diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-01-13 10:38:54 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-01-13 10:38:54 +0000 |
commit | 9d1b39d3facc6d9f1268e036e7b23bd410c683ec (patch) | |
tree | 355fc27fb7d8431737b6d5fd2b62b3b00c7baf21 /src/map/map.c | |
parent | 4ae49e2bfd82567f5747eaed81f02f515e556441 (diff) | |
download | hercules-9d1b39d3facc6d9f1268e036e7b23bd410c683ec.tar.gz hercules-9d1b39d3facc6d9f1268e036e7b23bd410c683ec.tar.bz2 hercules-9d1b39d3facc6d9f1268e036e7b23bd410c683ec.tar.xz hercules-9d1b39d3facc6d9f1268e036e7b23bd410c683ec.zip |
Mobs with nonzero spawn time can now be cached as well, saving some more cpu/memory (bugreport:1197).
Fixed dynamic mobs being unloaded without stopping their respawn timer.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13445 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/map/map.c b/src/map/map.c index a7374a309..14a93c669 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2129,14 +2129,17 @@ int map_removemobs_sub(struct block_list *bl, va_list ap) struct mob_data *md = (struct mob_data *)bl; nullpo_retr(0, md); - //When not to remove: - //Mob doesn't respawn and is not a slave + //When not to remove mob: + // doesn't respawn and is not a slave if( !md->spawn && !md->master_id ) return 0; - //Mob respawn data is not in cache + // respawn data is not in cache if( md->spawn && !md->spawn->state.dynamic ) return 0; - //Mob is damaged and mob_remove_damaged is off + // hasn't spawned yet + if( md->spawn_timer != INVALID_TIMER ) + return 0; + // is damaged and mob_remove_damaged is off if( !battle_config.mob_remove_damaged && md->status.hp < md->status.max_hp ) return 0; @@ -2174,7 +2177,7 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr data) void map_removemobs(int m) { - if (map[m].mob_delete_timer != -1) + if (map[m].mob_delete_timer != -1) // should never happen return; //Mobs are already scheduled for removal map[m].mob_delete_timer = add_timer(gettick()+battle_config.mob_remove_delay, map_removemobs_timer, m, 0); |