#include "quicktune.h"
#include "serverlist.h"
#include "guiEngine.h"
+#include "mapsector.h"
-#ifdef USE_LEVELDB
#include "database-sqlite3.h"
+#ifdef USE_LEVELDB
#include "database-leveldb.h"
#endif
_("Set logfile path ('' = no logging)"))));
allowed_options.insert(std::make_pair("gameid", ValueSpec(VALUETYPE_STRING,
_("Set gameid (\"--gameid list\" prints available ones)"))));
- #if USE_LEVELDB
- allowed_options.insert("migrate", ValueSpec(VALUETYPE_STRING,
- _("Migrate from current map backend to another")));
- #endif
+ allowed_options.insert(std::make_pair("migrate", ValueSpec(VALUETYPE_STRING,
+ _("Migrate from current map backend to another (Only works when using minetestserver or with --server)"))));
#ifndef SERVER
allowed_options.insert(std::make_pair("videomodes", ValueSpec(VALUETYPE_FLAG,
_("Show available video modes"))));
// Create server
Server server(world_path, gamespec, false);
- #if USE_LEVELDB
// Database migration
if (cmd_args.exists("migrate")) {
std::string migrate_to = cmd_args.get("migrate");
}
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
else {
errorstream << "Migration to " << migrate_to << " is not supported" << std::endl;
return 1;
}
- core::list<v3s16> blocks;
+ std::list<v3s16> blocks;
ServerMap &old_map = ((ServerMap&)server.getMap());
old_map.listAllLoadableBlocks(blocks);
int count = 0;
new_db->beginSave();
- for (core::list<v3s16>::Iterator i = blocks.begin(); i != blocks.end(); ++i) {
+ 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));
new_db->endSave();
actionstream << "Successfully migrated " << count << " blocks" << std::endl;
- actionstream << "Don't forget to update your world.mt backend setting!" << 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;
}
- #endif
server.start(port);
gui::IGUISkin* skin = guienv->getSkin();
std::string font_path = g_settings->get("font_path");
gui::IGUIFont *font;
- bool use_freetype = g_settings->getBool("freetype");
#if USE_FREETYPE
+ bool use_freetype = g_settings->getBool("freetype");
if (use_freetype) {
std::string fallback;
if (is_yes(gettext("needs_fallback_font")))
g_settings->set("port", itos(port));
if((menudata.selected_world >= 0) &&
- (menudata.selected_world < worldspecs.size()))
+ (menudata.selected_world < (int)worldspecs.size()))
g_settings->set("selected_world_path",
worldspecs[menudata.selected_world].path);
// Set world path to selected one
if ((menudata.selected_world >= 0) &&
- (menudata.selected_world < worldspecs.size())) {
+ (menudata.selected_world < (int)worldspecs.size())) {
worldspec = worldspecs[menudata.selected_world];
infostream<<"Selected world: "<<worldspec.name
<<" ["<<worldspec.path<<"]"<<std::endl;