world.mt creation
authorPerttu Ahola <celeron55@gmail.com>
Sun, 11 Mar 2012 13:04:50 +0000 (15:04 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 11 Mar 2012 13:04:50 +0000 (15:04 +0200)
src/server.cpp

index 7b34e3554b1bfb1b1ed259b63885806a45566b03..f68672456feae0a66ad21764b6e823f2c8ef08ff 100644 (file)
@@ -867,7 +867,7 @@ Server::Server(
 
        if(!gamespec.isValid())
                throw ServerError("Supplied invalid gamespec");
-
+       
        // Figure out some paths
        // share/server
        m_path_share = porting::path_share + DIR_DELIM + "server";
@@ -899,6 +899,15 @@ Server::Server(
                infostream<<"- mods:   "<<modspath<<std::endl;
        }
        
+       // Create world.mt if does not already exist
+       std::string worldmt_path = m_path_world + DIR_DELIM + "world.mt";
+       if(!fs::PathExists(worldmt_path)){
+               infostream<<"Creating world.mt ("<<worldmt_path<<")"<<std::endl;
+               fs::CreateAllDirs(m_path_world);
+               std::ofstream of(worldmt_path.c_str(), std::ios::binary);
+               of<<"gameid = "<<m_gamespec.id<<"\n";
+       }
+
        // Lock environment
        JMutexAutoLock envlock(m_env_mutex);
        JMutexAutoLock conlock(m_con_mutex);