예제 #1
0
파일: test.c 프로젝트: 386898917/aoi
int
main() {
	struct alloc_cookie cookie = { 0,0,0 };
	struct aoi_space * space = aoi_create(my_alloc , &cookie);

	test(space);

	aoi_release(space);
	printf("max memory = %d, current memory = %d\n", cookie.max , cookie.current);
	return 0;
}
예제 #2
0
static int lua_create_aoimap(lua_State *L){
	uint32_t length = lua_tonumber(L,1);
	uint32_t radius = lua_tonumber(L,2);
	point2D  top_left,bottom_right;
	top_left.x = lua_tonumber(L,3);
	top_left.y = lua_tonumber(L,4);
	bottom_right.x = lua_tonumber(L,5);
	bottom_right.y = lua_tonumber(L,6);	
	aoi_map *m = aoi_create(4096,length,radius,&top_left,&bottom_right);
	lua_pushlightuserdata(L,(void*)m);
	return 1;
}
예제 #3
0
int luaNewBattleMap(lua_State *L){
	string_t mapname = new_string(lua_tostring(L,-1));
	struct mapdefine *def = get_mapdefine(mapname);
	if(def){
		struct battlemap *map = calloc(1,sizeof(*map));
		map->map = def->map;
		map->aoi = aoi_create(512,def->length,def->radius,&def->top_left,&def->bottom_right);
		map->astar = create_astar(_get_neighbors,_cost_2_neighbor,_cost_2_goal);
		PUSH_LUSRDATA(L,map);
	}else
		PUSH_NIL(L);
	return 1;
}
예제 #4
0
파일: testmap.c 프로젝트: 386898917/aoi
int
main()
{
	struct alloc_cookie cookie = { 0,0,0 };
	SPACE = aoi_create(my_alloc , &cookie);

	struct map * m = map_new(SPACE);

	int i;
	for (i=0;i<10;i++) {
		test(m,10,i*10);
	}
	test(m,100,100);
	test(m,200,200);
	test(m,500,500);

	map_foreach(m,check,m);

	map_delete(SPACE, m);
	aoi_release(SPACE);

	printf("max memory = %d, current memory = %d\n", cookie.max , cookie.current);
	return 0;
}
예제 #5
0
파일: aoi.c 프로젝트: ChowZenki/aoi
struct aoi_space * 
aoi_new() {
	return aoi_create(default_alloc, NULL);
}