diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index b6aa90e85..3829ecd6e 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -187,4 +187,11 @@ message ViewInfo optional int32 cursor_pos_x = 6; optional int32 cursor_pos_y = 7; optional int32 cursor_pos_z = 8; +} + +message MapInfo +{ + optional int32 block_size_x = 1; + optional int32 block_size_y = 2; + optional int32 block_size_z = 3; } \ No newline at end of file diff --git a/plugins/remotefortressreader.cpp b/plugins/remotefortressreader.cpp index 0e1771cb7..b458e3501 100644 --- a/plugins/remotefortressreader.cpp +++ b/plugins/remotefortressreader.cpp @@ -70,6 +70,8 @@ static command_result GetPlantList(color_ostream &stream, const BlockRequest *in static command_result CheckHashes(color_ostream &stream, const EmptyMessage *in); static command_result GetUnitList(color_ostream &stream, const EmptyMessage *in, UnitList *out); static command_result GetViewInfo(color_ostream &stream, const EmptyMessage *in, ViewInfo *out); +static command_result GetMapInfo(color_ostream &stream, const EmptyMessage *in, MapInfo *out); + void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock, MapExtras::MapCache * MC); void FindChangedBlocks(); @@ -117,6 +119,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &) svc->addFunction("GetPlantList", GetPlantList); svc->addFunction("GetUnitList", GetUnitList); svc->addFunction("GetViewInfo", GetViewInfo); + svc->addFunction("GetMapInfo", GetMapInfo); return svc; } @@ -564,8 +567,8 @@ void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBloc df::tiletype tile = DfBlock->tiletype[xx][yy]; NetBlock->add_tiles(tile); RemoteFortressReader::MatPair * material = NetBlock->add_materials(); - material->set_mat_type(block->baseMaterialAt(df::coord2d(xx, yy)).mat_index); - material->set_mat_index(block->baseMaterialAt(df::coord2d(xx, yy)).mat_type); + material->set_mat_type(block->baseMaterialAt(df::coord2d(xx, yy)).mat_type); + material->set_mat_index(block->baseMaterialAt(df::coord2d(xx, yy)).mat_index); } } } @@ -689,4 +692,14 @@ static command_result GetViewInfo(color_ostream &stream, const EmptyMessage *in, out->set_cursor_pos_y(y); out->set_cursor_pos_z(z); return CR_OK; +} + +static command_result GetMapInfo(color_ostream &stream, const EmptyMessage *in, MapInfo *out) +{ + uint32_t size_x, size_y, size_z; + Maps::getSize(size_x, size_y, size_z); + out->set_block_size_x(size_x); + out->set_block_size_y(size_y); + out->set_block_size_z(size_z); + return CR_OK; } \ No newline at end of file