Skip to content

Commit

Permalink
Only memorize tiles the first time they are seen.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingranade committed Jan 10, 2019
1 parent d25aa45 commit e8e8389
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/cata_tiles.cpp
Expand Up @@ -2267,7 +2267,9 @@ bool cata_tiles::draw_terrain( const tripoint &p, lit_level ll, int &height_3d )
}

const std::string &tname = t.obj().id.str();
g->u.memorize_tile( g->m.getabs( p ), tname, subtile, rotation );
if( !g->m.check_and_set_seen_cache( p ) ) {
g->u.memorize_tile( g->m.getabs( p ), tname, subtile, rotation );
}

return draw_from_id_string( tname, C_TERRAIN, empty_string, p, subtile, rotation, ll,
nv_goggles_activated, height_3d );
Expand Down Expand Up @@ -2311,7 +2313,9 @@ bool cata_tiles::draw_furniture( const tripoint &p, lit_level ll, int &height_3d

// get the name of this furniture piece
const std::string &f_name = f_id.obj().id.str();
g->u.memorize_tile( g->m.getabs( p ), f_name, subtile, rotation );
if( !g->m.check_and_set_seen_cache( p ) ) {
g->u.memorize_tile( g->m.getabs( p ), f_name, subtile, rotation );
}

bool ret = draw_from_id_string( f_name, C_FURNITURE, empty_string, p, subtile, rotation, ll,
nv_goggles_activated, height_3d );
Expand Down Expand Up @@ -2339,7 +2343,9 @@ bool cata_tiles::draw_trap( const tripoint &p, lit_level ll, int &height_3d )
int rotation = 0;
get_tile_values( tr.loadid, neighborhood, subtile, rotation );

g->u.memorize_tile( g->m.getabs( p ), tr.id.str(), subtile, rotation );
if( !g->m.check_and_set_seen_cache( p ) ) {
g->u.memorize_tile( g->m.getabs( p ), tr.id.str(), subtile, rotation );
}

return draw_from_id_string( tr.id.str(), C_TRAP, empty_string, p, subtile, rotation, ll,
nv_goggles_activated, height_3d );
Expand Down Expand Up @@ -2481,7 +2487,9 @@ bool cata_tiles::draw_vpart( const tripoint &p, lit_level ll, int &height_3d )
bool draw_highlight = cargopart && !veh->get_items( cargopart->part_index() ).empty();

if( !veh->forward_velocity() ) {
g->u.memorize_tile( g->m.getabs( p ), vpid, subtile, veh_dir );
if( !g->m.check_and_set_seen_cache( p ) ) {
g->u.memorize_tile( g->m.getabs( p ), vpid, subtile, veh_dir );
}
}

bool ret = draw_from_id_string( vpid, C_VEHICLE_PART, subcategory, p, subtile, veh_dir,
Expand Down
4 changes: 3 additions & 1 deletion src/map.cpp
Expand Up @@ -5817,7 +5817,9 @@ bool map::draw_maptile( const catacurses::window &w, player &u, const tripoint &
}
}

g->u.memorize_symbol( getabs( p ), memory_sym );
if( !check_and_set_seen_cache( p ) ) {
g->u.memorize_symbol( getabs( p ), memory_sym );
}

// If there's graffiti here, change background color
if( curr_maptile.has_graffiti() ) {
Expand Down

0 comments on commit e8e8389

Please sign in to comment.