More ini settings save their defaults
git-svn-id: http://mc-server.googlecode.com/svn/trunk@588 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
8233a425fb
commit
47b675e47c
@ -257,7 +257,7 @@ void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
|||||||
BlockType = "stone";
|
BlockType = "stone";
|
||||||
}
|
}
|
||||||
int Block = GetIniBlock(a_IniFile, "[Generator]", "SameBlockType", "stone");
|
int Block = GetIniBlock(a_IniFile, "[Generator]", "SameBlockType", "stone");
|
||||||
bool Bedrocked = (a_IniFile.GetValueI("Generator", "SameBlockBedrocked", 1) != 0);
|
bool Bedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0);
|
||||||
m_CompositionGen = new cCompoGenSameBlock((BLOCKTYPE)Block, Bedrocked);
|
m_CompositionGen = new cCompoGenSameBlock((BLOCKTYPE)Block, Bedrocked);
|
||||||
}
|
}
|
||||||
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
||||||
@ -266,9 +266,9 @@ void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
|||||||
}
|
}
|
||||||
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
||||||
{
|
{
|
||||||
int SeaLevel = a_IniFile.GetValueI("Generator", "ClassicSeaLevel", 60);
|
int SeaLevel = a_IniFile.GetValueSetI("Generator", "ClassicSeaLevel", 60);
|
||||||
int BeachHeight = a_IniFile.GetValueI("Generator", "ClassicBeachHeight", 2);
|
int BeachHeight = a_IniFile.GetValueSetI("Generator", "ClassicBeachHeight", 2);
|
||||||
int BeachDepth = a_IniFile.GetValueI("Generator", "ClassicBeachDepth", 4);
|
int BeachDepth = a_IniFile.GetValueSetI("Generator", "ClassicBeachDepth", 4);
|
||||||
BLOCKTYPE BlockTop = GetIniBlock(a_IniFile, "Generator", "ClassicBlockTop", "grass");
|
BLOCKTYPE BlockTop = GetIniBlock(a_IniFile, "Generator", "ClassicBlockTop", "grass");
|
||||||
BLOCKTYPE BlockMiddle = GetIniBlock(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt");
|
BLOCKTYPE BlockMiddle = GetIniBlock(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt");
|
||||||
BLOCKTYPE BlockBottom = GetIniBlock(a_IniFile, "Generator", "ClassicBlockBottom", "stone");
|
BLOCKTYPE BlockBottom = GetIniBlock(a_IniFile, "Generator", "ClassicBlockBottom", "stone");
|
||||||
|
@ -103,13 +103,15 @@ void cRoot::Start()
|
|||||||
m_Server = new cServer();
|
m_Server = new cServer();
|
||||||
|
|
||||||
LOG("Starting server...");
|
LOG("Starting server...");
|
||||||
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
|
cIniFile IniFile("settings.ini");
|
||||||
int Port = IniFile.GetValueI("Server", "Port", 25565 );
|
IniFile.ReadFile();
|
||||||
|
int Port = IniFile.GetValueSetI("Server", "Port", 25565 );
|
||||||
if(!m_Server->InitServer( Port ))
|
if(!m_Server->InitServer( Port ))
|
||||||
{
|
{
|
||||||
LOG("Failed to start server, shutting down.");
|
LOG("Failed to start server, shutting down.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
IniFile.WriteFile();
|
||||||
|
|
||||||
cIniFile WebIniFile("webadmin.ini");
|
cIniFile WebIniFile("webadmin.ini");
|
||||||
if( WebIniFile.ReadFile() )
|
if( WebIniFile.ReadFile() )
|
||||||
@ -210,7 +212,7 @@ void cRoot::LoadWorlds(void)
|
|||||||
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
|
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
|
||||||
|
|
||||||
// First get the default world
|
// First get the default world
|
||||||
AString DefaultWorldName = IniFile.GetValue("Worlds", "DefaultWorld", "world");
|
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
|
||||||
m_pState->pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
|
m_pState->pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
|
||||||
m_pState->WorldsByName[ DefaultWorldName ] = m_pState->pDefaultWorld;
|
m_pState->WorldsByName[ DefaultWorldName ] = m_pState->pDefaultWorld;
|
||||||
|
|
||||||
@ -224,12 +226,12 @@ void cRoot::LoadWorlds(void)
|
|||||||
|
|
||||||
for (unsigned int i = 0; i < NumWorlds; i++)
|
for (unsigned int i = 0; i < NumWorlds; i++)
|
||||||
{
|
{
|
||||||
std::string ValueName = IniFile.GetValueName(KeyNum, i );
|
AString ValueName = IniFile.GetValueName(KeyNum, i );
|
||||||
if (ValueName.compare("World") != 0)
|
if (ValueName.compare("World") != 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string WorldName = IniFile.GetValue(KeyNum, i );
|
AString WorldName = IniFile.GetValue(KeyNum, i );
|
||||||
if (WorldName.empty())
|
if (WorldName.empty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -229,12 +229,7 @@ bool cServer::InitServer( int a_Port )
|
|||||||
m_pState->ServerID = ServerID;
|
m_pState->ServerID = ServerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ClientViewDistance = IniFile.GetValueI("Server", "DefaultViewDistance", -1);
|
m_ClientViewDistance = IniFile.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE);
|
||||||
if (m_ClientViewDistance == -1)
|
|
||||||
{
|
|
||||||
m_ClientViewDistance = cClientHandle::DEFAULT_VIEW_DISTANCE;
|
|
||||||
LOG("[Server].DefaultViewDistance not set, using a default of %d", m_ClientViewDistance);
|
|
||||||
}
|
|
||||||
if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE)
|
if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE)
|
||||||
{
|
{
|
||||||
m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE;
|
m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE;
|
||||||
@ -245,6 +240,7 @@ bool cServer::InitServer( int a_Port )
|
|||||||
m_ClientViewDistance = cClientHandle::MAX_VIEW_DISTANCE;
|
m_ClientViewDistance = cClientHandle::MAX_VIEW_DISTANCE;
|
||||||
LOGINFO("Setting default viewdistance to the maximum of %d", m_ClientViewDistance);
|
LOGINFO("Setting default viewdistance to the maximum of %d", m_ClientViewDistance);
|
||||||
}
|
}
|
||||||
|
IniFile.WriteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NotifyWriteThread.Start(this);
|
m_NotifyWriteThread.Start(this);
|
||||||
|
@ -243,10 +243,10 @@ cWorld::cWorld( const AString & a_WorldName )
|
|||||||
AString StorageSchema("Default");
|
AString StorageSchema("Default");
|
||||||
|
|
||||||
cIniFile IniFile(m_IniFileName);
|
cIniFile IniFile(m_IniFileName);
|
||||||
m_SpawnX = IniFile.GetValueF ("SpawnPosition", "X", m_SpawnX);
|
m_SpawnX = IniFile.GetValueSetF("SpawnPosition", "X", m_SpawnX);
|
||||||
m_SpawnY = IniFile.GetValueF ("SpawnPosition", "Y", m_SpawnY);
|
m_SpawnY = IniFile.GetValueSetF("SpawnPosition", "Y", m_SpawnY);
|
||||||
m_SpawnZ = IniFile.GetValueF ("SpawnPosition", "Z", m_SpawnZ);
|
m_SpawnZ = IniFile.GetValueSetF("SpawnPosition", "Z", m_SpawnZ);
|
||||||
StorageSchema = IniFile.GetValue ("Storage", "Schema", StorageSchema);
|
StorageSchema = IniFile.GetValueSet ("Storage", "Schema", StorageSchema);
|
||||||
m_MaxCactusHeight = IniFile.GetValueSetI("Plants", "MaxCactusHeight", 3);
|
m_MaxCactusHeight = IniFile.GetValueSetI("Plants", "MaxCactusHeight", 3);
|
||||||
m_MaxSugarcaneHeight = IniFile.GetValueSetI("Plants", "MaxSugarcaneHeight", 3);
|
m_MaxSugarcaneHeight = IniFile.GetValueSetI("Plants", "MaxSugarcaneHeight", 3);
|
||||||
m_IsCropsBonemealable = IniFile.GetValueSetB("Plants", "IsCropsBonemealable", true);
|
m_IsCropsBonemealable = IniFile.GetValueSetB("Plants", "IsCropsBonemealable", true);
|
||||||
@ -259,7 +259,7 @@ cWorld::cWorld( const AString & a_WorldName )
|
|||||||
m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false);
|
m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false);
|
||||||
m_IsCactusBonemealable = IniFile.GetValueSetB("Plants", "IsCactusBonemealable", false);
|
m_IsCactusBonemealable = IniFile.GetValueSetB("Plants", "IsCactusBonemealable", false);
|
||||||
|
|
||||||
m_GameMode = (eGameMode)IniFile.GetValueI("GameMode", "GameMode", m_GameMode );
|
m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode );
|
||||||
|
|
||||||
if (!IniFile.WriteFile())
|
if (!IniFile.WriteFile())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user