Send item cloud info properly.

develop
Japa 2018-03-06 09:44:21 +05:30
parent c765e12254
commit c3f931652d
2 changed files with 19 additions and 0 deletions

@ -1059,4 +1059,5 @@ message FlowInfo
optional bool reuse = 7;
optional int32 guide_id = 8;
optional MatPair material = 9;
optional MatPair item = 10;
}

@ -59,6 +59,8 @@
#include "df/enabler.h"
#include "df/engraving.h"
#include "df/flow_info.h"
#include "df/flow_guide.h"
#include "df/flow_guide_item_cloudst.h"
#include "df/graphic.h"
#include "df/historical_figure.h"
@ -1408,6 +1410,22 @@ void CopyFlow(df::flow_info * localFlow, RemoteFortressReader::FlowInfo * netFlo
auto mat = netFlow->mutable_material();
mat->set_mat_index(localFlow->mat_index);
mat->set_mat_type(localFlow->mat_type);
if (localFlow->guide_id >= 0 && localFlow->type == flow_type::ItemCloud)
{
auto guide = df::flow_guide::find(localFlow->guide_id);
if (guide)
{
VIRTUAL_CAST_VAR(cloud, df::flow_guide_item_cloudst, guide);
if (cloud)
{
mat->set_mat_index(cloud->mattype);
mat->set_mat_type(cloud->mattype);
auto item = netFlow->mutable_item();
item->set_mat_index(cloud->item_subtype);
item->set_mat_type(cloud->item_type);
}
}
}
}
void CopyFlows(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock)