record accurate room sizes in blueprints

develop
myk002 2022-10-12 16:33:06 -07:00
parent b03911945d
commit f411ba76ba
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 24 additions and 1 deletions

@ -41,6 +41,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `blueprint`: new ``--smooth`` option for recording all smoothed floors and walls instead of just the ones that require smoothing for later carving - `blueprint`: new ``--smooth`` option for recording all smoothed floors and walls instead of just the ones that require smoothing for later carving
- `blueprint`: record built constructions in blueprints - `blueprint`: record built constructions in blueprints
- `blueprint`: record stockpile/building/zone names in blueprints - `blueprint`: record stockpile/building/zone names in blueprints
- `blueprint`: record room sizes in blueprints
- `ls`: indent tag listings and wrap them in the right column for better readability - `ls`: indent tag listings and wrap them in the right column for better readability
- `ls`: new ``--exclude`` option for hiding matched scripts from the output. this can be especially useful for modders who don't want their mod scripts to be included in ``ls`` output. - `ls`: new ``--exclude`` option for hiding matched scripts from the output. this can be especially useful for modders who don't want their mod scripts to be included in ``ls`` output.
- `digtype`: new ``-z`` option for digtype to restrict designations to the current z-level and down - `digtype`: new ``-z`` option for digtype to restrict designations to the current z-level and down

@ -1043,7 +1043,29 @@ static const char * get_tile_query(const df::coord &pos,
static const char * get_tile_rooms(const df::coord &, const tile_context &ctx) { static const char * get_tile_rooms(const df::coord &, const tile_context &ctx) {
if (!ctx.b || !ctx.b->is_room) if (!ctx.b || !ctx.b->is_room)
return NULL; return NULL;
return "r+";
// get the maximum distance from the center of the building
df::building_extents &room = ctx.b->room;
int32_t x1 = room.x;
int32_t x2 = room.x + room.width - 1;
int32_t y1 = room.y;
int32_t y2 = room.y + room.height - 1;
int32_t dimx = std::max(ctx.b->centerx - x1, x2 - ctx.b->centerx);
int32_t dimy = std::max(ctx.b->centery - y1, y2 - ctx.b->centery);
int32_t max_dim = std::max(dimx, dimy);
switch (max_dim) {
case 0: return "r---&";
case 1: return "r--&";
case 2: return "r-&";
case 3: return "r&";
case 4: return "r+&";
}
std::ostringstream str;
str << "r{+ " << (max_dim - 3) << "}&";
return cache(str);
} }
static bool create_output_dir(color_ostream &out, static bool create_output_dir(color_ostream &out,