Skip to content

Commit

Permalink
Merge pull request #30940 from kevingranade/reset-seen-cache-fully
Browse files Browse the repository at this point in the history
Invalidate seen cache properly in many-z-level mode
  • Loading branch information
ZhilkinSerg authored May 29, 2019
2 parents 046739d + 5decf8e commit beb9e23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,12 +1180,12 @@ void map::build_seen_cache( const tripoint &origin, const int target_z )

constexpr float light_transparency_solid = LIGHT_TRANSPARENCY_SOLID;
constexpr int map_dimensions = MAPSIZE_X * MAPSIZE_Y;
std::uninitialized_fill_n(
&seen_cache[0][0], map_dimensions, light_transparency_solid );
std::uninitialized_fill_n(
&camera_cache[0][0], map_dimensions, light_transparency_solid );

if( !fov_3d ) {
std::uninitialized_fill_n(
&seen_cache[0][0], map_dimensions, light_transparency_solid );
seen_cache[origin.x][origin.y] = LIGHT_TRANSPARENCY_CLEAR;

castLightAll<float, float, sight_calc, sight_check, update_light, accumulate_transparency>(
Expand All @@ -1204,6 +1204,8 @@ void map::build_seen_cache( const tripoint &origin, const int target_z )
transparency_caches[z + OVERMAP_DEPTH] = &cur_cache.transparency_cache;
seen_caches[z + OVERMAP_DEPTH] = &cur_cache.seen_cache;
floor_caches[z + OVERMAP_DEPTH] = &cur_cache.floor_cache;
std::uninitialized_fill_n(
&cur_cache.seen_cache[0][0], map_dimensions, light_transparency_solid );
}
cast_zlight<float, sight_calc, sight_check, accumulate_transparency>(
seen_caches, transparency_caches, floor_caches, origin, 0, 1.0 );
Expand Down

0 comments on commit beb9e23

Please sign in to comment.