@@ -85,11 +85,12 @@ struct blueprint_options {
8585 bool auto_phase = false ;
8686
8787 // if not autodetecting, which phases to output
88- bool dig = false ;
88+ bool dig = false ;
8989 bool carve = false ;
90+ bool construct = false ;
9091 bool build = false ;
9192 bool place = false ;
92- bool zone = false ;
93+ bool zone = false ;
9394 bool query = false ;
9495
9596 static struct_identity _identity;
@@ -110,6 +111,7 @@ static const struct_field_info blueprint_options_fields[] = {
110111 { struct_field_info::PRIMITIVE , " auto_phase" , offsetof (blueprint_options, auto_phase), &df::identity_traits<bool >::identity, 0 , 0 },
111112 { struct_field_info::PRIMITIVE , " dig" , offsetof (blueprint_options, dig), &df::identity_traits<bool >::identity, 0 , 0 },
112113 { struct_field_info::PRIMITIVE , " carve" , offsetof (blueprint_options, carve), &df::identity_traits<bool >::identity, 0 , 0 },
114+ { struct_field_info::PRIMITIVE , " construct" , offsetof (blueprint_options, construct), &df::identity_traits<bool >::identity, 0 , 0 },
113115 { struct_field_info::PRIMITIVE , " build" , offsetof (blueprint_options, build), &df::identity_traits<bool >::identity, 0 , 0 },
114116 { struct_field_info::PRIMITIVE , " place" , offsetof (blueprint_options, place), &df::identity_traits<bool >::identity, 0 , 0 },
115117 { struct_field_info::PRIMITIVE , " zone" , offsetof (blueprint_options, zone), &df::identity_traits<bool >::identity, 0 , 0 },
@@ -332,6 +334,108 @@ static const char * get_tile_carve(const df::coord &pos, const tile_context &tc)
332334 return NULL ;
333335}
334336
337+ static const char * get_construction_str (df::building *b) {
338+ df::building_constructionst *cons =
339+ virtual_cast<df::building_constructionst>(b);
340+ if (!cons)
341+ return " ~" ;
342+
343+ switch (cons->type ) {
344+ case construction_type::Fortification: return " CF" ;
345+ case construction_type::Wall: return " Cw" ;
346+ case construction_type::Floor: return " Cf" ;
347+ case construction_type::UpStair: return " Cu" ;
348+ case construction_type::DownStair: return " Cd" ;
349+ case construction_type::UpDownStair: return " Cx" ;
350+ case construction_type::Ramp: return " Cr" ;
351+ case construction_type::TrackN: return " trackN" ;
352+ case construction_type::TrackS: return " trackS" ;
353+ case construction_type::TrackE: return " trackE" ;
354+ case construction_type::TrackW: return " trackW" ;
355+ case construction_type::TrackNS: return " trackNS" ;
356+ case construction_type::TrackNE: return " trackNE" ;
357+ case construction_type::TrackNW: return " trackNW" ;
358+ case construction_type::TrackSE: return " trackSE" ;
359+ case construction_type::TrackSW: return " trackSW" ;
360+ case construction_type::TrackEW: return " trackEW" ;
361+ case construction_type::TrackNSE: return " trackNSE" ;
362+ case construction_type::TrackNSW: return " trackNSW" ;
363+ case construction_type::TrackNEW: return " trackNEW" ;
364+ case construction_type::TrackSEW: return " trackSEW" ;
365+ case construction_type::TrackNSEW: return " trackNSEW" ;
366+ case construction_type::TrackRampN: return " trackrampN" ;
367+ case construction_type::TrackRampS: return " trackrampS" ;
368+ case construction_type::TrackRampE: return " trackrampE" ;
369+ case construction_type::TrackRampW: return " trackrampW" ;
370+ case construction_type::TrackRampNS: return " trackrampNS" ;
371+ case construction_type::TrackRampNE: return " trackrampNE" ;
372+ case construction_type::TrackRampNW: return " trackrampNW" ;
373+ case construction_type::TrackRampSE: return " trackrampSE" ;
374+ case construction_type::TrackRampSW: return " trackrampSW" ;
375+ case construction_type::TrackRampEW: return " trackrampEW" ;
376+ case construction_type::TrackRampNSE: return " trackrampNSE" ;
377+ case construction_type::TrackRampNSW: return " trackrampNSW" ;
378+ case construction_type::TrackRampNEW: return " trackrampNEW" ;
379+ case construction_type::TrackRampSEW: return " trackrampSEW" ;
380+ case construction_type::TrackRampNSEW: return " trackrampNSEW" ;
381+ case construction_type::NONE :
382+ default :
383+ return " ~" ;
384+ }
385+ }
386+
387+ static const char * get_constructed_track_str (df::tiletype *tt,
388+ const char * base) {
389+ TileDirection dir = tileDirection (*tt);
390+ if (!dir.whole )
391+ return " ~" ;
392+
393+ std::ostringstream str;
394+ str << base;
395+ if (dir.north ) str << " N" ;
396+ if (dir.south ) str << " S" ;
397+ if (dir.east ) str << " E" ;
398+ if (dir.west ) str << " W" ;
399+
400+ return cache (str);
401+ }
402+
403+ static const char * get_constructed_floor_str (df::tiletype *tt) {
404+ if (tileSpecial (*tt) != df::tiletype_special::TRACK )
405+ return " Cf" ;
406+ return get_constructed_track_str (tt, " track" );
407+ }
408+
409+ static const char * get_constructed_ramp_str (df::tiletype *tt) {
410+ if (tileSpecial (*tt) != df::tiletype_special::TRACK )
411+ return " Cr" ;
412+ return get_constructed_track_str (tt, " trackramp" );
413+ }
414+
415+ static const char * get_tile_construct (const df::coord &pos,
416+ const tile_context &ctx) {
417+ if (ctx.b && ctx.b ->getType () == building_type::Construction)
418+ return get_construction_str (ctx.b );
419+
420+ df::tiletype *tt = Maps::getTileType (pos);
421+ if (!tt || tileMaterial (*tt) != df::tiletype_material::CONSTRUCTION )
422+ return NULL ;
423+
424+ switch (tileShape (*tt)) {
425+ case tiletype_shape::WALL : return " Cw" ;
426+ case tiletype_shape::FLOOR : return get_constructed_floor_str (tt);
427+ case tiletype_shape::RAMP : return get_constructed_ramp_str (tt);
428+ case tiletype_shape::FORTIFICATION : return " CF" ;
429+ case tiletype_shape::STAIR_UP : return " Cu" ;
430+ case tiletype_shape::STAIR_DOWN : return " Cd" ;
431+ case tiletype_shape::STAIR_UPDOWN : return " Cx" ;
432+ default :
433+ return " ~" ;
434+ }
435+
436+ return NULL ;
437+ }
438+
335439static pair<uint32_t , uint32_t > get_building_size (const df::building *b) {
336440 return pair<uint32_t , uint32_t >(b->x2 - b->x1 + 1 , b->y2 - b->y1 + 1 );
337441}
@@ -461,56 +565,6 @@ static const char * get_furnace_str(df::building *b) {
461565 }
462566}
463567
464- static const char * get_construction_str (df::building *b) {
465- df::building_constructionst *cons =
466- virtual_cast<df::building_constructionst>(b);
467- if (!cons)
468- return " ~" ;
469-
470- switch (cons->type ) {
471- case construction_type::Fortification: return " CF" ;
472- case construction_type::Wall: return " Cw" ;
473- case construction_type::Floor: return " Cf" ;
474- case construction_type::UpStair: return " Cu" ;
475- case construction_type::DownStair: return " Cd" ;
476- case construction_type::UpDownStair: return " Cx" ;
477- case construction_type::Ramp: return " Cr" ;
478- case construction_type::TrackN: return " trackN" ;
479- case construction_type::TrackS: return " trackS" ;
480- case construction_type::TrackE: return " trackE" ;
481- case construction_type::TrackW: return " trackW" ;
482- case construction_type::TrackNS: return " trackNS" ;
483- case construction_type::TrackNE: return " trackNE" ;
484- case construction_type::TrackNW: return " trackNW" ;
485- case construction_type::TrackSE: return " trackSE" ;
486- case construction_type::TrackSW: return " trackSW" ;
487- case construction_type::TrackEW: return " trackEW" ;
488- case construction_type::TrackNSE: return " trackNSE" ;
489- case construction_type::TrackNSW: return " trackNSW" ;
490- case construction_type::TrackNEW: return " trackNEW" ;
491- case construction_type::TrackSEW: return " trackSEW" ;
492- case construction_type::TrackNSEW: return " trackNSEW" ;
493- case construction_type::TrackRampN: return " trackrampN" ;
494- case construction_type::TrackRampS: return " trackrampS" ;
495- case construction_type::TrackRampE: return " trackrampE" ;
496- case construction_type::TrackRampW: return " trackrampW" ;
497- case construction_type::TrackRampNS: return " trackrampNS" ;
498- case construction_type::TrackRampNE: return " trackrampNE" ;
499- case construction_type::TrackRampNW: return " trackrampNW" ;
500- case construction_type::TrackRampSE: return " trackrampSE" ;
501- case construction_type::TrackRampSW: return " trackrampSW" ;
502- case construction_type::TrackRampEW: return " trackrampEW" ;
503- case construction_type::TrackRampNSE: return " trackrampNSE" ;
504- case construction_type::TrackRampNSW: return " trackrampNSW" ;
505- case construction_type::TrackRampNEW: return " trackrampNEW" ;
506- case construction_type::TrackRampSEW: return " trackrampSEW" ;
507- case construction_type::TrackRampNSEW: return " trackrampNSEW" ;
508- case construction_type::NONE :
509- default :
510- return " ~" ;
511- }
512- }
513-
514568static const char * get_trap_str (df::building *b) {
515569 df::building_trapst *trap = virtual_cast<df::building_trapst>(b);
516570 if (!trap)
@@ -622,6 +676,7 @@ static const char * get_build_keys(const df::coord &pos,
622676 bool at_center = static_cast <int32_t >(pos.x ) == ctx.b ->centerx
623677 && static_cast <int32_t >(pos.y ) == ctx.b ->centery ;
624678
679+ // building_type::Construction is handled by the construction phase
625680 switch (ctx.b ->getType ()) {
626681 case building_type::Armorstand:
627682 return " a" ;
@@ -666,8 +721,6 @@ static const char * get_build_keys(const df::coord &pos,
666721 return " y" ;
667722 case building_type::WindowGem:
668723 return " Y" ;
669- case building_type::Construction:
670- return get_construction_str (ctx.b );
671724 case building_type::Shop:
672725 return do_block_building (ctx, " z" , at_center);
673726 case building_type::AnimalTrap:
@@ -1132,6 +1185,8 @@ static bool do_transform(color_ostream &out,
11321185 smooth_get_tile_fn);
11331186 add_processor (processors, opts, " dig" , " carve" , opts.carve ,
11341187 opts.engrave ? get_tile_carve : get_tile_carve_minimal);
1188+ add_processor (processors, opts, " build" , " construct" , opts.construct ,
1189+ get_tile_construct, ensure_building);
11351190 add_processor (processors, opts, " build" , " build" , opts.build ,
11361191 get_tile_build, ensure_building);
11371192 add_processor (processors, opts, " place" , " place" , opts.place ,
0 commit comments