From a05f029a4d7ebcdc9915c994f589bbca6f072004 Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 3 Jan 2008 20:43:25 +0000 Subject: 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 --- src/map/script.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/map/script.c') 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;inext){ + 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; } -- cgit v1.2.3-70-g09d2