The nicer interface to losight is now void losight(env_show_grid& sh, const coord_def& center, const opacity_func &opc = opc_default, const bounds_func &bds = bds_default);
bounds_func provides the LOS boundary (usually just a circle with radius the current LOS radius). opacity_func is a mapping of grid coordinates to opacity values.
AL7EYY4HB7JNEFGDB6NVVHCVVUYYKUJKC4UFH4T7XUT3P5NT4NAAC 6Y2GZNY5I5YY34QKEPSSDCGAVVLFMOFI4QI34KBNQDRC76JM5AFAC V3YASGPC7MVXZE75XX7YQ7U6LFEJDNCTQA6NMI6R5TB5KEZH4RCQC LNFGGTCX4EJPO7L6NPY657VDSNSIPEQQFLI42LFR75WOVNGS6G2AC AUJG42P2TOWAVVU6HBT3D7USOSZCRPQS7FEUGV57HVNULEFDPTSQC N7YNVM65XE2BIR36EV2LCAZJ3CAVXZHRGBKPRTH3RR4DK3HFAHCQC ZNMT5CZHP2FC4HTLNA7KYEDGFBXSCUE5QHJOALVPE6RDPHSEDXRQC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC 453NICOL4ZKH7YQAWQFKSZZRDJ53XECMTQC7VEMXWV2N4IEAL5VAC 45OFFQNRRS46LXSPQ3SPNP2OXMBECE22A6NWQPITDEOXLRKYSQKAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC HYOH4PWRFTQEGZIHJ5HP4HMTUO32QL4K4TD4QRVB4XT62FO4DUZAC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC RIW55YSFKKTJLBTOJRVUBC7JOFUBOK7OBMISW4PBSVLYJHAAKPPQC SCXTTP2FDNB2A7F4XXGXSSOEKZQ7ODDGN5YBCTZXGZ22CLCEH3WQC 2EBEWIV4YHXXAFR4GG2GMZJ2K77NK762HNQ77CZLHI3LDVGX7RJAC PGGTIZ45TMBWXSPYBPHTR4QW7B66WC2MQ7S4LEFMFSOFCEFLMT5AC DRH5HH762ZIS2R6NCKQYD3XO2P6RDNS6N4XEULIEQPNMB46HEDFQC 5IB2YSN5CPEWGGKAWRH52576TKVRJKMNAJT2QP6NGNRZRV5B2MDQC U3UHWTM2LW64BR5DEBMMZUIGXGS2H3IYSGTWYI5ZU6LD4WWYKRPQC ACZYEIX7WMPIIODKCATBCUE626AJ4ZGGBOMVC6BGXM27EQU2RECAC T3R2D5M4YSC6NFZ6YO3AEG4VWORECX72CHUM5UBADV4UPAAZG7WQC int radius_sq;los_param_excl(const coord_def& c, int r): los_param_trans(c), radius_sq(r){}bool los_bounds(const coord_def& p) const{return (p.abs() <= radius_sq &&los_param_trans::los_bounds(p));}unsigned appearance(const coord_def& p) const{return 1;}opacity_type _feat_opacity(dungeon_feature_type feat) const{return grid_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR;}
return (grid_is_opaque(feat) ? OPC_OPAQUE : OPC_CLEAR);}
// A cell is considered clear unless the player knows it's// opaque.opacity_type opacity(const coord_def& p) const
// A cell is considered clear unless the player knows it's// opaque.struct opacity_excl : opacity_func{opacity_type operator()(const coord_def& p) const
else if (!is_terrain_changed(q))return _feat_opacity(env.grid(q));else if (env.map(q).object < NUM_REAL_FEATURES)return _feat_opacity((dungeon_feature_type) env.map(q).object);
else if (!is_terrain_changed(p))return _feat_opacity(env.grid(p));else if (env.map(p).object < NUM_REAL_FEATURES)return _feat_opacity((dungeon_feature_type) env.map(p).object);
};struct opacity_func{virtual ~opacity_func() {}virtual opacity_type operator()(const coord_def& p) const = 0;};struct bounds_func{virtual ~bounds_func() {}virtual bool operator()(const coord_def& p) const = 0;};// Default LOS rules.struct opacity_default : opacity_func{opacity_type operator()(const coord_def& p) const;
typedef opacity_type (*opacity_func)(const coord_def&);typedef bool (*bounds_func)(const coord_def&);
// Make anything solid block in addition to normal LOS.// XXX: Are trees, bushes solid?struct opacity_solid : opacity_func{opacity_type operator()(const coord_def& p) const;};static opacity_solid opc_solid = opacity_solid();// LOS bounded by fixed presquared radius.struct bounds_radius_sq : bounds_func{int radius_sq;bounds_radius_sq(int r_sq): radius_sq(r_sq) {}bool operator()(const coord_def& p) const;};
opacity_type opc_default(const coord_def&);bool bounds_los_radius(const coord_def& p);
// LOS bounded by current global LOS radius.struct bounds_los_radius : bounds_func{bool operator()(const coord_def& p) const;};static bounds_los_radius bds_default = bounds_los_radius();
};// Provides translation to given center and bounds checking.struct los_param_trans : public los_param{coord_def center;los_param_trans(const coord_def& c);coord_def trans(const coord_def& p) const;bool los_bounds(const coord_def& p) const;};// Everything is visible.struct los_param_permissive : public los_param_trans{los_param_permissive(const coord_def& c);unsigned appearance(const coord_def& p) const;opacity_type opacity(const coord_def& p) const;
// Standard visibility disregarding clouds.struct los_param_nocloud : public los_param_trans{los_param_nocloud(const coord_def& c);
dungeon_feature_type feature(const coord_def& p) const;unsigned appearance(const coord_def& p) const;opacity_type opacity(const coord_def& p) const;};// Standard visibility.struct los_param_base : public los_param_nocloud{los_param_base(const coord_def& c);unsigned short cloud_idx(const coord_def& p) const;opacity_type opacity(const coord_def& p) const;};// Like los_param_base, but any solid object blocks.// This includes clear walls and statues.struct los_param_solid : public los_param_base{los_param_solid(const coord_def& c);opacity_type opacity(const coord_def& p) const;};
return (p.abs() <= get_los_radius_squared());}/* los_param_trans */los_param_trans::los_param_trans(const coord_def& c): center(c){}coord_def los_param_trans::trans(const coord_def& p) const{return (p + center);}bool los_param_trans::los_bounds(const coord_def& p) const{return (map_bounds(trans(p)) && p.abs() <= get_los_radius_squared());}/* los_param_permissive */los_param_permissive::los_param_permissive(const coord_def& c): los_param_trans(c){}unsigned los_param_permissive::appearance(const coord_def& p) const{return env.grid(trans(p));}opacity_type los_param_permissive::opacity(const coord_def& p) const{return OPC_CLEAR;}/* los_param_nocloud */los_param_nocloud::los_param_nocloud(const coord_def& c): los_param_trans(c){}dungeon_feature_type los_param_nocloud::feature(const coord_def& p) const{return env.grid(trans(p));}unsigned los_param_nocloud::appearance(const coord_def& p) const{return grid_appearance(trans(p));}opacity_type los_param_nocloud::opacity(const coord_def& p) const{dungeon_feature_type f = feature(p);if (grid_is_opaque(f))return OPC_OPAQUE;elsereturn OPC_CLEAR;}/* los_param_base */los_param_base::los_param_base(const coord_def& c): los_param_nocloud(c){}unsigned short los_param_base::cloud_idx(const coord_def& p) const{return env.cgrid(trans(p));}opacity_type los_param_base::opacity(const coord_def& p) const{