Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pointer with id if used as map key #9867

Merged
merged 2 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions CvGameCoreDLL_Expansion2/CvAStar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2841,14 +2841,14 @@ ReachablePlots CvPathFinder::GetPlotsInReach(const CvPlot * pStartPlot, const SP
return GetPlotsInReach(pStartPlot->getX(),pStartPlot->getY(),data);
}

map<CvPlot*,SPath> CvPathFinder::GetMultiplePaths(const CvPlot* pStartPlot, vector<CvPlot*> vDestPlots, const SPathFinderUserData& data)
map<int,SPath> CvPathFinder::GetMultiplePaths(const CvPlot* pStartPlot, vector<CvPlot*> vDestPlots, const SPathFinderUserData& data)
{
//make sure we don't call this from dll and lua at the same time
bool bHadLock = gDLL->HasGameCoreLock();
if(!bHadLock)
gDLL->GetGameCoreLock();

map<CvPlot*,SPath> result;
map<int,SPath> result;

if (!Configure(data) || !pStartPlot)
{
Expand Down Expand Up @@ -2909,7 +2909,8 @@ map<CvPlot*,SPath> CvPathFinder::GetMultiplePaths(const CvPlot* pStartPlot, vect
std::reverse(path.vPlots.begin(),path.vPlots.end());

//store it
result[ *bounds.first ] = path;

result[ (*bounds.first)->GetPlotIndex() ] = path;
}

//don't need to check this again
Expand Down
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvAStar.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class CvPathFinder : public CvAStar
virtual int GetPathLengthInTurns(const CvPlot* pStartPlot, const CvPlot* pEndPlot, const SPathFinderUserData& data);
virtual ReachablePlots GetPlotsInReach(int iXstart, int iYstart, const SPathFinderUserData& data);
virtual ReachablePlots GetPlotsInReach(const CvPlot* pStartPlot, const SPathFinderUserData& data);
virtual map<CvPlot*,SPath> GetMultiplePaths(const CvPlot* pStartPlot, vector<CvPlot*> vDestPlots, const SPathFinderUserData& data);
virtual map<int,SPath> GetMultiplePaths(const CvPlot* pStartPlot, vector<CvPlot*> vDestPlots, const SPathFinderUserData& data);
virtual bool DestinationReached(int iToX, int iToY) const;
};

Expand Down