Vault collision checking is also non-rectangular now.
Fixed Windows builds not reporting line numbers in .des file error messages.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1784 c06c8d41-db1a-0410-9941-cceddc491573
C22455VGUQOSUX2OORA32LROFQ7NNYDMD2ZDTTUZSAQLXK4AD6QAC
4WOHWWHMQPU22PK6TN5KIFCB4G22NDF5OQ3ZEYDK4Z5U7XCB5IWQC
CREW3VTGN2BV622ZXHCPHUEZWBAGEQMNUELDLTHLEKG4VBXGMRPQC
I7NXCEKCEBDWOGO7EDNRZ36GELP3P5GTOOXQG2YS5TXZTCNN7CDQC
XAFFD52IHN6FWFR2TT5F2KCUS7HAVCBI5CWTFMKPQG77GGTGAHLAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
KCHX2F3JFEWOZT3WMJVZAAQUU2QSZ5Q7RDCD7WUJ7VE65J52JFUQC
OYTCBRC7LE44EUVRZVYTOOVKQWJ6P6YE3FXTOGUTNKEMLNWPHKSQC
DTO3EUKWHZ5RJNGNCFYXSOVTIPVXPP637F2W7WFGYKJ7JK7VNKNQC
RGHXFBNIULRVRYLBGG5JZDMYVM2E2JJ2Y5KQPMU6PUS3V26G6ZXQC
B3SRWSFITQMJRVEBHGQQJARETYPSSDV6XKMQSSUTXEHTXRZKIQJQC
AUXHSGS4EFOPZ6TVZYWNVOUDO7NYKUKE3HBKGQQWTALSVFOE3HAAC
MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC
IVVTHLTTLOP5TSULXJWUSSXHOKYWVU3OWKYVK45A7RIB6V34MYQAC
UU5EKED2RA2U3CFZ3UEJQEWSWHQPEU7ZD4KH3I22IIVZFHD4Y67QC
56C44YMFHZ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6265XUFRCBPNLTZAEHJZSQC
KFM2ARORBIJ6BGX456VFW7EAVRIYBVFUV53JH63GSKNOKVPJWQ2QC
IIN7AVA6JYRBXH6ZYRR7BY7TV6PW7ANAQ2A3PD55FKBKKQFEEF2AC
std::string s = rewrite_chunk_prefix(sorig);
const std::string::size_type cpos = s.find(':');
if (cpos == std::string::npos)
return (s);
const std::string::size_type cnpos = s.find(':', cpos + 1);
if (cnpos == std::string::npos)
return (s);
return s.substr(0, cnpos);
return rewrite_chunk_prefix(sorig, true);
extern map_mask dgn_map_mask;
// Map mask constants.
enum map_mask_type
{
MMT_NONE = 0x0,
MMT_VAULT = 0x01, // This is a square in a vault.
MMT_NO_ITEM = 0x02, // Random items should not be placed here.
MMT_NO_MONS = 0x04, // Random monsters should not be placed here.
MMT_NO_POOL = 0x08, // Pool fixup should not be applied here.
MMT_NO_DOOR = 0x10 // No secret-doorisation.
};
static dgn_region_list no_monster_zones;
static dgn_region_list no_item_zones;
static dgn_region_list no_pool_fixup_zones;
static dgn_region_list no_door_fixup_zones;
map_mask dgn_map_mask;
no_door_fixup_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_monster_gen"))
no_monster_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_item_gen"))
no_item_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_pool_fixup"))
no_pool_fixup_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
static bool map_grid_is_on_edge(const vault_placement &place,
const coord_def &c)
{
for (int xi = c.x - 1; xi <= c.x + 1; ++xi)
for (int yi = c.y - 1; yi <= c.y + 1; ++yi)
if (!place.map.in_map(coord_def(xi, yi)))
return (true);
return (false);
}
static void pick_internal_float_exits(const vault_placement &place,
std::vector<coord_def> &exits)
{
for (int y = place.y + 1; y < place.y + place.height - 1; ++y)
for (int x = place.x + 1; x < place.x + place.width - 1; ++x)
if (grid_needs_exit(x, y)
&& map_grid_is_on_edge(place, coord_def(x, y)))
{
exits.push_back( coord_def(x, y) );
}
}
static dgn_region_list get_vault_regions()
{
dgn_region_list vaults;
for (int i = 0, size = level_vaults.size(); i < size; ++i)
{
const vault_placement &vp = level_vaults[i];
vaults.push_back(dgn_region(vp.x, vp.y, vp.width, vp.height));
}
return (vaults);
}
static coord_def find_random_grid(int grid, const dgn_region_list &excluded)
static coord_def find_random_grid(int grid, unsigned mask)
no_door_fixup_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_monster_gen"))
no_monster_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_item_gen"))
no_item_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
if (place.map.has_tag("no_pool_fixup"))
no_pool_fixup_zones.push_back(
dgn_region( place.x, place.y, place.width, place.height ) );
apply_place_masks(place);
link_items();
#ifdef OBSOLETE_LABYRINTH
int keep_lx = 0, keep_ly = 0;
int keep_lx2 = 0, keep_ly2 = 0;
char start_point_x = 10;
char start_point_y = 10;
char going_x = 1;
char going_y = (coinflip() ? 0 : 1);
bool do_2 = false;
int clear_space = 1;
unsigned char traps_put2 = 0;
if (coinflip())
{
start_point_x = (GXM - 10);
going_x = -1;
}
if (coinflip())
{
start_point_y = (GYM - 10);
if (going_y == 1)
going_y = -1;
}
int lx = start_point_x;
int ly = start_point_y;
if (going_y)
goto do_y;
do_x:
traps_put2 = 0;
clear_space = 0; // ( coinflip()? 3 : 2 );
do
{
lx += going_x;
if (grd[lx][ly] == DNGN_ROCK_WALL)
grd[lx][ly] = DNGN_FLOOR;
}
while (lx < (GXM - 8) && lx > 8
&& grd[lx + going_x * (2 + clear_space)][ly] == DNGN_ROCK_WALL);
going_x = 0;
if (ly < 32)
going_y = 1;
else if (ly > 37)
going_y = -1;
else
goto finishing;
do_y: // if (going_y != 0)
if (do_2)
{
lx = keep_lx2;
ly = keep_ly2;
}
// do_2 = false is the problem
if (coinflip())
{
clear_space = 0;
do_2 = false;
}
else
{
clear_space = 2;
do_2 = true;
}
do
{
ly += going_y;
if (grd[lx][ly] == DNGN_ROCK_WALL)
grd[lx][ly] = DNGN_FLOOR;
}
while (ly < (GYM - 8) && ly > 8
&& grd[lx][ly + going_y * (2 + clear_space)] == DNGN_ROCK_WALL);
keep_lx = lx;
keep_ly = ly;
if (lx < 37)
going_x = 1;
else if (lx > 42)
going_x = -1;
if (ly < 33)
ly += 2;
else if (ly > 37)
ly -= 2;
clear_space = ((!do_2) ? 6 : 2);
do
{
lx += going_x;
if (grd[lx][ly] == DNGN_ROCK_WALL)
grd[lx][ly] = DNGN_FLOOR;
}
while (lx < (GXM - 8) && lx > 8
&& grd[lx + going_x * (2 + clear_space)][ly] == DNGN_ROCK_WALL);
if (do_2)
{
keep_lx2 = lx;
keep_ly2 = ly;
}
lx = keep_lx;
ly = keep_ly;
going_y = 0;
if (lx < 37)
going_x = 1;
else if (lx > 42)
going_x = -1;
else
goto finishing;
goto do_x;
finishing:
start_point_x = 10 + random2(GXM - 20);
object_class_type glopop = OBJ_RANDOM; // used in calling items() {dlb}
int num_items = 8 + random2avg(9, 2);
for (int i = 0; i < num_items; i++)
{
int temp_rand = random2(11);
glopop = ((temp_rand == 0 || temp_rand == 9) ? OBJ_WEAPONS :
(temp_rand == 1 || temp_rand == 10) ? OBJ_ARMOUR :
(temp_rand == 2) ? OBJ_MISSILES :
(temp_rand == 3) ? OBJ_WANDS :
(temp_rand == 4) ? OBJ_MISCELLANY :
(temp_rand == 5) ? OBJ_SCROLLS :
(temp_rand == 6) ? OBJ_JEWELLERY :
(temp_rand == 7) ? OBJ_BOOKS
/* (temp_rand == 8) */ : OBJ_STAVES);
const int treasure_item = items( 1, glopop, OBJ_RANDOM, true,
level_number * 3, MAKE_ITEM_RANDOM_RACE );
if (treasure_item != NON_ITEM)
{
mitm[treasure_item].x = lx;
mitm[treasure_item].y = ly;
}
}
mons_place( MONS_MINOTAUR, BEH_SLEEP, MHITNOT, true, lx, ly );
grd[lx][ly] = DNGN_ROCK_STAIRS_UP;
// turn rock walls into undiggable stone or metal:
dungeon_feature_type wall_xform =
((random2(50) > 10) ? DNGN_STONE_WALL // 78.0%
: DNGN_METAL_WALL); // 22.0%
replace_area(0,0,GXM-1,GYM-1,DNGN_ROCK_WALL,wall_xform);
#endif
bool dgn_region::overlaps(const dgn_region_list ®ions,
const map_mask &mask) const
{
return overlaps_any(regions) && overlaps(mask);
}
bool dgn_region::overlaps(const map_mask &mask) const
{
const coord_def endp = pos + size;
for (int y = pos.y; y < endp.y; ++y)
for (int x = pos.x; x < endp.x; ++x)
if (mask[x][y])
return (true);
return (false);
}
xxx...?x??x..xxxxxx
xxxxx.xx....xxxxxxx
xxxxx..x.??xxxxxxxx
xxxxxx.?.xxxxxxxxxx
xxxxxx..??xxxxxxxxx
xxxxxx?x.xxxxxxxxxx
xxxxxxx?.?xxxxxxxxx
xxxxxxxx..?xxxxxxxx
xxxxxxxxxx@xxxxxxxx
xx...?x??x..xx
xxx.xx....xx
x..x.??xx
xx.?.xxx
x..??x
x?x.xx
xx?.?xx
xx..?x
xxx@x
xx...ccccc...xx
xxx...ccc...xxx
xxx...ccc...xxx
xxxx...c...xxxx
xxxx...c...xxxx
xxxxx.....xxxxx
xxxxx.....xxxxx
xxxxxx...xxxxxx
xxxxxx...xxxxxx
xxxxxx...xxxxxx
xxxxxx+++xxxxxx
xxxxxx.@.xxxxxx
x...ccccc...x
xx...ccc...xx
x...ccc...x
xx...c...xx
x...c...x
xx.....xx
x.....x
xx...xx
x...x
x...x
x+++x
x.@.x