summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-03 20:43:25 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-03 20:43:25 +0000
commita05f029a4d7ebcdc9915c994f589bbca6f072004 (patch)
tree361fa929d1156b6fc8aa540e99d45b7390262569 /src/map/script.c
parent4a5df18906e0559b583d7857bf868859bfedf731 (diff)
downloadhercules-a05f029a4d7ebcdc9915c994f589bbca6f072004.tar.gz
hercules-a05f029a4d7ebcdc9915c994f589bbca6f072004.tar.bz2
hercules-a05f029a4d7ebcdc9915c994f589bbca6f072004.tar.xz
hercules-a05f029a4d7ebcdc9915c994f589bbca6f072004.zip
Removed map_data's block_count, as (quote Yor/ja2160), "Perhaps useful for debug, but uses memory AND CPU for nothing." (block lists are linked lists, they don't need count tracking)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12001 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8b7135e40..a52bf0323 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10705,8 +10705,8 @@ BUILDIN_FUNC(jump_zero)
BUILDIN_FUNC(getmapmobs)
{
const char *str=NULL;
- int m=-1,bx,by,i;
- int count=0,c;
+ int m=-1,bx,by;
+ int count=0;
struct block_list *bl;
str=script_getstr(st,2);
@@ -10727,16 +10727,12 @@ BUILDIN_FUNC(getmapmobs)
return 0;
}
- for(by=0;by<=(map[m].ys-1)/BLOCK_SIZE;by++){
- for(bx=0;bx<=(map[m].xs-1)/BLOCK_SIZE;bx++){
- bl = map[m].block_mob[bx+by*map[m].bxs];
- c = map[m].block_mob_count[bx+by*map[m].bxs];
- for(i=0;i<c && bl;i++,bl=bl->next){
+ for(by=0;by<=(map[m].ys-1)/BLOCK_SIZE;by++)
+ for(bx=0;bx<=(map[m].xs-1)/BLOCK_SIZE;bx++)
+ for( bl = map[m].block_mob[bx+by*map[m].bxs] ; bl != NULL ; bl = bl->next )
if(bl->x>=0 && bl->x<=map[m].xs-1 && bl->y>=0 && bl->y<=map[m].ys-1)
count++;
- }
- }
- }
+
script_pushint(st,count);
return 0;
}