Added a function void losight(env_show_grid& sh, const coord_def& center, opacity_func opc, bounds_func bounds) with sensible defaults for opc and bounds.
It's not necessary to abstract away the geometry as I initially did with los_param.
N7YNVM65XE2BIR36EV2LCAZJ3CAVXZHRGBKPRTH3RR4DK3HFAHCQC
opacity_type opc_default(const coord_def& p)
{
int m;
dungeon_feature_type f = env.grid(p);
if (grid_is_opaque(f))
return OPC_OPAQUE;
else if (is_opaque_cloud(env.cgrid(p)))
return OPC_HALF;
else if (f == DNGN_TREES)
return OPC_HALF;
else if ((m = mgrd(p)) != NON_MONSTER && menv[m].type == MONS_BUSH)
return OPC_HALF;
else
return OPC_CLEAR;
}
}
struct los_param_funcs : public los_param
{
coord_def center;
opacity_func opc;
bounds_func bounds;
los_param_funcs(const coord_def& c,
opacity_func o, bounds_func b)
: center(c), opc(o), bounds(b)
{
}
bool los_bounds(const coord_def& p) const
{
return (map_bounds(p + center) && bounds(p));
}
unsigned appearance(const coord_def& p) const
{
return (grid_appearance(p + center));
}
opacity_type opacity(const coord_def& p) const
{
return (opc(p + center));
}
};
void losight(env_show_grid& sh, const coord_def& center,
opacity_func opc, bounds_func bounds)
{
losight(sh, los_param_funcs(center, opc, bounds));