Fixed material output -- material_type and material_index were being used backwards.

develop
Mike Stewart 2012-02-12 18:39:43 -08:00
parent e39852ff2e
commit 1b3d517a61
3 changed files with 16 additions and 16 deletions

@ -119,14 +119,14 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
for (size_t i = 0; i < world->raws.inorganics.size(); i++)
{
dfproto::Material *protomaterial = protomap.add_inorganic_material();
protomaterial->set_type(i);
protomaterial->set_index(i);
protomaterial->set_name(world->raws.inorganics[i]->id);
}
for (size_t i = 0; i < world->raws.plants.all.size(); i++)
{
dfproto::Material *protomaterial = protomap.add_organic_material();
protomaterial->set_type(i);
protomaterial->set_index(i);
protomaterial->set_name(world->raws.plants.all[i]->id);
}
@ -210,7 +210,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
const DFHack::TileRow *info = DFHack::getTileRow(type);
prototile->set_type((dfproto::Tile::TileType)info->shape);
prototile->set_material_type((dfproto::Tile::MaterialType)info->material);
prototile->set_tile_material((dfproto::Tile::TileMaterialType)info->material);
df::coord map_pos = df::coord(b_x*16+x,b_y*16+y,z);
@ -218,12 +218,12 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
{
case DFHack::SOIL:
case DFHack::STONE:
prototile->set_material_index(0);
prototile->set_material(b->baseMaterialAt(coord));
prototile->set_material_type(0);
prototile->set_material_index(b->baseMaterialAt(coord));
break;
case DFHack::VEIN:
prototile->set_material_index(0);
prototile->set_material(b->veinMaterialAt(coord));
prototile->set_material_type(0);
prototile->set_material_index(b->veinMaterialAt(coord));
break;
case DFHack::FEATSTONE:
if (blockFeatureLocal.type != -1 && des.bits.feature_local)
@ -231,15 +231,15 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
if (blockFeatureLocal.type == df::feature_type::deep_special_tube
&& blockFeatureLocal.main_material == 0) // stone
{
prototile->set_material_index(0);
prototile->set_material(blockFeatureLocal.sub_material);
prototile->set_material_type(0);
prototile->set_material_index(blockFeatureLocal.sub_material);
}
if (blockFeatureGlobal.type != -1 && des.bits.feature_global
&& blockFeatureGlobal.type == df::feature_type::feature_underworld_from_layer
&& blockFeatureGlobal.main_material == 0) // stone
{
prototile->set_material_index(0);
prototile->set_material(blockFeatureGlobal.sub_material);
prototile->set_material_type(0);
prototile->set_material_index(blockFeatureGlobal.sub_material);
}
}
break;
@ -247,7 +247,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
if (constructionMaterials.find(map_pos) != constructionMaterials.end())
{
prototile->set_material_index(constructionMaterials[map_pos].first);
prototile->set_material(constructionMaterials[map_pos].second);
prototile->set_material_type(constructionMaterials[map_pos].second);
}
break;
}

@ -3,6 +3,6 @@ option optimize_for = LITE_RUNTIME;
message Material
{
required uint32 type = 1;
required uint32 index= 1;
required string name = 2;
}

@ -34,7 +34,7 @@ message Tile
WATER = 0;
MAGMA = 1;
}
enum MaterialType
enum TileMaterialType
{
AIR = 0;
SOIL = 1;
@ -59,9 +59,9 @@ message Tile
required uint32 x = 1;
required uint32 y = 2;
required TileType type = 3;
optional MaterialType material_type = 4;
optional TileMaterialType tile_material = 4;
optional uint32 material_index = 5;
optional uint32 material = 6;
optional uint32 material_type = 6;
optional LiquidType liquid_type = 7;
optional uint32 flow_size = 8;
}