From cbe71f0004d2663e56e5e192f43efde30a750d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Lassabe?= Date: Wed, 7 May 2008 12:15:42 +0000 Subject: [PATCH] Fixes the new dist_max search Last (at least, we hope) mod. of getkClosestInSs function. git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@33 785a6c6c-259e-4ff1-8b91-dc31627914f0 --- GuiNuMo-server/server.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/GuiNuMo-server/server.cc b/GuiNuMo-server/server.cc index 1e1b931..7b55c56 100644 --- a/GuiNuMo-server/server.cc +++ b/GuiNuMo-server/server.cc @@ -388,16 +388,15 @@ vector Server::getkClosestInSs(const vector &m, const unsign for (j = 0 ; j < distances_vector.size() ; j++) if (distances_vector[j] == dist_max) { - dist_max = tmp_distance; - /* Old fashion - distances_vector.erase(distances_vector.begin() + j); - points_vector.erase(points_vector.begin() + j); - distances_vector.push_back(tmp_distance); - points_vector.push_back(reference_point_list[i].getCoordinates());*/ distance_vector[j] = tmp_distance; points_vector[j] = reference_point_list[i].getCoordinates(); break; } + /* Now seek the new max. distance */ + dist_max = distances_vector[0]; + for(j = 1 ; j < distances_vector.size() ; j++) + if(distances_vector[j] > dist_max) + dist_max = distances_vector[j]; } /* Else nothing needs to be done */ }