From 43c64f656b635e601b4f0327cc8a403fc53e5978 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 15 May 2008 10:39:44 -0700 Subject: [PATCH] ensure that the list of positions is long enough --- examples/mixed-wireless.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/mixed-wireless.cc b/examples/mixed-wireless.cc index baf9a2836..d2c1eed76 100644 --- a/examples/mixed-wireless.cc +++ b/examples/mixed-wireless.cc @@ -92,6 +92,8 @@ main (int argc, char *argv[]) uint32_t lanNodes = 5; uint32_t stopTime = 10; + + // // Simulation defaults are typically set next, before command line // arguments are parsed. @@ -159,8 +161,12 @@ main (int argc, char *argv[]) MobilityHelper mobility; Ptr positionAlloc = CreateObject (); - positionAlloc->Add (Vector (0.0, 0.0, 0.0)); - positionAlloc->Add (Vector (5.0, 0.0, 0.0)); + double x = 0.0; + for (uint32_t i = 0; i < backboneNodes; ++i) + { + positionAlloc->Add (Vector (x, 0.0, 0.0)); + x += 5.0; + } mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel", "Bounds", RectangleValue (Rectangle (0, 1000, 0, 1000)),