Skip to content

Commit

Permalink
Add Unit size info to remotefortressreader.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Japa committed Nov 8, 2015
1 parent ea38404 commit 4db05cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions plugins/proto/RemoteFortressReader.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
9 changes: 8 additions & 1 deletion plugins/remotefortressreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit 4db05cc

Please sign in to comment.