diff --git a/docs/changelog.txt b/docs/changelog.txt index 70e144f3f..71d843764 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -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`: record built constructions 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`: 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 diff --git a/plugins/blueprint.cpp b/plugins/blueprint.cpp index bb4d03d32..2f42e2798 100644 --- a/plugins/blueprint.cpp +++ b/plugins/blueprint.cpp @@ -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) { if (!ctx.b || !ctx.b->is_room) 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,