[world generation] Fixed missing lakes and islands

This commit is contained in:
Alex Zolotarev 2011-02-12 01:49:40 +01:00 committed by Alex Zolotarev
parent f2617f2dfa
commit 53653a77cc
2 changed files with 14 additions and 9 deletions

View file

@ -27,9 +27,5 @@ void FeatureBuilder1Merger::AppendFeature(FeatureBuilder1Merger const & fb)
// merge fb at the end
size_t const size = fb.m_Geometry.size();
for (size_t i = 1; i < size; ++i)
{
m_Geometry.push_back(fb.m_Geometry[i]);
m_LimitRect.Add(fb.m_Geometry[i]);
}
//LOG(LINFO, ("Appended feature", m_Geometry.size()));
AddPoint(fb.m_Geometry[i]);
}

View file

@ -43,19 +43,22 @@ private:
/// @return true if one feature was merged
bool ReMergeFeatures(FeaturesContainerT & features)
{
//bool merged = false;
for (FeaturesContainerT::iterator base = features.begin(); base != features.end(); ++base)
{
FeaturesContainerT::iterator found = features.find(base->second.LastPoint());
if (found != features.end())
{
CHECK(found != base, ());
base->second.AppendFeature(found->second);
features.erase(found);
if (base->second.FirstPoint() == base->second.LastPoint())
{ // @TODO create area feature
(*m_worldBucket)(base->second);
features.erase(base);
}
return true;
//merged = true;
}
}
//return merged;
return false;
}
@ -70,13 +73,19 @@ private:
container.erase(found);
}
if (fbm.FirstPoint() == fbm.LastPoint())
{
// @TODO create area feature
(*m_worldBucket)(fbm);
return;
}
pair<FeaturesContainerT::iterator, bool> result = container.insert(make_pair(fbm.FirstPoint(), fbm));
// if we found feature with the same starting point, emit it directly
if (!result.second)
{
LOG(LWARNING, ("Found features with common first point, points counts are:",
result.first->second.GetPointsCount(), fb.GetPointsCount()));
(*m_worldBucket)(fb);
(*m_worldBucket)(fbm);
}
}