|
|
@ -103,7 +103,7 @@ struct CoordHash {
|
|
|
|
|
|
|
|
|
|
|
|
static unordered_map<df::coord, int32_t, CoordHash> locationToBuilding;
|
|
|
|
static unordered_map<df::coord, int32_t, CoordHash> locationToBuilding;
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t *getExtentTile(df::building_extents &extent, df::coord2d tile)
|
|
|
|
static df::building_extents_type *getExtentTile(df::building_extents &extent, df::coord2d tile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!extent.extents)
|
|
|
|
if (!extent.extents)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
@ -600,7 +600,7 @@ bool Buildings::checkFreeTiles(df::coord pos, df::coord2d size,
|
|
|
|
for (int dy = 0; dy < size.y; dy++)
|
|
|
|
for (int dy = 0; dy < size.y; dy++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::coord tile = pos + df::coord(dx,dy,0);
|
|
|
|
df::coord tile = pos + df::coord(dx,dy,0);
|
|
|
|
uint8_t *etile = NULL;
|
|
|
|
df::building_extents_type *etile = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
// Exclude using extents
|
|
|
|
// Exclude using extents
|
|
|
|
if (ext && ext->extents)
|
|
|
|
if (ext && ext->extents)
|
|
|
@ -640,7 +640,7 @@ bool Buildings::checkFreeTiles(df::coord pos, df::coord2d size,
|
|
|
|
|
|
|
|
|
|
|
|
if (!ext->extents)
|
|
|
|
if (!ext->extents)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ext->extents = new uint8_t[size.x*size.y];
|
|
|
|
ext->extents = new df::building_extents_type[size.x*size.y];
|
|
|
|
ext->x = pos.x;
|
|
|
|
ext->x = pos.x;
|
|
|
|
ext->y = pos.y;
|
|
|
|
ext->y = pos.y;
|
|
|
|
ext->width = size.x;
|
|
|
|
ext->width = size.x;
|
|
|
@ -653,7 +653,7 @@ bool Buildings::checkFreeTiles(df::coord pos, df::coord2d size,
|
|
|
|
if (!etile)
|
|
|
|
if (!etile)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
*etile = 0;
|
|
|
|
*etile = df::building_extents_type::None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -710,7 +710,7 @@ bool Buildings::containsTile(df::building *bld, df::coord2d tile, bool room)
|
|
|
|
|
|
|
|
|
|
|
|
if (bld->room.extents && (room || bld->isExtentShaped()))
|
|
|
|
if (bld->room.extents && (room || bld->isExtentShaped()))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t *etile = getExtentTile(bld->room, tile);
|
|
|
|
df::building_extents_type *etile = getExtentTile(bld->room, tile);
|
|
|
|
if (!etile || !*etile)
|
|
|
|
if (!etile || !*etile)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -842,7 +842,7 @@ static void markBuildingTiles(df::building *bld, bool remove)
|
|
|
|
|
|
|
|
|
|
|
|
if (use_extents)
|
|
|
|
if (use_extents)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8_t *etile = getExtentTile(bld->room, tile);
|
|
|
|
df::building_extents_type *etile = getExtentTile(bld->room, tile);
|
|
|
|
if (!etile || !*etile)
|
|
|
|
if (!etile || !*etile)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -883,7 +883,7 @@ static void linkRooms(df::building *bld)
|
|
|
|
if (!room->is_room || room->z != bld->z)
|
|
|
|
if (!room->is_room || room->z != bld->z)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t *pext = getExtentTile(room->room, df::coord2d(bld->x1, bld->y1));
|
|
|
|
df::building_extents_type *pext = getExtentTile(room->room, df::coord2d(bld->x1, bld->y1));
|
|
|
|
if (!pext || !*pext)
|
|
|
|
if (!pext || !*pext)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|