Packing arrays to VariantList takes lot of time

Issue #231 resolved
dalerank repo owner created an issue

Сan use base64 encoding to reduce the processing time and takes place in a save file

Here:

void Tilemap::save( VariantMap& stream ) const
{
  // saves the graphics map
  VariantList bitsetInfo;
  VariantList desInfo;
  VariantList idInfo;

  TilesArray tiles = const_cast< Tilemap* >( this )->getArea( TilePos( 0, 0 ), Size( _d->size ) );
  foreach( it, tiles )
  {
    Tile* tile = *it;
    bitsetInfo.push_back( TileHelper::encode( *tile ) ); //pack to base64 before saving
    desInfo.push_back( tile->desirability() );  //and here
    idInfo.push_back( tile->originalImgId() ); //and here
  }

  stream[ "bitset" ]       = bitsetInfo;
  stream[ "desirability" ] = desInfo;
  stream[ "imgId" ]        = idInfo;
  stream[ "size" ]         = _d->size;
}

Comments (1)

  1. Log in to comment