Add additional related data to ListJobSkills.

Add the attributes for profession and unit_labor, and (re)name the
protobuf messages JobSkillAttr, ProfessionAttr, and UnitLaborAttr to
better reflect their content and distinguish them from e.g. the
SkillInfo message included in BasicUnitInfo.
develop
Will Rogers 2012-04-04 11:53:47 -04:00
parent 7e896277ec
commit 1b6f5f3f34
3 changed files with 55 additions and 11 deletions

@ -447,18 +447,41 @@ static command_result ListEnums(color_ostream &stream,
static command_result ListJobSkills(color_ostream &stream, const EmptyMessage *, ListJobSkillsOut *out)
{
auto pf = out->mutable_value();
auto pf_skill = out->mutable_skill();
FOR_ENUM_ITEMS(job_skill, skill)
{
auto item = pf->Add();
auto item = pf_skill->Add();
item->set_id(skill);
item->set_key(ENUM_KEY_STR(job_skill, skill));
item->set_caption(ENUM_ATTR_STR(job_skill, caption, skill));
item->set_caption_noun(ENUM_ATTR_STR(job_skill, caption_noun, skill));
item->set_profession(ENUM_ATTR(job_skill, profession, skill));
item->set_labor(ENUM_ATTR(job_skill, labor, skill));
item->set_type(ENUM_ATTR(job_skill, type, skill));
item->set_type(ENUM_KEY_STR(job_skill_class, ENUM_ATTR(job_skill, type, skill)));
}
auto pf_profession = out->mutable_profession();
FOR_ENUM_ITEMS(profession, p)
{
auto item = pf_profession->Add();
item->set_id(p);
item->set_key(ENUM_KEY_STR(profession, p));
item->set_caption(ENUM_ATTR_STR(profession, caption, p));
item->set_military(ENUM_ATTR(profession, military, p));
item->set_can_assign_labor(ENUM_ATTR(profession, can_assign_labor, p));
item->set_parent(ENUM_ATTR(profession, parent, p));
}
auto pf_labor = out->mutable_labor();
FOR_ENUM_ITEMS(unit_labor, labor)
{
auto item = pf_labor->Add();
item->set_id(labor);
item->set_key(ENUM_KEY_STR(unit_labor, labor));
item->set_caption(ENUM_ATTR_STR(unit_labor, caption, labor));
}
return CR_OK;

@ -69,15 +69,34 @@ message BasicMaterialInfoMask {
optional bool reaction = 3 [default = false];
};
message JobSkillInfo {
message JobSkillAttr {
required int32 id = 1;
required string key = 2;
optional string caption = 2;
optional string caption_noun = 3;
optional string caption = 3;
optional string caption_noun = 4;
optional int32 profession = 4;
optional int32 labor = 5;
optional int32 type = 6;
optional int32 profession = 5;
optional int32 labor = 6;
optional string type = 7;
};
message ProfessionAttr {
required int32 id = 1;
required string key = 2;
optional string caption = 3;
optional bool military = 4;
optional bool can_assign_labor = 5;
optional int32 parent = 6;
};
message UnitLaborAttr {
required int32 id = 1;
required string key = 2;
optional string caption = 3;
};
message NameInfo {

@ -53,7 +53,9 @@ message ListEnumsOut {
// RPC ListJobSkills : EmptyMessage -> ListJobSkillsOut
message ListJobSkillsOut {
repeated JobSkillInfo value = 1;
repeated JobSkillAttr skill = 1;
repeated ProfessionAttr profession = 2;
repeated UnitLaborAttr labor = 3;
};
// RPC ListMaterials : ListMaterialsIn -> ListMaterialsOut