Hi,
I'm trying to modify the "Assign Trade Route" dialog in Colonization.
Colonization generates a list of lines of text that I want to sort alphabetically.
The data I'm interested in is in
and filled in CvDLLButtonPopup.cpp (line 2538)
in the sub
(snip)
Is there a way (inserting new code after that block) to sort aTradeRoutes alphabetically by the second "member"?
CvString.h doesn't contain any reference to any sorting function.
I have some experience in Python programming, but not in C++.
Thanks
JFG
I'm trying to modify the "Assign Trade Route" dialog in Colonization.
Colonization generates a list of lines of text that I want to sort alphabetically.
The data I'm interested in is in
Code:
std::vector< std::pair<int, CvWString> > aTradeRoutes;
and filled in CvDLLButtonPopup.cpp (line 2538)
in the sub
Code:
bool CvDLLButtonPopup::launchTradeRoutesPopup(CvPopup* pPopup, CvPopupInfo &info)
(snip)
Code:
std::vector< std::pair<int, CvWString> > aTradeRoutes;
std::vector<CvTradeRoute*> aiRoutes;
kPlayer.getTradeRoutes(aiRoutes);
for (uint i = 0; i < aiRoutes.size(); ++i)
{
CvTradeRoute* pTradeRoute = aiRoutes[i];
if (pGroup->canAssignTradeRoute(pTradeRoute->getID(), i != 0))
{
CvWString szText = gDLL->getText("TXT_KEY_TRADE_ROUTE_DESCRIPTION", GC.getYieldInfo(pTradeRoute->getYield()).getTextKeyWide(), pTradeRoute->getSourceCityNameKey(), pTradeRoute->getDestinationCityNameKey());
aTradeRoutes.push_back(std::make_pair(pTradeRoute->getID(), szText));
}
}
Is there a way (inserting new code after that block) to sort aTradeRoutes alphabetically by the second "member"?
CvString.h doesn't contain any reference to any sorting function.
I have some experience in Python programming, but not in C++.
Thanks
JFG