@ -1,6 +1,9 @@
//Blueprint
/**
//By cdombroski
* Translates a region of tiles specified by the cursor and arguments / prompts
//Translates a region of tiles specified by the cursor and arguments/prompts into a series of blueprint files suitable for digfort/buildingplan/quickfort
* into a series of blueprint files suitable for replay via quickfort .
*
* Written by cdombroski .
*/
# include <algorithm>
# include <algorithm>
# include <sstream>
# include <sstream>
@ -43,7 +46,7 @@ command_result blueprint(color_ostream &out, vector <string> ¶meters);
DFhackCExport command_result plugin_init ( color_ostream & out , vector < PluginCommand > & commands )
DFhackCExport command_result plugin_init ( color_ostream & out , vector < PluginCommand > & commands )
{
{
commands . push_back ( PluginCommand ( " blueprint " , " Convert map tiles into a blueprint" , blueprint , false ) ) ;
commands . push_back ( PluginCommand ( " blueprint " , " Record the structure of a live game map in a quickfort blueprint" , blueprint , false ) ) ;
return CR_OK ;
return CR_OK ;
}
}
@ -76,10 +79,9 @@ pair<uint32_t, uint32_t> get_building_size(df::building* b)
return pair < uint32_t , uint32_t > ( b - > x2 - b - > x1 + 1 , b - > y2 - b - > y1 + 1 ) ;
return pair < uint32_t , uint32_t > ( b - > x2 - b - > x1 + 1 , b - > y2 - b - > y1 + 1 ) ;
}
}
char get_tile_dig ( MapExtras : : MapCache mc , int32_t x , int32_t y , int32_t z )
char get_tile_dig ( int32_t x , int32_t y , int32_t z )
{
{
df : : tiletype tt = mc . tiletypeAt ( DFCoord ( x , y , z ) ) ;
df : : tiletype_shape ts = tileShape ( * Maps : : getTileType ( x , y , z ) ) ;
df : : tiletype_shape ts = tileShape ( tt ) ;
switch ( ts )
switch ( ts )
{
{
case tiletype_shape : : EMPTY :
case tiletype_shape : : EMPTY :
@ -102,7 +104,6 @@ char get_tile_dig(MapExtras::MapCache mc, int32_t x, int32_t y, int32_t z)
return ' r ' ;
return ' r ' ;
default :
default :
return ' ' ;
return ' ' ;
}
}
}
}
@ -629,7 +630,6 @@ command_result do_transform(DFCoord start, DFCoord end, string name, uint32_t ph
end . z + + ;
end . z + + ;
}
}
MapExtras : : MapCache mc ;
for ( int32_t z = start . z ; z < end . z ; z + + )
for ( int32_t z = start . z ; z < end . z ; z + + )
{
{
for ( int32_t y = start . y ; y < end . y ; y + + )
for ( int32_t y = start . y ; y < end . y ; y + + )
@ -644,7 +644,7 @@ command_result do_transform(DFCoord start, DFCoord end, string name, uint32_t ph
if ( phases & BUILD )
if ( phases & BUILD )
build < < get_tile_build ( x , y , b ) < < ' , ' ;
build < < get_tile_build ( x , y , b ) < < ' , ' ;
if ( phases & DIG )
if ( phases & DIG )
dig < < get_tile_dig ( mc, x, y , z ) < < ' , ' ;
dig < < get_tile_dig ( x, y , z ) < < ' , ' ;
}
}
if ( phases & QUERY )
if ( phases & QUERY )
query < < " # " < < endl ;
query < < " # " < < endl ;