diff --git a/data/blueprints/library/test/ecosystem/golden/transform-build.csv b/data/blueprints/library/test/ecosystem/golden/transform-build.csv index 2cab6e804..74434544a 100644 --- a/data/blueprints/library/test/ecosystem/golden/transform-build.csv +++ b/data/blueprints/library/test/ecosystem/golden/transform-build.csv @@ -1,28 +1,28 @@ #build label(build) start(14;14) -,trackNS,trackE,,trackW,trackS,trackN,,gs(1x2),ga(2x1),,gx(1x2),gw(1x2),,gw(1x2),gx(1x2),gd(2x1),,gs(1x2),,trackN,trackS,trackE,,trackW,trackNS -trackEW,,trackSE,,trackSW,trackNE,trackNW,,,gd(2x1),,,,,,,ga(2x1),,,,trackNE,trackNW,trackSE,,trackSW,,trackEW -trackS,trackSE,,,trackNSE,trackNSW,trackEW,,Mrsssqq(2x1),,,Msh,,,,,Msk,Mrsqq(2x1),,,trackEW,trackNSE,trackNSW,,,trackSW,trackS +,~,~,,~,~,~,,gs(1x2),ga(2x1),,gx(1x2),gw(1x2),,gw(1x2),gx(1x2),gd(2x1),,gs(1x2),,~,~,~,,~,~ +~,,~,,~,~,~,,,gd(2x1),,,,,,,ga(2x1),,,,~,~,~,,~,,~ +~,~,,,~,~,~,,Mrsssqq(2x1),,,Msh,,,,,Msk,Mrsqq(2x1),,,~,~,~,,,~,~ ,,,,,,,,CSdddaaaa,,Msk,,Mw,,Mw,,,Msh,CSddddaaaa -trackN,trackNE,trackSEW,,,trackSEW,trackNEW,,CSa,,Mrss(1x2),Mw,,,,Mw,Mrss(1x2),,CSa,,trackNEW,trackSEW,,,trackSEW,trackNW,trackN -trackE,trackSW,trackNEW,,trackNSE,,trackNSEW,,,Msm,,,Mhs(1x2),,Mhs(1x2),,,Msm,,,trackNSEW,,trackNSW,,trackNEW,trackSE,trackW -trackW,trackNW,trackNS,,trackNSW,trackNSEW,,,Msu,,Mws,,,,,,Mws,,Msu,,,trackNSEW,trackNSE,,trackNS,trackNE,trackE +~,~,~,,,~,~,,CSa,,Mrss(1x2),Mw,,,,Mw,Mrss(1x2),,CSa,,~,~,,,~,~,~ +~,~,~,,~,,~,,,Msm,,,Mhs(1x2),,Mhs(1x2),,,Msm,,,~,,~,,~,~,~ +~,~,~,,~,~,,,Msu,,Mws,,,,,,Mws,,Msu,,,~,~,,~,~,~ ,,,,,,,,,Mws,,Mh(2x1),,,Mh(2x1),,,Mws gs(2x1),,Mrqq(1x2),CSddaaaa,CSa,,Msh,,,,,,,,,,,,,,,Msk,CSa,CSddaaaa,Mrqq(1x2),gs(2x1) -gw(1x2),gx(1x2),,,,Msk,,Mw,,,trackrampNW,trackrampNS,trackrampN,,trackrampN,trackrampNS,trackrampNE,,,Mw,,,Msh,,,gx(1x2),gw(1x2) -,,,Msm,Mrs(2x1),,Mw,,,trackrampNW,,trackrampNSE,trackrampNSW,,trackrampNSE,trackrampNSW,,trackrampNE,,,Mw,Mrsss(2x1),,Msm -gd(2x1),,Msu,,Mws,,,Mhs(1x2),,trackrampEW,trackrampSEW,,trackrampNSEW,,trackrampNSEW,,trackrampSEW,trackrampEW,,Mhs(1x2),,,Mws,,Msu,ga(2x1) -ga(2x1),,,Mws,,Mh(2x1),,,,trackrampW,trackrampNEW,trackrampNSEW,,,,trackrampNSEW,trackrampNEW,trackrampE,,,Mh(2x1),,,Mws,,gd(2x1) +gw(1x2),gx(1x2),,,,Msk,,Mw,,,~,~,~,,~,~,~,,,Mw,,,Msh,,,gx(1x2),gw(1x2) +,,,Msm,Mrs(2x1),,Mw,,,~,,~,~,,~,~,,~,,,Mw,Mrsss(2x1),,Msm +gd(2x1),,Msu,,Mws,,,Mhs(1x2),,~,~,,~,,~,,~,~,,Mhs(1x2),,,Mws,,Msu,ga(2x1) +ga(2x1),,,Mws,,Mh(2x1),,,,~,~,~,,,,~,~,~,,,Mh(2x1),,,Mws,,gd(2x1) -ga(2x1),,,Mws,,Mh(2x1),,Mhs(1x2),,trackrampW,trackrampSEW,trackrampNSEW,,,,trackrampNSEW,trackrampSEW,trackrampE,,Mhs(1x2),Mh(2x1),,,Mws,,gd(2x1) -gd(2x1),,,,Mws,,,,,trackrampEW,trackrampNEW,,trackrampNSEW,,trackrampNSEW,,trackrampNEW,trackrampEW,,,,,Mws,,,ga(2x1) -gx(1x2),gw(1x2),Msm,,Mrs(2x1),,Mw,,,trackrampSW,,trackrampNSE,trackrampNSW,,trackrampNSE,trackrampNSW,,trackrampSE,,,Mw,Mrsss(2x1),,,Msm,gw(1x2),gx(1x2) -,,Mrssqq(1x2),Msu,,Msk,,Mw,,,trackrampSW,trackrampNS,trackrampS,,trackrampS,trackrampNS,trackrampSE,,,Mw,,,Msh,Msu,Mrssqq(1x2) +ga(2x1),,,Mws,,Mh(2x1),,Mhs(1x2),,~,~,~,,,,~,~,~,,Mhs(1x2),Mh(2x1),,,Mws,,gd(2x1) +gd(2x1),,,,Mws,,,,,~,~,,~,,~,,~,~,,,,,Mws,,,ga(2x1) +gx(1x2),gw(1x2),Msm,,Mrs(2x1),,Mw,,,~,,~,~,,~,~,,~,,,Mw,Mrsss(2x1),,,Msm,gw(1x2),gx(1x2) +,,Mrssqq(1x2),Msu,,Msk,,Mw,,,~,~,~,,~,~,~,,,Mw,,,Msh,Msu,Mrssqq(1x2) gs(2x1),,,CSdaaaa,CSa,,Msh,,,,,,,,,,,,,,,Msk,CSa,CSdaaaa,,gs(2x1) ,,,,,,,,,Mws,,Mh(2x1),,,Mh(2x1),,,Mws -trackW,trackSW,trackNS,,trackNSW,trackNSEW,,,,,Mws,,Mhs(1x2),,Mhs(1x2),,Mws,,,,,trackNSEW,trackNSE,,trackNS,trackSE,trackE -trackE,trackNW,trackSEW,,trackNSE,,trackNSEW,,Msm,,Mr(1x2),,,,,,Mr(1x2),,Msm,,trackNSEW,,trackNSW,,trackSEW,trackNE,trackW -trackS,trackSE,trackNEW,,,trackNEW,trackSEW,,CSa,Msu,,Mw,,,,Mw,,Msu,CSa,,trackSEW,trackNEW,,,trackNEW,trackSW,trackS +~,~,~,,~,~,,,,,Mws,,Mhs(1x2),,Mhs(1x2),,Mws,,,,,~,~,,~,~,~ +~,~,~,,~,,~,,Msm,,Mr(1x2),,,,,,Mr(1x2),,Msm,,~,,~,,~,~,~ +~,~,~,,,~,~,,CSa,Msu,,Mw,,,,Mw,,Msu,CSa,,~,~,,,~,~,~ ,,,,,,,,CSdddaaaa,,Msk,,Mw,,Mw,,,Msh,CSddddaaaa -trackN,trackNE,,,trackNSE,trackNSW,trackEW,,Mrsssqq(2x1),,,Msh,,,,,Msk,Mrsqq(2x1),,,trackEW,trackNSE,trackNSW,,,trackNW,trackN -trackEW,,trackNE,,trackNW,trackSE,trackSW,,gs(1x2),gd(2x1),,gw(1x2),gx(1x2),,gx(1x2),gw(1x2),ga(2x1),,gs(1x2),,trackSE,trackSW,trackNE,,trackNW,,trackEW -,trackNS,trackE,,trackW,trackN,trackS,,,ga(2x1),,,,,,,gd(2x1),,,,trackS,trackN,trackE,,trackW,trackNS +~,~,,,~,~,~,,Mrsssqq(2x1),,,Msh,,,,,Msk,Mrsqq(2x1),,,~,~,~,,,~,~ +~,,~,,~,~,~,,gs(1x2),gd(2x1),,gw(1x2),gx(1x2),,gx(1x2),gw(1x2),ga(2x1),,gs(1x2),,~,~,~,,~,,~ +,~,~,,~,~,~,,,ga(2x1),,,,,,,gd(2x1),,,,~,~,~,,~,~ diff --git a/data/blueprints/library/test/ecosystem/golden/transform-construct.csv b/data/blueprints/library/test/ecosystem/golden/transform-construct.csv new file mode 100644 index 000000000..9620c96c1 --- /dev/null +++ b/data/blueprints/library/test/ecosystem/golden/transform-construct.csv @@ -0,0 +1,28 @@ +#build label(construct) start(14;14) +,trackNS,trackE,,trackW,trackS,trackN,,,,,,,,,,,,,,trackN,trackS,trackE,,trackW,trackNS +trackEW,,trackSE,,trackSW,trackNE,trackNW,,,,,,,,,,,,,,trackNE,trackNW,trackSE,,trackSW,,trackEW +trackS,trackSE,,,trackNSE,trackNSW,trackEW,,,,,,,,,,,,,,trackEW,trackNSE,trackNSW,,,trackSW,trackS + +trackN,trackNE,trackSEW,,,trackSEW,trackNEW,,,,,,,,,,,,,,trackNEW,trackSEW,,,trackSEW,trackNW,trackN +trackE,trackSW,trackNEW,,trackNSE,,trackNSEW,,,,,,,,,,,,,,trackNSEW,,trackNSW,,trackNEW,trackSE,trackW +trackW,trackNW,trackNS,,trackNSW,trackNSEW,,,,,,,,,,,,,,,,trackNSEW,trackNSE,,trackNS,trackNE,trackE + + +,,,,,,,,,,trackrampNW,trackrampNS,trackrampN,,trackrampN,trackrampNS,trackrampNE +,,,,,,,,,trackrampNW,,trackrampNSE,trackrampNSW,,trackrampNSE,trackrampNSW,,trackrampNE +,,,,,,,,,trackrampEW,trackrampSEW,,trackrampNSEW,,trackrampNSEW,,trackrampSEW,trackrampEW +,,,,,,,,,trackrampW,trackrampNEW,trackrampNSEW,,,,trackrampNSEW,trackrampNEW,trackrampE + +,,,,,,,,,trackrampW,trackrampSEW,trackrampNSEW,,,,trackrampNSEW,trackrampSEW,trackrampE +,,,,,,,,,trackrampEW,trackrampNEW,,trackrampNSEW,,trackrampNSEW,,trackrampNEW,trackrampEW +,,,,,,,,,trackrampSW,,trackrampNSE,trackrampNSW,,trackrampNSE,trackrampNSW,,trackrampSE +,,,,,,,,,,trackrampSW,trackrampNS,trackrampS,,trackrampS,trackrampNS,trackrampSE + + +trackW,trackSW,trackNS,,trackNSW,trackNSEW,,,,,,,,,,,,,,,,trackNSEW,trackNSE,,trackNS,trackSE,trackE +trackE,trackNW,trackSEW,,trackNSE,,trackNSEW,,,,,,,,,,,,,,trackNSEW,,trackNSW,,trackSEW,trackNE,trackW +trackS,trackSE,trackNEW,,,trackNEW,trackSEW,,,,,,,,,,,,,,trackSEW,trackNEW,,,trackNEW,trackSW,trackS + +trackN,trackNE,,,trackNSE,trackNSW,trackEW,,,,,,,,,,,,,,trackEW,trackNSE,trackNSW,,,trackNW,trackN +trackEW,,trackNE,,trackNW,trackSE,trackSW,,,,,,,,,,,,,,trackSE,trackSW,trackNE,,trackNW,,trackEW +,trackNS,trackE,,trackW,trackN,trackS,,,,,,,,,,,,,,trackS,trackN,trackE,,trackW,trackNS diff --git a/data/blueprints/library/test/ecosystem/in/buildings-build.csv b/data/blueprints/library/test/ecosystem/in/buildings-build.csv index 89e066e80..f48457c0a 100644 --- a/data/blueprints/library/test/ecosystem/in/buildings-build.csv +++ b/data/blueprints/library/test/ecosystem/in/buildings-build.csv @@ -1,33 +1,33 @@ #build label(build) -a,Mg,,CS,trackN -b,Mh(1x1),S,CSa,trackS,,,,,,Mw,,,wm,,,wp -c,Mhs(1x1),m,CSaa,trackE,,,,,,,,,,,,,,,,,D -n,Mv,v,CSaaa,trackW,,Msu -,Mr(1x1),j,CSaaaa,trackNS,,,,,,Mws,,,wu,,,ew -d,Mrq(1x1),A,CSd,trackNE,,,Msk -,Mrqq(1x1),R,CSda,trackNW -l,Mrqqq(1x1),N,CSdaa,trackSE,,Msm,,,,we,,,wn,,,es,,,,,k -x,Mrqqqq(1x1),~h,CSdaaa,trackSW -H,Mrs(1x1),~a,CSdaaaa,trackEW,,,Msh -W,Mrsq(1x1),~c,CSdd,trackNSE,,,,,,wq,,,wr,,,el -G,Mrsqq(1x1),F,CSdda,trackNSW -B,Mrsqqq(1x1),o(1x1),CSddaa,trackNEW,,,,,,,,,,,,,,,,,ws -~b,Mrsqqqq(1x1),Cw,CSddaaa,trackSEW,,,,,,wM,,,wt,,,eg -f,Mrss(1x1),Cf,CSddaaaa,trackNSEW -h,Mrssq(1x1),Cr,CSddd,trackrampN -r,Mrssqq(1x1),Cu,CSddda,trackrampS,,,,,,wo,,,wl,,,ea,,,,gx(1x2),gx(1x2) -s,Mrssqqq(1x1),Cd,CSdddaa,trackrampE -~s,Mrssqqqq(1x1),Cx,CSdddaaa,trackrampW,,,,,,,,,,,,,,gd(2x1),,gs(2x1),,ga(2x1) -t,Mrsss(1x1),CF,CSdddaaaa,trackrampNS,,,,,,wk,,,ww,,,ek,,gd(2x1),,gs(2x1),,ga(2x1) -gs(1x1),Mrsssq(1x1),,CSdddd,trackrampNE,,,,,,,,,,,,,,,,gw(1x2),gw(1x2) -ga(1x1),Mrsssqq(1x1),,CSdddda,trackrampNW -gd(1x1),Mrsssqqq(1x1),,CSddddaa,trackrampSE,,,,,,wb,,,wz,,,en -gw(1x1),Mrsssqqqq(1x1),,CSddddaaa,trackrampSW,,,,,,,,,,,,,,Mh(2x1),,Mh(2x1),,Mhs(1x2),Mhs(1x2) -gx(1x1),,,CSddddaaaa,trackrampEW,,,,,,,,,,,,,,Mh(2x1),,Mh(2x1) -,,,Ts,trackrampNSE,,,,,,wc,,,wh,,,ib,,Mr(1x2),Mr(1x2),Mrs(2x1),,Mhs(1x2),Mhs(1x2) -y,,,Tw,trackrampNSW,,,,,,,,,,,,,,,,Mrs(2x1) -Y,,,Tl,trackrampNEW,,,,,,,,,,,,,,Mr(1x2),Mr(1x2),Mrsq(2x1),,Mrsq(2x1) -,,,Tp,trackrampSEW,,,,,,wf,,,wy,,,ic,,,,Mrsssqqqq(2x1),,Mrsssqqqq(2x1) -,,,Tc,trackrampNSEW +a,Mg,,CS +b,Mh(1x1),S,CSa,,,,,,Mw,,,wm,,,wp +c,Mhs(1x1),m,CSaa,,,,,,,,,,,,,,,,,D +n,Mv,v,CSaaa,,Msu +,Mr(1x1),j,CSaaaa,,,,,,Mws,,,wu,,,ew +d,Mrq(1x1),A,CSd,,,Msk +,Mrqq(1x1),R,CSda +l,Mrqqq(1x1),N,CSdaa,,Msm,,,,we,,,wn,,,es,,,,,k +x,Mrqqqq(1x1),~h,CSdaaa +H,Mrs(1x1),~a,CSdaaaa,,,Msh +W,Mrsq(1x1),~c,CSdd,,,,,,wq,,,wr,,,el +G,Mrsqq(1x1),F,CSdda +B,Mrsqqq(1x1),o(1x1),CSddaa,,,,,,,,,,,,,,,,,ws +~,~b,Mrsqqqq(1x1),CSddaaa,,,,,,wM,,,wt,,,eg +~,f,Mrss(1x1),CSddaaaa +~,h,Mrssq(1x1),CSddd +~,r,Mrssqq(1x1),CSddda,,,,,,wo,,,wl,,,ea,,,,gx(1x2),gx(1x2) +~,s,Mrssqqq(1x1),CSdddaa +~,~s,Mrssqqqq(1x1),CSdddaaa,,,,,,,,,,,,,,gd(2x1),,gs(2x1),,ga(2x1) +~,t,Mrsss(1x1),CSdddaaaa,,,,,,wk,,,ww,,,ek,,gd(2x1),,gs(2x1),,ga(2x1) +gs(1x1),Mrsssq(1x1),,CSdddd,,,,,,,,,,,,,,,,gw(1x2),gw(1x2) +ga(1x1),Mrsssqq(1x1),,CSdddda +gd(1x1),Mrsssqqq(1x1),,CSddddaa,,,,,,wb,,,wz,,,en +gw(1x1),Mrsssqqqq(1x1),,CSddddaaa,,,,,,,,,,,,,,Mh(2x1),,Mh(2x1),,Mhs(1x2),Mhs(1x2) +gx(1x1),,,CSddddaaaa,,,,,,,,,,,,,,Mh(2x1),,Mh(2x1) +,,,Ts,,,,,,wc,,,wh,,,ib,,Mr(1x2),Mr(1x2),Mrs(2x1),,Mhs(1x2),Mhs(1x2) +y,,,Tw,,,,,,,,,,,,,,,,Mrs(2x1) +Y,,,Tl,,,,,,,,,,,,,,Mr(1x2),Mr(1x2),Mrsq(2x1),,Mrsq(2x1) +,,,Tp,,,,,,wf,,,wy,,,ic,,,,Mrsssqqqq(2x1),,Mrsssqqqq(2x1) +,,,Tc ,,,TS ,,,,,,,,,,wv,,,wd,,,wj,,,wS diff --git a/data/blueprints/library/test/ecosystem/in/buildings-construct.csv b/data/blueprints/library/test/ecosystem/in/buildings-construct.csv new file mode 100644 index 000000000..e7e1d12bb --- /dev/null +++ b/data/blueprints/library/test/ecosystem/in/buildings-construct.csv @@ -0,0 +1,21 @@ +#build label(construct) + + + + + + + + + + + + + +Cw +Cf +Cr +Cu +Cd +Cx +CF diff --git a/data/blueprints/library/test/ecosystem/in/transform-build.csv b/data/blueprints/library/test/ecosystem/in/transform-build.csv index fdc2e18ce..7907220e7 100644 --- a/data/blueprints/library/test/ecosystem/in/transform-build.csv +++ b/data/blueprints/library/test/ecosystem/in/transform-build.csv @@ -7,21 +7,8 @@ Mw,,,Msh,CSddddaaaa Mhs(1x2),,,Msm ,,Mws,,Msu Mh(2x1),,,Mws -#build label(outer) hidden() -trackN,trackS,trackE,,trackW,trackNS -trackNE,trackNW,trackSE,,trackSW -trackEW,trackNSE,trackNSW - -trackNEW,trackSEW -trackNSEW -#build label(inner) hidden() -trackrampN,trackrampNS,trackrampNE -trackrampNSE,trackrampNSW -trackrampNSEW #meta label(chunk) hidden() /big shift(1 -13) -/outer shift(7 -13) -/inner shift(1 -4) #meta label(build) /chunk /chunk transform(cw) diff --git a/data/blueprints/library/test/ecosystem/in/transform-construct.csv b/data/blueprints/library/test/ecosystem/in/transform-construct.csv new file mode 100644 index 000000000..95717afa8 --- /dev/null +++ b/data/blueprints/library/test/ecosystem/in/transform-construct.csv @@ -0,0 +1,23 @@ +#build label(outer) hidden() +trackN,trackS,trackE,,trackW,trackNS +trackNE,trackNW,trackSE,,trackSW +trackEW,trackNSE,trackNSW + +trackNEW,trackSEW +trackNSEW +#build label(inner) hidden() +trackrampN,trackrampNS,trackrampNE +trackrampNSE,trackrampNSW +trackrampNSEW +#meta label(chunk) hidden() +/outer shift(7 -13) +/inner shift(1 -4) +#meta label(construct) +/chunk +/chunk transform(cw) +/chunk transform(cw cw) +/chunk transform(ccw) +/chunk transform(fliph) +/chunk transform(flipv) +/chunk transform(cw flipv) +/chunk transform(ccw flipv) diff --git a/docs/changelog.txt b/docs/changelog.txt index f9b7accc5..37f3a1dd1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -38,6 +38,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes ## Misc Improvements +- `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 - `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/docs/plugins/blueprint.rst b/docs/plugins/blueprint.rst index b999c0e99..bde5bb77e 100644 --- a/docs/plugins/blueprint.rst +++ b/docs/plugins/blueprint.rst @@ -7,11 +7,11 @@ blueprint With ``blueprint``, you can export the structure of a portion of your fortress in a blueprint file that you (or anyone else) can later play back with -`quickfort`. +`gui/quickfort`. Blueprints are ``.csv`` or ``.xlsx`` files created in the ``blueprints`` subdirectory of your DF folder. The map area to turn into a blueprint is either -selected interactively with the ``blueprint gui`` command or, if the GUI is not +selected interactively with the ``gui/blueprint`` command or, if the GUI is not used, starts at the active cursor location and extends right and down for the requested width and height. @@ -27,16 +27,16 @@ Examples -------- ``blueprint gui`` - Runs `gui/blueprint`, the interactive frontend, where all configuration for - a ``blueprint`` command can be set visually and interactively. + Runs `gui/blueprint`, the GUI frontend, where all configuration for a + ``blueprint`` command can be set visually and interactively. ``blueprint 30 40 bedrooms`` Generates blueprints for an area 30 tiles wide by 40 tiles tall, starting from the active cursor on the current z-level. Blueprints are written to ``bedrooms.csv`` in the ``blueprints`` directory. ``blueprint 30 40 bedrooms dig --cursor 108,100,150`` Generates only the ``#dig`` blueprint in the ``bedrooms.csv`` file, and - the start of the blueprint area is set to a specific value instead of using - the in-game cursor position. + the start of the blueprint area is set to a specific coordinate instead of + using the in-game cursor position. Positional parameters --------------------- @@ -66,8 +66,12 @@ phases; just separate them with a space. Generate quickfort ``#dig`` blueprints for digging natural stone. ``carve`` Generate quickfort ``#dig`` blueprints for smoothing and carving. +``construct`` + Generate quickfort ``#build`` blueprints for constructions (e.g. flooring + and walls). ``build`` - Generate quickfort ``#build`` blueprints for constructions and buildings. + Generate quickfort ``#build`` blueprints for buildings (including + furniture). ``place`` Generate quickfort ``#place`` blueprints for placing stockpiles. ``zone`` diff --git a/library/include/TileTypes.h b/library/include/TileTypes.h index 5dbc81d0d..8e5c82cb2 100644 --- a/library/include/TileTypes.h +++ b/library/include/TileTypes.h @@ -116,7 +116,7 @@ namespace DFHack //This is a static string, overwritten with every call! //Support values > 2 even though they should never happen. //Copy string if it will be used. - inline char * getStr() const + inline const char * getStr() const { static char str[16]; diff --git a/plugins/blueprint.cpp b/plugins/blueprint.cpp index 20aa1aa99..3dd912d28 100644 --- a/plugins/blueprint.cpp +++ b/plugins/blueprint.cpp @@ -85,11 +85,12 @@ struct blueprint_options { bool auto_phase = false; // if not autodetecting, which phases to output - bool dig = false; + bool dig = false; bool carve = false; + bool construct = false; bool build = false; bool place = false; - bool zone = false; + bool zone = false; bool query = false; static struct_identity _identity; @@ -110,6 +111,7 @@ static const struct_field_info blueprint_options_fields[] = { { struct_field_info::PRIMITIVE, "auto_phase", offsetof(blueprint_options, auto_phase), &df::identity_traits::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "dig", offsetof(blueprint_options, dig), &df::identity_traits::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "carve", offsetof(blueprint_options, carve), &df::identity_traits::identity, 0, 0 }, + { struct_field_info::PRIMITIVE, "construct", offsetof(blueprint_options, construct), &df::identity_traits::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "build", offsetof(blueprint_options, build), &df::identity_traits::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "place", offsetof(blueprint_options, place), &df::identity_traits::identity, 0, 0 }, { struct_field_info::PRIMITIVE, "zone", offsetof(blueprint_options, zone), &df::identity_traits::identity, 0, 0 }, @@ -332,6 +334,108 @@ static const char * get_tile_carve(const df::coord &pos, const tile_context &tc) return NULL; } +static const char * get_construction_str(df::building *b) { + df::building_constructionst *cons = + virtual_cast(b); + if (!cons) + return "~"; + + switch (cons->type) { + case construction_type::Fortification: return "CF"; + case construction_type::Wall: return "Cw"; + case construction_type::Floor: return "Cf"; + case construction_type::UpStair: return "Cu"; + case construction_type::DownStair: return "Cd"; + case construction_type::UpDownStair: return "Cx"; + case construction_type::Ramp: return "Cr"; + case construction_type::TrackN: return "trackN"; + case construction_type::TrackS: return "trackS"; + case construction_type::TrackE: return "trackE"; + case construction_type::TrackW: return "trackW"; + case construction_type::TrackNS: return "trackNS"; + case construction_type::TrackNE: return "trackNE"; + case construction_type::TrackNW: return "trackNW"; + case construction_type::TrackSE: return "trackSE"; + case construction_type::TrackSW: return "trackSW"; + case construction_type::TrackEW: return "trackEW"; + case construction_type::TrackNSE: return "trackNSE"; + case construction_type::TrackNSW: return "trackNSW"; + case construction_type::TrackNEW: return "trackNEW"; + case construction_type::TrackSEW: return "trackSEW"; + case construction_type::TrackNSEW: return "trackNSEW"; + case construction_type::TrackRampN: return "trackrampN"; + case construction_type::TrackRampS: return "trackrampS"; + case construction_type::TrackRampE: return "trackrampE"; + case construction_type::TrackRampW: return "trackrampW"; + case construction_type::TrackRampNS: return "trackrampNS"; + case construction_type::TrackRampNE: return "trackrampNE"; + case construction_type::TrackRampNW: return "trackrampNW"; + case construction_type::TrackRampSE: return "trackrampSE"; + case construction_type::TrackRampSW: return "trackrampSW"; + case construction_type::TrackRampEW: return "trackrampEW"; + case construction_type::TrackRampNSE: return "trackrampNSE"; + case construction_type::TrackRampNSW: return "trackrampNSW"; + case construction_type::TrackRampNEW: return "trackrampNEW"; + case construction_type::TrackRampSEW: return "trackrampSEW"; + case construction_type::TrackRampNSEW: return "trackrampNSEW"; + case construction_type::NONE: + default: + return "~"; + } +} + +static const char * get_constructed_track_str(df::tiletype *tt, + const char * base) { + TileDirection dir = tileDirection(*tt); + if (!dir.whole) + return "~"; + + std::ostringstream str; + str << base; + if (dir.north) str << "N"; + if (dir.south) str << "S"; + if (dir.east) str << "E"; + if (dir.west) str << "W"; + + return cache(str); +} + +static const char * get_constructed_floor_str(df::tiletype *tt) { + if (tileSpecial(*tt) != df::tiletype_special::TRACK) + return "Cf"; + return get_constructed_track_str(tt, "track"); +} + +static const char * get_constructed_ramp_str(df::tiletype *tt) { + if (tileSpecial(*tt) != df::tiletype_special::TRACK) + return "Cr"; + return get_constructed_track_str(tt, "trackramp"); +} + +static const char * get_tile_construct(const df::coord &pos, + const tile_context &ctx) { + if (ctx.b && ctx.b->getType() == building_type::Construction) + return get_construction_str(ctx.b); + + df::tiletype *tt = Maps::getTileType(pos); + if (!tt || tileMaterial(*tt) != df::tiletype_material::CONSTRUCTION) + return NULL; + + switch (tileShape(*tt)) { + case tiletype_shape::WALL: return "Cw"; + case tiletype_shape::FLOOR: return get_constructed_floor_str(tt); + case tiletype_shape::RAMP: return get_constructed_ramp_str(tt); + case tiletype_shape::FORTIFICATION: return "CF"; + case tiletype_shape::STAIR_UP: return "Cu"; + case tiletype_shape::STAIR_DOWN: return "Cd"; + case tiletype_shape::STAIR_UPDOWN: return "Cx"; + default: + return "~"; + } + + return NULL; +} + static pair get_building_size(const df::building *b) { return pair(b->x2 - b->x1 + 1, b->y2 - b->y1 + 1); } @@ -461,56 +565,6 @@ static const char * get_furnace_str(df::building *b) { } } -static const char * get_construction_str(df::building *b) { - df::building_constructionst *cons = - virtual_cast(b); - if (!cons) - return "~"; - - switch (cons->type) { - case construction_type::Fortification: return "CF"; - case construction_type::Wall: return "Cw"; - case construction_type::Floor: return "Cf"; - case construction_type::UpStair: return "Cu"; - case construction_type::DownStair: return "Cd"; - case construction_type::UpDownStair: return "Cx"; - case construction_type::Ramp: return "Cr"; - case construction_type::TrackN: return "trackN"; - case construction_type::TrackS: return "trackS"; - case construction_type::TrackE: return "trackE"; - case construction_type::TrackW: return "trackW"; - case construction_type::TrackNS: return "trackNS"; - case construction_type::TrackNE: return "trackNE"; - case construction_type::TrackNW: return "trackNW"; - case construction_type::TrackSE: return "trackSE"; - case construction_type::TrackSW: return "trackSW"; - case construction_type::TrackEW: return "trackEW"; - case construction_type::TrackNSE: return "trackNSE"; - case construction_type::TrackNSW: return "trackNSW"; - case construction_type::TrackNEW: return "trackNEW"; - case construction_type::TrackSEW: return "trackSEW"; - case construction_type::TrackNSEW: return "trackNSEW"; - case construction_type::TrackRampN: return "trackrampN"; - case construction_type::TrackRampS: return "trackrampS"; - case construction_type::TrackRampE: return "trackrampE"; - case construction_type::TrackRampW: return "trackrampW"; - case construction_type::TrackRampNS: return "trackrampNS"; - case construction_type::TrackRampNE: return "trackrampNE"; - case construction_type::TrackRampNW: return "trackrampNW"; - case construction_type::TrackRampSE: return "trackrampSE"; - case construction_type::TrackRampSW: return "trackrampSW"; - case construction_type::TrackRampEW: return "trackrampEW"; - case construction_type::TrackRampNSE: return "trackrampNSE"; - case construction_type::TrackRampNSW: return "trackrampNSW"; - case construction_type::TrackRampNEW: return "trackrampNEW"; - case construction_type::TrackRampSEW: return "trackrampSEW"; - case construction_type::TrackRampNSEW: return "trackrampNSEW"; - case construction_type::NONE: - default: - return "~"; - } -} - static const char * get_trap_str(df::building *b) { df::building_trapst *trap = virtual_cast(b); if (!trap) @@ -622,6 +676,7 @@ static const char * get_build_keys(const df::coord &pos, bool at_center = static_cast(pos.x) == ctx.b->centerx && static_cast(pos.y) == ctx.b->centery; + // building_type::Construction is handled by the construction phase switch(ctx.b->getType()) { case building_type::Armorstand: return "a"; @@ -666,8 +721,6 @@ static const char * get_build_keys(const df::coord &pos, return "y"; case building_type::WindowGem: return "Y"; - case building_type::Construction: - return get_construction_str(ctx.b); case building_type::Shop: return do_block_building(ctx, "z", at_center); case building_type::AnimalTrap: @@ -1132,6 +1185,8 @@ static bool do_transform(color_ostream &out, smooth_get_tile_fn); add_processor(processors, opts, "dig", "carve", opts.carve, opts.engrave ? get_tile_carve : get_tile_carve_minimal); + add_processor(processors, opts, "build", "construct", opts.construct, + get_tile_construct, ensure_building); add_processor(processors, opts, "build", "build", opts.build, get_tile_build, ensure_building); add_processor(processors, opts, "place", "place", opts.place, diff --git a/plugins/lua/blueprint.lua b/plugins/lua/blueprint.lua index 5c73be7c0..564962448 100644 --- a/plugins/lua/blueprint.lua +++ b/plugins/lua/blueprint.lua @@ -6,6 +6,7 @@ local utils = require('utils') local valid_phase_list = { 'dig', 'carve', + 'construct', 'build', 'place', 'zone', diff --git a/test/quickfort/ecosystem.lua b/test/quickfort/ecosystem.lua index d55bc2389..b59b8909d 100644 --- a/test/quickfort/ecosystem.lua +++ b/test/quickfort/ecosystem.lua @@ -327,6 +327,7 @@ function test.end_to_end() do_dig_phase(phases.dig, area, spec) if phases.smooth then do_dig_phase(phases.smooth, area, spec) end if phases.carve then do_dig_phase(phases.carve, area, spec) end + if phases.construct then do_phase(phases.construct, area, spec) end if phases.build then do_phase(phases.build, area, spec) end if phases.place then do_phase(phases.place, area, spec) end if phases.zone then do_phase(phases.zone, area, spec) end