Exemple #1
0
void MapIndex::saveChanged()
{

  // First recalculated UIDs.
  //  for( int j = 0; j < 64; ++j )
  //  {
  //    for( int i = 0; i < 64; ++i )
  //    {
  //      if( tileLoaded( j, i ) )
  //      {
  //        if(this->getChanged(j,i) == 1)
  //        {
  //          mTiles[j][i].tile->uidTile();
  //        }
  //      }
  //    }
  //  }

  if(changed)
    save();

  // Now save all marked as 1 and 2 because UIDs now fits.
  for( int j = 0; j < 64; ++j )
  {
    for( int i = 0; i < 64; ++i )
    {
      if(!tileLoaded(j, i)) continue;
      if(!getChanged(j,i)) continue;

      mTiles[j][i].tile->saveTile();
      unsetChanged(j,i);
    }
  }

  std::map<int, WMOInstance> wmoTemp(gWorld->mWMOInstances);
  gWorld->mWMOInstances.clear();

  for(std::map<int, WMOInstance>::iterator it = wmoTemp.begin(); it != wmoTemp.end(); ++it)
  {
    gWorld->mWMOInstances[it->second.mUniqueID] = it->second;
    it->second.unlockUID();
  }

  std::map<int, ModelInstance> modelTemp(gWorld->mModelInstances);
  gWorld->mModelInstances.clear();

  for( std::map<int, ModelInstance>::iterator it = modelTemp.begin(); it != modelTemp.end(); ++it )
  {
    gWorld->mModelInstances[it->second.d1] = it->second;
    it->second.unlockUID();
  }
}
Exemple #2
0
Problem::iterator Plannable::getProblems() const
{
  if (getChanged())
    const_cast<Plannable*>(this)->updateProblems();
  return Problem::iterator(firstProblem);
}