From a239c9dddee401f1e135931c7f7c693ada610adb Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 4 Nov 2022 00:12:10 +0200 Subject: [PATCH] Use rstl::find Former-commit-id: 6c4971ec76a7f25c10fb8f607333a01ba4c954f4 --- include/rstl/reserved_vector.hpp | 7 ------- src/MetroidPrime/ScriptObjects/CScriptPlayerHint.cpp | 6 ++++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index d0be68eb..ed733ce6 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -81,13 +81,6 @@ public: --x0_count; } } - - iterator find(const T& value) { - rstl::reserved_vector< TUniqueId, 8 >::iterator it = begin(); - for (; it != end() && *it != value; ++it) { - } - return it; - } }; } // namespace rstl diff --git a/src/MetroidPrime/ScriptObjects/CScriptPlayerHint.cpp b/src/MetroidPrime/ScriptObjects/CScriptPlayerHint.cpp index 733d3ac7..399e0010 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPlayerHint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPlayerHint.cpp @@ -5,6 +5,8 @@ #include "MetroidPrime/Enemies/CMetroidPrimeRelay.hpp" #include "MetroidPrime/Player/CPlayer.hpp" +#include "rstl/algorithm.hpp" + CScriptPlayerHint::CScriptPlayerHint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf, bool active, int priority, int overrideFlags) @@ -18,7 +20,7 @@ CScriptPlayerHint::CScriptPlayerHint(TUniqueId uid, const rstl::string& name, void CScriptPlayerHint::ClearObjectList() { xe8_objectList.clear(); } void CScriptPlayerHint::AddToObjectList(TUniqueId uid) { - rstl::reserved_vector< TUniqueId, 8 >::iterator it = xe8_objectList.find(uid); + rstl::reserved_vector< TUniqueId, 8 >::iterator it = rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid); if (it != xe8_objectList.end()) { return; } @@ -30,7 +32,7 @@ void CScriptPlayerHint::RemoveFromObjectList(TUniqueId uid, CStateManager& mgr) return; } - rstl::reserved_vector< TUniqueId, 8 >::iterator it = xe8_objectList.find(uid); + rstl::reserved_vector< TUniqueId, 8 >::iterator it = rstl::find(xe8_objectList.begin(), xe8_objectList.end(), uid); if (it == xe8_objectList.end()) { xe8_objectList.erase(xe8_objectList.begin());