# UNDF: UNDF-2026-000000935 --- a/src/overmap_ui.cpp +++ b/src/overmap_ui.cpp @@ -1,5 +1,6 @@ // ... (includes) #include +#include // In overmap_ui::search() // BEFORE (CWE-407): overmap_checked is std::vector with std::find for dedup @@ -7,7 +8,7 @@ // radius = OMAPX * 5 = 900, iterating ~3.24M points // Each std::find is O(M) where M = overmaps already checked // Total: O(P * M) where P = points in radius, M = distinct overmaps - std::vector overmap_checked; + std::unordered_set overmap_checked; const int radius = OMAPX * 5; // arbitrary for( const tripoint_abs_omt &p : points_in_radius( curs, radius ) ) { @@ -16,9 +17,8 @@ tripoint_om_omt om_relative = om_loc.local; point_abs_om om_cache = project_to( p.xy() ); - if( std::find( overmap_checked.begin(), overmap_checked.end(), - om_cache ) == overmap_checked.end() ) { - overmap_checked.push_back( om_cache ); + if( overmap_checked.find( om_cache ) == overmap_checked.end() ) { + overmap_checked.insert( om_cache ); std::vector notes = om_loc.om->find_notes( curs.z(), term ); locations.insert( locations.end(), notes.begin(), notes.end() ); }