Add flows to RFR

develop
Japa Mala Illo 2018-03-03 11:41:58 +05:30
parent 490fbd8b26
commit 3f26d4fe09
2 changed files with 55 additions and 0 deletions

@ -313,6 +313,7 @@ message MapBlock
repeated bool tile_dig_designation_marker = 27;
repeated bool tile_dig_designation_auto = 28;
repeated int32 grass_percent = 29;
repeated FlowInfo flows = 30;
}
message MatPair {
@ -1028,3 +1029,33 @@ enum ArtImageVerb
VERB_BEINGMUTILATED = 46;
VERB_TRIUMPHANTPOSE = 47;
}
enum FlowType
{
Miasma = 0;
Steam = 1;
Mist = 2;
MaterialDust = 3;
MagmaMist = 4;
Smoke = 5;
Dragonfire = 6;
Fire = 7;
Web = 8;
MaterialGas = 9;
MaterialVapor = 10;
OceanWave = 11;
SeaFoam = 12;
ItemCloud = 13;
}
message FlowInfo
{
optional int32 index = 1;
optional FlowType type = 2;
optional int32 density = 3;
optional Coord pos = 4;
optional Coord dest = 5;
optional bool expanding = 6;
optional bool reuse = 7;
optional int32 guide_id = 8;
}

@ -58,6 +58,7 @@
#include "df/dfhack_material_category.h"
#include "df/enabler.h"
#include "df/engraving.h"
#include "df/flow_info.h"
#include "df/graphic.h"
#include "df/historical_figure.h"
@ -1395,6 +1396,29 @@ void CopyItems(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBloc
}
}
void CopyFlow(df::flow_info * localFlow, RemoteFortressReader::FlowInfo * netFlow, int index)
{
//There's no consistent ID to use, so we just use the pointer.
netFlow->set_index((int)localFlow);
netFlow->set_type((FlowType)localFlow->type);
netFlow->set_density(localFlow->density);
ConvertDFCoord(localFlow->pos, netFlow->mutable_pos());
ConvertDFCoord(localFlow->dest, netFlow->mutable_dest());
netFlow->set_expanding(localFlow->expanding);
netFlow->set_reuse(localFlow->reuse);
netFlow->set_guide_id(localFlow->guide_id);
}
void CopyFlows(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock)
{
NetBlock->set_map_x(DfBlock->map_pos.x);
NetBlock->set_map_y(DfBlock->map_pos.y);
NetBlock->set_map_z(DfBlock->map_pos.z);
for (int i = 0; i < DfBlock->flows.size(); i++)
{
CopyFlow(DfBlock->flows[i], NetBlock->add_flows(), i);
}
}
static command_result GetBlockList(color_ostream &stream, const BlockRequest *in, BlockList *out)
{