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 */ }