Fixed: map landmark bug (issue #15)

This commit is contained in:
Nimetu 2013-09-23 17:34:01 +03:00
parent bb7297f260
commit 75d784c656

View file

@ -811,18 +811,19 @@ void CGroupCompasMenu::setActive (bool state)
uint nbUserLandMarks = std::min( uint(currCont->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks() ); uint nbUserLandMarks = std::min( uint(currCont->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks() );
// Sort the landmarks // Sort the landmarks
std::sort(currCont->UserLandMarks.begin(), currCont->UserLandMarks.end(), UserLandMarksSortPredicate); std::vector<CUserLandMark> sortedLandmarks(currCont->UserLandMarks);
std::sort(sortedLandmarks.begin(), sortedLandmarks.end(), UserLandMarksSortPredicate);
for(k = 0; k < nbUserLandMarks; ++k) for(k = 0; k < nbUserLandMarks; ++k)
{ {
if (currCont->UserLandMarks[k].Type < CUserLandMark::UserLandMarkTypeCount) if (sortedLandmarks[k].Type < CUserLandMark::UserLandMarkTypeCount)
{ {
CCompassTarget ct; CCompassTarget ct;
ct.setType(CCompassTarget::UserLandMark); ct.setType(CCompassTarget::UserLandMark);
ct.Pos = currCont->UserLandMarks[k].Pos; ct.Pos = sortedLandmarks[k].Pos;
ct.Name = currCont->UserLandMarks[k].Title; ct.Name = sortedLandmarks[k].Title;
Targets.push_back(ct); Targets.push_back(ct);
landMarkSubMenus[currCont->UserLandMarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }