-extern uint8_t * build_fov_map(struct Thing * eye)
+extern void build_fov_map(struct Thing * eye)
{
uint32_t map_size = world.map.length * world.map.length;
uint8_t * fov_map = try_malloc(map_size, __func__);
}
mv_yx_in_dir_wrap(0, NULL, 1);
free_angles(shadows);
- return fov_map;
+ free(eye->fov_map);
+ eye->fov_map = fov_map;
}
VISIBLE = 0x01
};
-/* Return field of view map of the world as seen from the position of "eye". */
-extern uint8_t * build_fov_map(struct Thing * eye);
+/* Build "eye"'s field of view. */
+extern void build_fov_map(struct Thing * eye);
{
t->pos.x = length;
}
- free(t->fov_map);
if (world.exists && t->lifepoints)
{
- t->fov_map = build_fov_map(t);
+ build_fov_map(t);
}
}
return 1;
t = add_thing(id, world.thing_types->id, 0, 0);
if (world.exists && t->lifepoints)
{
- t->fov_map = build_fov_map(t);
+ build_fov_map(t);
}
}
}
{
if (ti->lifepoints)
{
- if (ti->fov_map)
- {
- free(ti->fov_map);
- }
- ti->fov_map = build_fov_map(ti);
+ build_fov_map(ti);
}
}
world.exists = 1;
struct Thing * t;
for (t = world.things; NULL != t; t = t->next)
{
- t->fov_map = t->lifepoints ? build_fov_map(t) : NULL;
+ if (t->lifepoints)
+ {
+ build_fov_map(t);
+ }
}
world.turn = 1;
world.do_update = 1;
if (passable)
{
set_thing_position(t, target);
- free(t->fov_map);
- t->fov_map = build_fov_map(t);
+ build_fov_map(t);
}
if (t == get_player())
{