Add unit_misc_trait list to BasicUnitInfo protobuf API.

develop
Will Rogers 2012-04-10 20:42:23 -04:00
parent 6cf8220f28
commit 8c40a27ea0
2 changed files with 23 additions and 0 deletions

@ -61,6 +61,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "df/world.h"
#include "df/world_data.h"
#include "df/unit.h"
#include "df/unit_misc_trait.h"
#include "df/unit_soul.h"
#include "df/unit_skill.h"
#include "df/material.h"
@ -316,6 +317,19 @@ void DFHack::describeUnit(BasicUnitInfo *info, df::unit *unit,
}
}
if (mask && mask->misc_traits())
{
auto &vec = unit -> status.misc_traits;
for (size_t i = 0; i < vec.size(); i++)
{
auto trait = vec[i];
auto item = info->add_misc_traits();
item->set_id(trait->id);
item->set_value(trait->value);
}
}
if (unit->curse.add_tags1.whole ||
unit->curse.add_tags2.whole ||
unit->curse.rem_tags1.whole ||

@ -130,6 +130,11 @@ message SkillInfo {
required int32 experience = 3;
};
message UnitMiscTrait {
required int32 id = 1;
required int32 value = 2;
};
message BasicUnitInfo {
required int32 unit_id = 1;
@ -166,6 +171,9 @@ message BasicUnitInfo {
// IF mask.skills:
repeated SkillInfo skills = 12;
// IF mask.misc_traits:
repeated UnitMiscTrait misc_traits = 24;
optional UnitCurseInfo curse = 16;
repeated int32 burrows = 21;
@ -175,6 +183,7 @@ message BasicUnitInfoMask {
optional bool labors = 1 [default = false];
optional bool skills = 2 [default = false];
optional bool profession = 3 [default = false];
optional bool misc_traits = 4 [default = false];
};
message BasicSquadInfo {