From 5beb5d6cc873b04cb5743451db6f673c34ab1d04 Mon Sep 17 00:00:00 2001 From: tegzed Date: Sun, 11 Sep 2011 18:01:37 +0000 Subject: fix:map/csv:fix quadtree splitting git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@4777 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/map/csv/quadtree.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'navit/map') diff --git a/navit/map/csv/quadtree.c b/navit/map/csv/quadtree.c index 3d4911aa3..58096ed3a 100644 --- a/navit/map/csv/quadtree.c +++ b/navit/map/csv/quadtree.c @@ -349,8 +349,7 @@ quadtree_add(struct quadtree_node* this_, struct quadtree_item* item) { int i; double lon = this_->items[0].longitude, lat = this_->items[0].latitude; - this_->items[this_->node_num++] = *item; - if(QUADTREE_NODE_CAPACITY == this_->node_num) { + if(QUADTREE_NODE_CAPACITY-1 == this_->node_num) { //avoid infinite recursion when all elements has the same coordinate for(i=0;inode_num;++i) { if (lon != this_->items[i].longitude || lat != this_->items[i].latitude) { @@ -361,7 +360,10 @@ quadtree_add(struct quadtree_node* this_, struct quadtree_item* item) { if (bSame) { return; } + this_->items[this_->node_num++] = *item; quadtree_split(this_); + } else { + this_->items[this_->node_num++] = *item; } } else { -- cgit v1.2.1