Fix code messages

This commit is contained in:
Stefan Müller 2025-04-30 20:45:09 +02:00
parent 01c300dce1
commit 1c860f7e4c
6 changed files with 14 additions and 14 deletions

View File

@ -39,7 +39,7 @@ class ReindeerMaze
void initializeWorkList(std::list<ReindeerMazeCrossing>& crossings, const int entryVertex); void initializeWorkList(std::list<ReindeerMazeCrossing>& crossings, const int entryVertex);
void addCheckedIncidence(std::vector<ReindeerMazePathIncidence>& incidences, const Point2 start, void addCheckedIncidence(std::vector<ReindeerMazePathIncidence>& incidences, const Point2 start,
const Point2 direction); const Point2 direction);
Point2 findStart(); Point2 findStart() const;
void AddPathSegmentEdges(WeightedEdgeGraph& graph, const ReindeerMazePathIncidence& pathIncidence, void AddPathSegmentEdges(WeightedEdgeGraph& graph, const ReindeerMazePathIncidence& pathIncidence,
const std::vector<ReindeerMazePathIncidence>& otherPathIncidences); const std::vector<ReindeerMazePathIncidence>& otherPathIncidences);
}; };

View File

@ -19,13 +19,13 @@ class MullData
{ {
public: public:
MullData(); MullData();
bool getIsEnabled(); bool getIsEnabled() const;
void setIsEnabled(const bool value); void setIsEnabled(const bool value);
int getFactor(const int index); int getFactor(const int index) const;
void setFactor(const int index, const int value); void setFactor(const int index, const int value);
void updateResult(); void updateResult();
long long int getResultPart1(); long long int getResultPart1() const;
long long int getResultPart2(); long long int getResultPart2() const;
private: private:
bool isEnabled_; bool isEnabled_;
int factor1_; int factor1_;

View File

@ -55,11 +55,11 @@ void HoofIt::finish()
while (!queue.empty()) while (!queue.empty())
{ {
auto trail = queue.front(); const auto& trail = queue.front();
queue.pop(); queue.pop();
if (getCharAt(trail) != getTrailheadChar()) if (getCharAt(trail) != getTrailheadChar())
{ {
for (auto direction : Point2::cardinalDirections) for (const auto& direction : Point2::cardinalDirections)
{ {
Point2 p{ trail + direction }; Point2 p{ trail + direction };
if (isInBounds(p) && getCharAt(p) + 1 == getCharAt(trail)) if (isInBounds(p) && getCharAt(p) + 1 == getCharAt(trail))
@ -93,7 +93,7 @@ constexpr char HoofIt::getTrailTopChar()
void HoofIt::addUnique(const std::vector<Point2>& source, std::vector<Point2>& destination) void HoofIt::addUnique(const std::vector<Point2>& source, std::vector<Point2>& destination)
{ {
for (auto end : source) for (const auto& end : source)
{ {
auto isUnique{ true }; auto isUnique{ true };
size_t i{ 0 }; size_t i{ 0 };

View File

@ -224,7 +224,7 @@ void ReindeerMaze::addCheckedIncidence(std::vector<ReindeerMazePathIncidence>& i
} }
} }
Point2 ReindeerMaze::findStart() Point2 ReindeerMaze::findStart() const
{ {
for (int j = 0; j < lines.size(); j++) for (int j = 0; j < lines.size(); j++)
{ {

View File

@ -20,7 +20,7 @@ MullData::MullData()
{ {
}; };
bool MullData::getIsEnabled() bool MullData::getIsEnabled() const
{ {
return isEnabled_; return isEnabled_;
} }
@ -30,7 +30,7 @@ void MullData::setIsEnabled(const bool value)
isEnabled_ = value; isEnabled_ = value;
} }
int MullData::getFactor(const int index) int MullData::getFactor(const int index) const
{ {
return index == 1 ? factor1_ : factor2_; return index == 1 ? factor1_ : factor2_;
} }
@ -57,12 +57,12 @@ void MullData::updateResult()
} }
} }
long long int MullData::getResultPart1() long long int MullData::getResultPart1() const
{ {
return part1_; return part1_;
} }
long long int MullData::getResultPart2() long long int MullData::getResultPart2() const
{ {
return part2_; return part2_;
} }

View File

@ -46,7 +46,7 @@ void SolverEngine::run(Solver& solver)
std::filesystem::path SolverEngine::tryGetValidFullInputFilePath(const std::string& inputFileName) std::filesystem::path SolverEngine::tryGetValidFullInputFilePath(const std::string& inputFileName)
{ {
for (auto path : inputPaths_) for (const auto& path : inputPaths_)
{ {
std::filesystem::path fullFilePath = path; std::filesystem::path fullFilePath = path;
fullFilePath /= inputFileName; fullFilePath /= inputFileName;