title: c++ vector not filling correctly
body: <p>I'm making an engine that is supposed to read formatted text files and output them as a text based adventure. The world is being written into a vector matrix. However, my program only seems to fill the matrix in one Dimension and only with the information from the very first cell of the matrix.</p>
  
  <p>The WorldReader reads the World file and returns a specified line:</p>
  
  <pre><code>std::string WorldReader(std::string file,int line)
  {
  
      std::string out[n];
      int i = 0;
      World.open(file + "World.txt");
      if(!World.good())
          return "Bad File";
      else while(i&lt;n &amp;&amp; getline(World, out[i]))
      {
          i++;
      }
      World.close();
      return out[line];
  }
  </code></pre>
  
  <p>Here is the write loop:</p>
  
  <pre><code>            for(j=0; j&lt;(width*height); j++)
              {
                  int x;
                  int y;
                  stringstream Coordx(WorldReader(loc, 4+j*10));
                  Coordx &gt;&gt;  x;
                  stringstream Coordy(WorldReader(loc, 5+j*10));              
                  Coordy &gt;&gt;  y;
                  std::string Desc = WorldReader(loc, 6+j*10);
                  W1.writeCell(x,y,0,Desc);
              }
  </code></pre>
  
  <p>and here is the writeCell function:</p>
  
  <pre><code>    std::vector&lt;std::string&gt; Value;
      std::vector&lt;std::vector&lt;std::string&gt; &gt; wH;
      std::vector&lt; std::vector&lt;std::vector&lt;std::string&gt; &gt; &gt; grid;
  
  void World::writeCell(int writelocW, int writelocH, int ValLoc, std::string input)
  {
      if (wH.size() &gt; writelocH)
      {
          Value.insert(Value.begin()+ValLoc,1,input);
          wH.insert(wH.begin() + writelocH,1,Value);
          grid.insert(grid.begin() + writelocW,1,wH);
      }
      else
      {
          wH.insert(wH.begin(),1,Value);    
          grid.insert(grid.begin(),1,wH);
      }
  }
  </code></pre>
  
  <p>also the matrix is getting immensely bloated even though i resized it to 3x3. </p>
  
  <p>tips and help appreciated.</p>