From b839e400a91002076cd0e14dea043b695125879d Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 24 Oct 2008 12:29:02 +0200 Subject: [PATCH] Read correctly fractional seconds. Reported by Ramon Bauza --- src/helper/ns2-mobility-helper.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helper/ns2-mobility-helper.cc b/src/helper/ns2-mobility-helper.cc index 563287b05..ed692c72b 100644 --- a/src/helper/ns2-mobility-helper.cc +++ b/src/helper/ns2-mobility-helper.cc @@ -120,14 +120,17 @@ Ns2MobilityHelper::LayoutObjectStore (const ObjectStore &store) const } else { - double at = ReadDouble (line.substr (8, startNodeId - 17)); + std::string::size_type atEnd = line.find_first_of (" ", 8); + std::string atStr = line.substr (8, atEnd-8); + NS_LOG_DEBUG (atStr); + double at = ReadDouble (atStr); std::string::size_type xSpeedEnd = line.find_first_of (" ", endNodeId + 10); std::string::size_type ySpeedEnd = line.find_first_of (" ", xSpeedEnd + 1); double xSpeed = ReadDouble (line.substr (endNodeId + 10, xSpeedEnd - endNodeId - 10)); double ySpeed = ReadDouble (line.substr (xSpeedEnd + 1, ySpeedEnd - xSpeedEnd - 1)); double zSpeed = ReadDouble (line.substr (ySpeedEnd + 1, std::string::npos)); NS_LOG_DEBUG ("at=" << at << "xSpeed=" << xSpeed << ", ySpeed=" << ySpeed << ", zSpeed=" << zSpeed); - Simulator::Schedule (Seconds (at), &StaticSpeedMobilityModel::SetSpeed, model, + Simulator::Schedule (Seconds (at), &StaticSpeedMobilityModel::SetVelocity, model, Vector (xSpeed, ySpeed, zSpeed)); } }