-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Highlight OMTs revealed by maps #70482
Changes from all commits
914cb48
c4ce413
a26ebb9
2f6acbc
3fec395
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -879,6 +879,7 @@ void cata_tiles::draw_om( const point &dest, const tripoint_abs_omt ¢er_abs_ | |
you.overmap_sight_range( g->light_level( you.posz() ) ) : | ||
100; | ||
const bool showhordes = uistate.overmap_show_hordes; | ||
const bool show_map_revealed = uistate.overmap_show_revealed_omts; | ||
const bool viewing_weather = uistate.overmap_debug_weather || uistate.overmap_visible_weather; | ||
o = origin.raw().xy(); | ||
|
||
|
@@ -924,6 +925,12 @@ void cata_tiles::draw_om( const point &dest, const tripoint_abs_omt ¢er_abs_ | |
0, 0, ll, false ); | ||
} | ||
|
||
std::vector<tripoint_abs_omt> &revealed_highlights = get_avatar().map_revealed_omts; | ||
auto it = std::find( revealed_highlights.begin(), revealed_highlights.end(), omp ); | ||
if( blink && show_map_revealed && it != revealed_highlights.end() ) { | ||
draw_from_id_string( "highlight", omp.raw(), 0, 0, lit_level::LIT, false ); | ||
} | ||
|
||
Comment on lines
+928
to
+933
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be something like this to avoid iterating through if( blink && show_map_revealed ) {
if( it != revealed_highlights.end() ) {
std::vector<tripoint_abs_omt> &revealed_highlights = get_avatar().map_revealed_omts;
auto it = std::find( revealed_highlights.begin(), revealed_highlights.end(), omp );
draw_from_id_string( "highlight", omp.raw(), 0, 0, lit_level::LIT, false );
}
}
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The real problem is using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to search for anything if data would not even be used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, that is certainly true as well. It’s just that the time is dominated by searching the whole list for every single tile that might be drawn. |
||
if( see ) { | ||
if( blink && uistate.overmap_debug_mongroup ) { | ||
const std::vector<mongroup *> mgroups = overmap_buffer.monsters_at( omp ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are only using
newly_revealed
variable inside ofif
statement below, so it could be put there and it won't populate it each time even if overmap uistate does not imply showing map revealed omts.