Conflicts:
	plugins/tiletypes.cpp
develop
Petr Mrázek 2011-12-30 02:50:30 +01:00
commit a1e1d7cfce
1 changed files with 35 additions and 2 deletions

@ -63,6 +63,7 @@ struct TileType
DFHack::TileMaterial material;
DFHack::TileSpecial special;
DFHack::TileVariant variant;
int dig;
int hidden;
int light;
int subterranean;
@ -74,6 +75,7 @@ struct TileType
material = DFHack::tilematerial_invalid;
special = DFHack::tilespecial_invalid;
variant = DFHack::tilevariant_invalid;
dig = -1;
hidden = -1;
light = -1;
subterranean = -1;
@ -138,6 +140,19 @@ std::ostream &operator<<(std::ostream &stream, const TileType &paint)
needSpace = true;
}
if (paint.dig >= 0)
{
if (needSpace)
{
stream << " ";
needSpace = false;
}
stream << (paint.dig ? "DESIGNED" : "UNDESIGNED");
used = true;
needSpace = true;
}
if (paint.hidden >= 0)
{
if (needSpace)
@ -300,6 +315,18 @@ bool processTileType(TileType &paint, const std::string &option, const std::stri
std::cout << "Unknown tile variant: " << value << std::endl;
}
}
else if (option == "designed" || option == "d")
{
if (valInt >= -1 && valInt < 2)
{
paint.dig = valInt;
found = true;
}
else
{
std::cout << "Unknown designed flag: " << value << std::endl;
}
}
else if (option == "hidden" || option == "h")
{
if (valInt >= -1 && valInt < 2)
@ -374,6 +401,7 @@ void help( std::ostream & out, const std::string &option)
<< " Material / mat / m: set tile material information" << std::endl
<< " Special / sp: set special tile information" << std::endl
<< " Variant / var / v: set variant tile information" << std::endl
<< " Designed / d: set designed flag" << std::endl
<< " Hidden / h: set hidden flag" << std::endl
<< " Light / l: set light flag" << std::endl
<< " Subterranean / st: set subterranean flag" << std::endl
@ -412,6 +440,11 @@ void help( std::ostream & out, const std::string &option)
out << "Available variants:" << std::endl
<< " ANY, 0 - " << DFHack::VAR_4 << std::endl;
}
else if (option == "designed" || option == "d")
{
out << "Available designed flags:" << std::endl
<< " ANY, 0, 1" << std::endl;
}
else if (option == "hidden" || option == "h")
{
out << "Available hidden flags:" << std::endl
@ -746,11 +779,13 @@ DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameter
for (coord_vec::iterator iter = all_tiles.begin(); iter != all_tiles.end(); ++iter)
{
const DFHack::TileRow *source = DFHack::getTileRow(map.tiletypeAt(*iter));
DFHack::t_designation des = map.designationAt(*iter);
if ((filter.shape > -1 && filter.shape != source->shape)
|| (filter.material > -1 && filter.material != source->material)
|| (filter.special > -1 && filter.special != source->special)
|| (filter.variant > -1 && filter.variant != source->variant)
|| (filter.dig > -1 && (filter.dig != 0) != (des.bits.dig != DFHack::designation_no))
)
{
continue;
@ -812,8 +847,6 @@ DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameter
if(type != -1)
map.setTiletypeAt(*iter, type);
DFHack::t_designation des = map.designationAt(*iter);
if (paint.hidden > -1)
{
des.bits.hidden = paint.hidden;