Send shape ids through RFR

develop
Japa 2018-01-06 23:48:06 +05:30
parent bd8a6c31ba
commit d0a924a207
2 changed files with 34 additions and 0 deletions

@ -275,6 +275,7 @@ message Item
optional float velocity_x = 13;
optional float velocity_y = 14;
optional float velocity_z = 15;
optional int32 shape = 16;
}
message MapBlock
@ -875,3 +876,13 @@ message Status
{
repeated Report reports = 1;
}
message ShapeDescriptior
{
optional string id = 1;
}
message Language
{
repeated ShapeDescriptior shapes = 1;
}

@ -37,6 +37,7 @@
#include "df/block_square_event_item_spatterst.h"
#include "df/block_square_event_grassst.h"
#endif
#include "df/art_image_element_shapest.h"
#include "df/block_square_event_material_spatterst.h"
#include "df/body_appearance_modifier.h"
#include "df/body_part_layer_raw.h"
@ -61,6 +62,7 @@
#include "df/historical_figure.h"
#include "df/item.h"
#include "df/item_constructed.h"
#include "df/item_gemst.h"
#include "df/item_threadst.h"
#include "df/item_toolst.h"
#include "df/itemimprovement.h"
@ -168,6 +170,7 @@ static command_result GetPauseState(color_ostream & stream, const EmptyMessage *
static command_result GetVersionInfo(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::VersionInfo * out);
void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem);
static command_result GetReports(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::Status * out);
static command_result GetLanguage(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::Language * out);
void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock, MapExtras::MapCache * MC, DFCoord pos);
@ -299,6 +302,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("MenuQuery", MenuQuery, SF_ALLOW_REMOTE);
svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
svc->addFunction("MiscMoveCommand", MiscMoveCommand, SF_ALLOW_REMOTE);
svc->addFunction("GetLanguage", GetLanguage, SF_ALLOW_REMOTE);
return svc;
}
@ -1420,6 +1424,11 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
if (actual_item)
{
NetItem->set_stack_size(actual_item->stack_size);
}
VIRTUAL_CAST_VAR(gem_item, df::item_gemst, DfItem);
if (gem_item)
{
}
VIRTUAL_CAST_VAR(constructed_item, df::item_constructed, DfItem);
if (constructed_item)
@ -2999,3 +3008,17 @@ static command_result GetReports(color_ostream & stream, const EmptyMessage * in
}
return CR_OK;
}
static command_result GetLanguage(color_ostream & stream, const EmptyMessage * in, RemoteFortressReader::Language * out)
{
if (!world)
return CR_FAILURE;
for (int i = 0; i < world->raws.language.shapes.size(); i++)
{
auto shape = world->raws.language.shapes[i];
auto netShape = out->add_shapes();
netShape->set_id(shape->id);
}
return CR_OK;
}