+ }
+}
+
+
+
+extern void update_map_memory(struct Thing * t_eye)
+{
+ if (!t_eye->mem_map)
+ {
+ init_empty_map(&(t_eye->mem_map));
+ }
+ if (!t_eye->mem_depth_map)
+ {
+ init_empty_map(&(t_eye->mem_depth_map));
+ }
+ uint32_t i;
+ for (i = 0; i < (uint32_t) (world.map.length * world.map.length); i++)
+ {
+ if ('v' == t_eye->fov_map[i])
+ {
+ t_eye->mem_depth_map[i] = '0';
+ if (' ' == t_eye->mem_map[i])
+ {
+ t_eye->mem_map[i] = world.map.cells[i];
+ }
+ continue;
+ }
+ if ( '0' <= t_eye->mem_depth_map[i] && '9' > t_eye->mem_depth_map[i]
+ && !(rrand() % (uint16_t) pow(2, t_eye->mem_depth_map[i] - 48)))
+ {
+ t_eye->mem_depth_map[i]++;
+ }
+ }
+ add_things_to_map_memory(t_eye);
+}
+
+
+
+extern void build_fov_map(struct Thing * t)
+{
+ uint32_t map_size = world.map.length * world.map.length;
+ t->fov_map = t->fov_map ? t->fov_map : try_malloc(map_size, __func__);
+ memset(t->fov_map, 'v', map_size);
+ struct shadow_angle * shadows = NULL;
+ struct yx_uint8 test_pos = t->pos;
+ char * circledirs_string = "xswedc";
+ uint16_t circle_i;
+ uint8_t circle_is_on_map;
+ for (circle_i = 1, circle_is_on_map = 1; circle_is_on_map; circle_i++)
+ {
+ circle_is_on_map = 0;
+ if (1 < circle_i) /* All circles but the 1st are */
+ { /* moved into starting from a */
+ mv_yx_in_dir_legal('c', &test_pos);/* previous circle's last hex, */
+ } /* i.e. from the upper left. */
+ char dir_char = 'd'; /* Circle's 1st hex is entered by rightward move.*/
+ uint8_t dir_char_pos_in_circledirs_string = UINT8_MAX;
+ uint16_t dist_i, hex_i;
+ for (hex_i=0, dist_i=circle_i; hex_i < 6 * circle_i; dist_i++, hex_i++)