Advertisement
Guest User

Untitled

a guest
May 28th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. TileMap::TileMap(const char* filename, const char* name) :
  2.     m_Name( name )
  3. {
  4.     std::ifstream file( filename );
  5.     std::string line;
  6.  
  7.     while( std::getline( file, line ) )
  8.     {
  9.         std::string id;
  10.         std::stringstream lineStream( line.c_str() );
  11.  
  12.         std::vector< int > lineData;
  13.  
  14.         int tmp = 0;
  15.  
  16.         while( std::getline( lineStream, id, ',' ) )
  17.         {
  18.             lineData.push_back( std::stoi( id ) );
  19.             tmp++;
  20.         }
  21.  
  22.         if( tmp > m_Width )
  23.             m_Width = tmp;
  24.         m_Height++;
  25.  
  26.         m_MapData.push_back( lineData );
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement