本文整理汇总了C++中MapSector::deleteBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ MapSector::deleteBlock方法的具体用法?C++ MapSector::deleteBlock怎么用?C++ MapSector::deleteBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapSector
的用法示例。
在下文中一共展示了MapSector::deleteBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
<< std::endl << " backend = {sqlite3|leveldb|redis|dummy}" << std::endl;
return 1;
}
std::string backend = world_mt.get("backend");
Database *new_db;
if (backend == migrate_to) {
errorstream << "Cannot migrate: new backend is same as the old one" << std::endl;
return 1;
}
if (migrate_to == "sqlite3")
new_db = new Database_SQLite3(&(ServerMap&)server.getMap(), world_path);
#if USE_LEVELDB
else if (migrate_to == "leveldb")
new_db = new Database_LevelDB(&(ServerMap&)server.getMap(), world_path);
#endif
#if USE_REDIS
else if (migrate_to == "redis")
new_db = new Database_Redis(&(ServerMap&)server.getMap(), world_path);
#endif
else {
errorstream << "Migration to " << migrate_to << " is not supported" << std::endl;
return 1;
}
std::list<v3s16> blocks;
ServerMap &old_map = ((ServerMap&)server.getMap());
old_map.listAllLoadableBlocks(blocks);
int count = 0;
new_db->beginSave();
for (std::list<v3s16>::iterator i = blocks.begin(); i != blocks.end(); ++i) {
MapBlock *block = old_map.loadBlock(*i);
new_db->saveBlock(block);
MapSector *sector = old_map.getSectorNoGenerate(v2s16(i->X, i->Z));
sector->deleteBlock(block);
++count;
if (count % 500 == 0)
actionstream << "Migrated " << count << " blocks "
<< (100.0 * count / blocks.size()) << "% completed" << std::endl;
}
new_db->endSave();
delete new_db;
actionstream << "Successfully migrated " << count << " blocks" << std::endl;
world_mt.set("backend", migrate_to);
if(!world_mt.updateConfigFile((world_path + DIR_DELIM + "world.mt").c_str()))
errorstream<<"Failed to update world.mt!"<<std::endl;
else
actionstream<<"world.mt updated"<<std::endl;
return 0;
}
server.start(bind_addr);
// Run server
dedicated_server_loop(server, kill);
return 0;
}
#ifndef SERVER // Exclude from dedicated server build
/*
More parameters
*/