existing dungeon features. Dungeon features of importance - such as stairs, shops, and altars - and map markers are shifted out of the way, to the nearest free floor square.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1947 c06c8d41-db1a-0410-9941-cceddc491573
ZJU5Z2WDMI7HN4XJ3NVTVRHIZO2CGFUQ2FSKIRJVTQG47XHNCZFQC RXSPAKO7FZKRJMEBCQ4W32DLZZP7CJHJSHRUOQ2GE7I3QSM7KYOQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC 7Y5HSDFKA5TPLS2TWTRFMQVX6UXUDHXU5MUMXQSDFAIY4THQ3BIQC KCHX2F3JFEWOZT3WMJVZAAQUU2QSZ5Q7RDCD7WUJ7VE65J52JFUQC PISXY4NKSKL5KDJWAHD7CTXWTQDH3NFWQSFAHUAI3VVATWKXRODQC JR4ZZK4HOXQIG3WXBGTPZAPPNF7HHBCUZ3TE7RBCS64NHCOX7B2QC FSD7GIK3YLZXWLEH37BU6KV3IUCFGXPQL6IZ7H65YWNRBEKDBX5AC TLO257LZSB6ZO36STDUEWJBO2LETXFKTFGXELA6Y4BZBVAEIIINAC 56C44YMFHZ62GXAAOLYSLLGBVGRWXB53W2VI37Q26ZECEK2XG5SQC 4RFKVDJKTCRBZU6WPJ2E5OVI5IRPY3UTRPOBLC5QHY4CQJJTLZKQC CREW3VTGN2BV622ZXHCPHUEZWBAGEQMNUELDLTHLEKG4VBXGMRPQC const coord_def np(pos.x + xi, pos.y + yi);if (!in_bounds(np) || travel_point_distance[np.x][np.y])continue;
if (p != pos && acceptable(p))return (p);travel_point_distance[p.x][p.y] = 1;for (int yi = -1; yi <= 1; ++yi){for (int xi = -1; xi <= 1; ++xi){if (!xi && !yi)continue;
const dungeon_feature_type feat = grd(np);if (!grid_is_solid(feat) && !grid_destroys_items(feat)){int index = item.index();move_item_to_grid(&index, np.x, np.y);return (true);
if (traversable && !traversable(np))continue;points[!iter].push_back(np);}
for (std::list<coord_def>::iterator i = points.begin(); i != points.end();++i)
return (coord_def());}static bool item_safe_square(const coord_def &pos){const dungeon_feature_type feat = grd(pos);return (is_traversable(feat) && !grid_destroys_items(feat));}// Moves an item on the floor to the nearest adjacent floor-space.static bool dgn_shift_item(const coord_def &pos, item_def &item){const coord_def np = dgn_find_nearest_square(pos, item_safe_square);if (in_bounds(np) && np != pos)
memset(travel_point_distance, 0, sizeof(travel_distance_grid_t));travel_point_distance[pos.x][pos.y] = 0;return (dgn_shift_item_around(pos, item));
return (grid_stair_direction(feat) != CMD_NO_CMD|| grid_altar_god(feat) != GOD_NO_GOD);}static bool is_feature_shift_target(const coord_def &pos){return (grd(pos) == DNGN_FLOOR);
static bool dgn_shift_feature(const coord_def &pos){const dungeon_feature_type dfeat = grd(pos);if (!is_critical_feature(dfeat) && !env_find_marker(pos, MAT_ANY))return (false);const coord_def dest =dgn_find_nearest_square(pos, is_feature_shift_target);if (in_bounds(dest) && dest != pos){grd(dest) = dfeat;if (dfeat == DNGN_ENTER_SHOP){if (shop_struct *s = get_shop(pos.x, pos.y)){s->x = dest.x;s->y = dest.y;}}env_move_markers(pos, dest);if (see_grid(dest) && is_notable_terrain(dfeat))seen_notable_thing(dfeat, dest.x, dest.y);}return (true);}
std::list<map_marker*> markers;for (dgn_marker_map::iterator i = els.first; i != els.second; ){dgn_marker_map::iterator curr = i++;markers.push_back(curr->second);env.markers.erase(curr);}for (std::list<map_marker*>::iterator i = markers.begin();i != markers.end(); ++i){(*i)->pos = to;env_add_marker(*i);}}
&& dfeat != DNGN_SHALLOW_WATER))&& (!clobber|| (!grid_is_solid(dfeat) && dfeat != DNGN_LAVA&& !grid_is_watery(dfeat))))|| (!clobber&& (igrd[vx][vy] != NON_ITEM|| mgrd[vx][vy] != NON_MONSTER)))
&& dfeat != DNGN_SHALLOW_WATER)))|| igrd[vx][vy] != NON_ITEM|| mgrd[vx][vy] != NON_MONSTER)
if (mdef->orient == MAP_ENCOMPASS && !generating_level){if (clobber){// For encompass maps, clear the entire level.generating_level = true;fixup = true;reset_level();dungeon_events.clear();}else{mprf(MSGCH_DIAGNOSTICS,"Cannot generate encompass map '%s' without clobber=true",mdef->name.c_str());return (false);}}