ensure that the list of positions is long enough
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 15 May 2008 10:39:44 -0700
changeset 3079 68f79ef69388
parent 3078 22756d7f8bb5
child 3080 030e4a88c6d7
ensure that the list of positions is long enough
examples/mixed-wireless.cc
--- a/examples/mixed-wireless.cc	Thu May 15 10:29:58 2008 -0700
+++ b/examples/mixed-wireless.cc	Thu May 15 10:39:44 2008 -0700
@@ -92,6 +92,8 @@
   uint32_t lanNodes = 5;
   uint32_t stopTime = 10;
 
+
+
   //
   // Simulation defaults are typically set next, before command line
   // arguments are parsed.
@@ -159,8 +161,12 @@
   MobilityHelper mobility;
   Ptr<ListPositionAllocator> positionAlloc = 
     CreateObject<ListPositionAllocator> ();
-  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)),