Add Unit size info to remotefortressreader.cpp

develop
Japa 2015-11-08 13:05:25 +05:30
parent ea38404727
commit 4db05cc8eb
2 changed files with 19 additions and 1 deletions

@ -205,6 +205,16 @@ message MaterialList{
repeated MaterialDefinition material_list = 1;
}
message BodySizeInfo
{
optional int32 size_cur = 1;
optional int32 size_base = 2;
optional int32 area_cur = 3; /*!< size_cur^0.666 */
optional int32 area_base = 4; /*!< size_base^0.666 */
optional int32 length_cur = 5; /*!< (size_cur*10000)^0.333 */
optional int32 length_base = 6; /*!< (size_base*10000)^0.333 */
}
message UnitDefinition
{
required int32 id = 1;
@ -218,6 +228,7 @@ message UnitDefinition
optional uint32 flags2 = 9;
optional uint32 flags3 = 10;
optional bool is_soldier = 11;
optional BodySizeInfo size_info = 12;
}
message UnitList

@ -1323,7 +1323,7 @@ static command_result GetUnitList(color_ostream &stream, const EmptyMessage *in,
auto world = df::global::world;
for (int i = 0; i < world->units.all.size(); i++)
{
auto unit = world->units.all[i];
df::unit * unit = world->units.all[i];
auto send_unit = out->add_creature_list();
send_unit->set_id(unit->id);
send_unit->set_pos_x(unit->pos.x);
@ -1336,6 +1336,13 @@ static command_result GetUnitList(color_ostream &stream, const EmptyMessage *in,
send_unit->set_flags2(unit->flags2.whole);
send_unit->set_flags3(unit->flags3.whole);
send_unit->set_is_soldier(ENUM_ATTR(profession, military, unit->profession));
auto size_info = send_unit->mutable_size_info();
size_info->set_size_cur(unit->body.size_info.size_cur);
size_info->set_size_base(unit->body.size_info.size_base);
size_info->set_area_cur(unit->body.size_info.area_cur);
size_info->set_area_base(unit->body.size_info.area_base);
size_info->set_length_cur(unit->body.size_info.length_cur);
size_info->set_length_base(unit->body.size_info.length_base);
}
return CR_OK;
}