From e80992fc47938439914e68bc3d05f327a03c5ac3 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 10 Feb 2025 22:10:36 +0000 Subject: [PATCH] Codefix: Change method to take const pointer instead of using const_cast. (#13525) --- src/network/network_content.cpp | 4 ++-- src/network/network_content.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 1191ef22a3..dfb2bf6aca 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -173,7 +173,7 @@ bool ClientNetworkContentSocketHandler::Receive_SERVER_INFO(Packet &p) ConstContentVector parents; this->ReverseLookupTreeDependency(parents, ci); for (const ContentInfo *ici : parents) { - this->CheckDependencyState(const_cast(ici)); + this->CheckDependencyState(ici); } this->OnReceiveContentInfo(ci); @@ -973,7 +973,7 @@ void ClientNetworkContentSocketHandler::ReverseLookupTreeDependency(ConstContent * Check the dependencies (recursively) of this content info * @param ci the content info to check the dependencies of */ -void ClientNetworkContentSocketHandler::CheckDependencyState(ContentInfo *ci) +void ClientNetworkContentSocketHandler::CheckDependencyState(const ContentInfo *ci) { if (ci->IsSelected() || ci->state == ContentInfo::ALREADY_HERE) { /* Selection is easy; just walk all children and set the diff --git a/src/network/network_content.h b/src/network/network_content.h index bf62108edf..2a693cc5f1 100644 --- a/src/network/network_content.h +++ b/src/network/network_content.h @@ -130,7 +130,7 @@ public: void ReverseLookupDependency(ConstContentVector &parents, const ContentInfo *child) const; void ReverseLookupTreeDependency(ConstContentVector &tree, const ContentInfo *child) const; - void CheckDependencyState(ContentInfo *ci); + void CheckDependencyState(const ContentInfo *ci); /** Get the number of content items we know locally. */ uint Length() const { return (uint)this->infos.size(); }