Better fix for building protobufs with C++0x turned on.

develop
Mike Stewart 2012-01-20 16:21:50 -08:00
parent f02f4510dd
commit df08914549
2 changed files with 34 additions and 34 deletions

@ -910,7 +910,7 @@ bool CommandLineInterface::InterpretArgument(const string& name,
cerr << disk_path << ": warning: directory does not exist." << endl; cerr << disk_path << ": warning: directory does not exist." << endl;
} }
proto_path_.push_back(make_pair<string, string>(virtual_path.c_str(), disk_path.c_str())); proto_path_.push_back(pair<string, string>(virtual_path, disk_path));
} }
} else if (name == "-o" || name == "--descriptor_set_out") { } else if (name == "-o" || name == "--descriptor_set_out") {

@ -45,13 +45,13 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
return CR_OK; return CR_OK;
} }
} }
std::string filename; std::string filename;
if (parameters.size() < 1) if (parameters.size() < 1)
{ {
c->con.printerr("Please supply a filename.\n"); c->con.printerr("Please supply a filename.\n");
return CR_OK; return CR_OK;
} }
filename = parameters[0]; filename = parameters[0];
bool showHidden = true; bool showHidden = true;
@ -84,10 +84,10 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
c->con.printerr("Unable to read vegetation; plants won't be listed!\n" ); c->con.printerr("Unable to read vegetation; plants won't be listed!\n" );
} }
dfproto::Map protomap; dfproto::Map protomap;
protomap.set_x_size(x_max); protomap.set_x_size(x_max);
protomap.set_y_size(y_max); protomap.set_y_size(y_max);
protomap.set_z_size(z_max); protomap.set_z_size(z_max);
DFHack::t_feature blockFeatureGlobal; DFHack::t_feature blockFeatureGlobal;
DFHack::t_feature blockFeatureLocal; DFHack::t_feature blockFeatureLocal;
@ -106,10 +106,10 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
continue; continue;
} }
dfproto::Block *protoblock = protomap.add_block(); dfproto::Block *protoblock = protomap.add_block();
protoblock->set_x(b_x); protoblock->set_x(b_x);
protoblock->set_y(b_y); protoblock->set_y(b_y);
protoblock->set_z(z); protoblock->set_z(z);
{ // Find features { // Find features
uint32_t index = b->raw.global_feature; uint32_t index = b->raw.global_feature;
@ -138,9 +138,9 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
continue; continue;
} }
dfproto::Tile *prototile = protoblock->add_tile(); dfproto::Tile *prototile = protoblock->add_tile();
prototile->set_x(x); prototile->set_x(x);
prototile->set_y(y); prototile->set_y(y);
// Check for liquid // Check for liquid
if (des.bits.flow_size) if (des.bits.flow_size)
@ -152,7 +152,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
uint16_t type = b->TileTypeAt(coord); uint16_t type = b->TileTypeAt(coord);
const DFHack::TileRow *info = DFHack::getTileRow(type); const DFHack::TileRow *info = DFHack::getTileRow(type);
prototile->set_type((dfproto::Tile::TileType)info->shape); prototile->set_type((dfproto::Tile::TileType)info->shape);
/*switch (info->shape) /*switch (info->shape)
{ {
case DFHack::WALL: case DFHack::WALL:
@ -170,20 +170,20 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
} // block y } // block y
} // z } // z
std::ofstream output(filename, std::ios::out | std::ios::trunc | std::ios::binary); std::ofstream output(filename, std::ios::out | std::ios::trunc | std::ios::binary);
if (!output.is_open()) if (!output.is_open())
{ {
c->con.printerr("Couldn't open the output file.\n"); c->con.printerr("Couldn't open the output file.\n");
c->Resume(); c->Resume();
return CR_FAILURE; return CR_FAILURE;
} }
if (!protomap.SerializeToOstream(&output)) if (!protomap.SerializeToOstream(&output))
{ {
c->con.printerr("Failed to save map file.\n"); c->con.printerr("Failed to save map file.\n");
c->Resume(); c->Resume();
return CR_FAILURE; return CR_FAILURE;
} }
c->con.print("Map succesfully exported.\n"); c->con.print("Map succesfully exported.\n");
c->Resume(); c->Resume();
return CR_OK; return CR_OK;
} }