Added world names.

develop
Japa 2014-12-31 17:50:43 +05:30
parent bc58b0a822
commit c373e57c02
2 changed files with 35 additions and 2 deletions

@ -108,6 +108,9 @@ message MapBlock
required int32 map_z = 3;
repeated int32 tiles = 4;
repeated MatPair materials = 5;
repeated MatPair layer_materials = 6;
repeated MatPair vein_materials = 7;
repeated MatPair base_materials = 8;
}
message MatPair {
@ -194,4 +197,10 @@ message MapInfo
optional int32 block_size_x = 1;
optional int32 block_size_y = 2;
optional int32 block_size_z = 3;
optional int32 block_pos_x = 4;
optional int32 block_pos_y = 5;
optional int32 block_pos_z = 6;
optional string world_name = 7;
optional string world_name_english = 8;
optional string save_name = 9;
}

@ -45,7 +45,9 @@
#include "modules/MapCache.h"
#include "modules/Materials.h"
#include "modules/Gui.h"
#include "modules/Translation.h"
#include "TileTypes.h"
#include "MiscUtils.h"
#include <vector>
#include <time.h>
@ -566,9 +568,23 @@ void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBloc
{
df::tiletype tile = DfBlock->tiletype[xx][yy];
NetBlock->add_tiles(tile);
df::coord2d p = df::coord2d(xx, yy);
t_matpair layerMat = block->layerMaterialAt(p);
t_matpair veinMat = block->veinMaterialAt(p);
t_matpair baseMat = block->baseMaterialAt(p);
t_matpair staticMat = block->staticMaterialAt(p);
RemoteFortressReader::MatPair * material = NetBlock->add_materials();
material->set_mat_type(block->staticMaterialAt(df::coord2d(xx, yy)).mat_type);
material->set_mat_index(block->staticMaterialAt(df::coord2d(xx, yy)).mat_index);
material->set_mat_type(staticMat.mat_type);
material->set_mat_index(staticMat.mat_index);
RemoteFortressReader::MatPair * layerMaterial = NetBlock->add_layer_materials();
layerMaterial->set_mat_type(layerMat.mat_type);
layerMaterial->set_mat_index(layerMat.mat_index);
RemoteFortressReader::MatPair * veinMaterial = NetBlock->add_vein_materials();
veinMaterial->set_mat_type(veinMat.mat_type);
veinMaterial->set_mat_index(veinMat.mat_index);
RemoteFortressReader::MatPair * baseMaterial = NetBlock->add_base_materials();
baseMaterial->set_mat_type(baseMat.mat_type);
baseMaterial->set_mat_index(baseMat.mat_index);
}
}
}
@ -701,9 +717,17 @@ static command_result GetViewInfo(color_ostream &stream, const EmptyMessage *in,
static command_result GetMapInfo(color_ostream &stream, const EmptyMessage *in, MapInfo *out)
{
uint32_t size_x, size_y, size_z;
int32_t pos_x, pos_y, pos_z;
Maps::getSize(size_x, size_y, size_z);
Maps::getPosition(pos_x, pos_y, pos_z);
out->set_block_size_x(size_x);
out->set_block_size_y(size_y);
out->set_block_size_z(size_z);
out->set_block_pos_x(pos_x);
out->set_block_pos_y(pos_y);
out->set_block_pos_z(pos_z);
out->set_world_name(DF2UTF(Translation::TranslateName(&df::global::world->world_data->name, false)));
out->set_world_name_english(DF2UTF(Translation::TranslateName(&df::global::world->world_data->name, true)));
out->set_save_name(df::global::world->cur_savegame.save_dir);
return CR_OK;
}