summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-10 14:05:44 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-10 14:05:44 +0200
commitd478e3cfb19c0347ba0b5513d3250af9d69443de (patch)
treeaaba81bda1ee2e53e5e4d9fdad0c2998ba8edb0f /src/World.cpp
parentMaybe coverage working? (diff)
parentMerge pull request #992 from mc-server/coverity_fixes (diff)
downloadcuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar.gz
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar.bz2
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar.lz
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar.xz
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.tar.zst
cuberite-d478e3cfb19c0347ba0b5513d3250af9d69443de.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 5ac8e0a6e..807065bfa 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -394,10 +394,14 @@ void cWorld::InitializeSpawn(void)
// For the debugging builds, don't make the server build too much world upon start:
#if defined(_DEBUG) || defined(ANDROID_NDK)
- int ViewDist = 9;
+ const int DefaultViewDist = 9;
#else
- int ViewDist = 20; // Always prepare an area 20 chunks across, no matter what the actual cClientHandle::VIEWDISTANCE is
+ const int DefaultViewDist = 20; // Always prepare an area 20 chunks across, no matter what the actual cClientHandle::VIEWDISTANCE is
#endif // _DEBUG
+ cIniFile IniFile;
+ IniFile.ReadFile(m_IniFileName);
+ int ViewDist = IniFile.GetValueSetI("SpawnPosition", "PregenerateDistance", DefaultViewDist);
+ IniFile.WriteFile(m_IniFileName);
LOG("Preparing spawn area in world \"%s\"...", m_WorldName.c_str());
for (int x = 0; x < ViewDist; x++)
@@ -2402,13 +2406,13 @@ bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_
bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback)
{
cPlayer * BestMatch = NULL;
- unsigned int BestRating = 0;
- unsigned int NameLength = a_PlayerNameHint.length();
+ size_t BestRating = 0;
+ size_t NameLength = a_PlayerNameHint.length();
cCSLock Lock(m_CSPlayers);
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- unsigned int Rating = RateCompareString (a_PlayerNameHint, (*itr)->GetName());
+ size_t Rating = RateCompareString (a_PlayerNameHint, (*itr)->GetName());
if (Rating >= BestRating)
{
BestMatch = *itr;
@@ -2422,7 +2426,6 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCa
if (BestMatch != NULL)
{
- LOG("Compared %s and %s with rating %i", a_PlayerNameHint.c_str(), BestMatch->GetName().c_str(), BestRating);
return a_Callback.Item (BestMatch);
}
return false;