HeightMapInterface* AbstractHeightMapManager::getHeightMapOfTile(Tile* tile) {
	if (tileMap.find(tile->getId()) != tileMap.end()) {
		return tileMap[tile->getId()]; //cache hit
	}

	//load and save
	std::string fileName = generateFileName(tile);
	HeightMapInterface* h = loadImpl(fileName);
	if(h) {
		PRINTD(INFO, "found saved heightmap at %s\n",fileName.c_str());
	} else {
		PRINTD(INFO, "creating heightmap for tile %s\n",tile->getName().c_str());
		h = createImpl(tile);
		if(h) { //save to disk
			if(!saveImpl(h, fileName))
				PRINTD(WARNING, "can't save heightmap of tile %s to %s\n",tile->getName().c_str(), fileName.c_str());
		}
	}

	if(h) { //save in cache -> TODO what about locks?
		tileMap[tile->getId()] = h;
		return h;
	} else {
		PRINTD(WARNING, "can't neighter load or create heightmap for tile %s\n",tile->getName().c_str());
		return NULL;
	}
}
TorrentPersistentData::TorrentPersistentData()
  : all_data(QIniSettings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume")).value("torrents").toHash())
  , dirty(false)
{
  connect(&timer, SIGNAL(timeout()), SLOT(saveImpl()));
  m_instance = this;
}
Example #3
0
void SettingsWidget::save()
{
//		if(!isModified())
//			return;
	p->sleep = true;
	saveImpl();
	p->clearValues();
	p->sleep = false;
	emit saved();
}
Example #4
0
void SettingsWidget::save()
{
	if(!isModified())
		return;
	p->sleep = true;
	saveImpl();
	p->clearValues();
	p->sleep = false;
	emit saved();
	emit modifiedChanged(false);
}
void DataSettingsObject::save(const DataItem &item)
{
    saveImpl(item);
}
void TorrentPersistentData::save() {
  if (dirty)
    saveImpl();
}
Example #7
0
void Alert::save(void)
{
  t_.ensureIsActive();
  saveImpl(t_);
}