git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7639 c06c8d41-db1a-0410-9941-cceddc491573
IHV7JHD4E67NEGLZEO3FPQGJPJF3IAV6QV5A63FPG4SU2VRFV47QC DUFJKFM5KBCM4272ZKLBPGKHLMDLK6RABUNTDEWRZULTKDTHHSBAC MT3256427VMCV4JUFWCN7ULY4KXSND5ZL5THDKYNWWYOXXR5DLIQC FKRLQJYHK3GB6HHSNNFQ7L57ZAR52LSTBG5B6SNJBYZ2LQ36P67AC X7MFMKQTNZ2IWBFVGS6WQV7NRNKJ3DWQAW2X7IQMFQQXW24AHPZQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC 5XNQ3SSNBFXFNWA6DPM74W6FH65NX665P3DMH6YCWVFOPZTJSYCQC GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC 4N5PW5S3OV25HFN634NNWMMYX26NA2TB6TVFG4UMYSZ2VBJWKE4QC AUXHSGS4EFOPZ6TVZYWNVOUDO7NYKUKE3HBKGQQWTALSVFOE3HAAC 7Y5HSDFKA5TPLS2TWTRFMQVX6UXUDHXU5MUMXQSDFAIY4THQ3BIQC TLO257LZSB6ZO36STDUEWJBO2LETXFKTFGXELA6Y4BZBVAEIIINAC NKONHW4JNY6HP2M63MNPM3H64ZWSUNUT5FX2STW4KTS4AMXJXXVQC 5DECJIOSMFWX7DMDTGVNPNV6QQP6O34F3XHFHRXGCTJUZMVIXT7QC CPBVQFT7NWEYLYD34D5VYZIEOZ32YADXYTSFMS635YNXX4OFIZVAC QONBKHB7H3PF5P4LGSAC7KIZ5D6HCH677Z3AR2HU7KNSOVKDK25QC BEJPFLSQYOLJETSLYRTROTRPJZEJDROGDX7MLBCWJLMIRZQBLEYQC W52PCSHX72WAMWKG6L4BPUBVMO6E72KYYBNKAA7554KNOTY6V7WQC }const coord_def find_marker_prop(const std::string &prop,const std::string &expected){for (rectangle_iterator i(0, 0); i; ++i){const std::string value =env.markers.property_at(*i, MAT_ANY, prop);if (!value.empty() && (expected.empty() || value == expected))return (*i);}const coord_def nowhere(-1, -1);return (nowhere);
}LUAFN(_dgn_find_marker_prop){const char *prop = luaL_checkstring(ls, 1);const std::string value(lua_gettop(ls) >= 2 ? luaL_checkstring(ls, 2) : "");const coord_def place = find_marker_prop(prop, value);if (map_bounds(place))clua_push_coord(ls, place);else{lua_pushnil(ls);lua_pushnil(ls);}return (2);
endlocal function set_floor_colour(colour)if not zig().level.floor_colour thenzig().level.floor_colour = colourdgn.change_floor_colour(colour, false)endendlocal function set_random_floor_colour()set_floor_colour( random_floor_colour() )endlocal function with_props(spec, props)return util.cathash({ spec = spec }, props)
local function ziggurat_vet_monster(fn)return function (x, y, nth, hdmax)for i = 1, 100 dolocal mons = fn(x, y, nth)if mons then-- Discard zero-exp monsters, and monsters that explode-- the HD limit.if mons.experience == 0 or mons.hd > hdmax * 1.3 thenmons.dismiss()elseif mons.muse == "eats_items" thenzig().level.jelly_protect = trueend-- Monster is ok!return monsendendend-- Give up.return nilend
local function ziggurat_vet_monster(fmap)local fn = fmap.fnfmap.fn = function (x, y, nth, hdmax)for i = 1, 100 dolocal mons = fn(x, y, nth)if mons then-- Discard zero-exp monsters, and monsters that explode-- the HD limit.if mons.experience == 0 or mons.hd > hdmax * 1.3 thenmons.dismiss()elseif mons.muse == "eats_items" thenzig().level.jelly_protect = trueend-- Monster is ok!return monsendendend-- Give up.return nilendreturn fmap
local linc = (vc - exit):sgn()
local function safe_area()local p = dgn.point(px, py)local sz = dgn.point(xs, ys)local floor = dgn.fnum("floor")return dgn.rectangle_forall(p, p + sz - 1,function (c)return dgn.grid(c.x, c.y) == floorend)endlocal linc = (exit - vc):sgn()
end-- Returns a function that returns true if the point specified is-- travel-passable and is not one of the features specified.function dgn.passable_excluding(...)local forbidden_features =util.set(util.map(dgn.find_feature_number, { ... }))return function (p)local x, y = p.x, p.yreturn dgn.is_passable(x, y) andnot forbidden_features[dgn.grid(x, y)]end
-- Returns the closest point p starting from c (including c) for which-- fcondition(p) is true, without passing through squares for which-- fpassable(p) is false. If no suitable square is found, returns nil.---- All points are instances of dgn.point, i.e. a Lua table with x and y keys.---- fpassable may be omitted, in which case it defaults to dgn.is_passable.
-- Sets the grid feature at (x,y) to grid. Optionally, if a marker value-- is provided, creates a suitable marker at (x,y).---- marker may be-- 1) a function, in which case a Lua marker is created that-- will call the function to create a marker table.-- 2) a table, in which case a Lua marker is created that uses the table-- directly as a marker table.-- 3) anything else, which is assumed to be a feature name or number, and-- is used to create a feature marker.--