|
|
@ -95,14 +95,6 @@ struct SkillColumn
|
|
|
|
df::job_skill skill; // displayed rating
|
|
|
|
df::job_skill skill; // displayed rating
|
|
|
|
char label[3]; // column header
|
|
|
|
char label[3]; // column header
|
|
|
|
bool special; // specified labor is mutually exclusive with all other special labors
|
|
|
|
bool special; // specified labor is mutually exclusive with all other special labors
|
|
|
|
bool isValidLabor (df::historical_entity *entity = NULL) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (labor == unit_labor::NONE)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (entity && entity->entity_raw && !entity->entity_raw->jobs.permitted_labor[labor])
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define NUM_COLUMNS (sizeof(columns) / sizeof(SkillColumn))
|
|
|
|
#define NUM_COLUMNS (sizeof(columns) / sizeof(SkillColumn))
|
|
|
@ -1631,9 +1623,10 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UnitInfo *cur = units[input_row];
|
|
|
|
UnitInfo *cur = units[input_row];
|
|
|
|
if (events->count(interface_key::SELECT) && (cur->allowEdit) && columns[input_column].isValidLabor(ui->main.fortress_entity))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
df::unit *unit = cur->unit;
|
|
|
|
df::unit *unit = cur->unit;
|
|
|
|
|
|
|
|
df::unit_labor cur_labor = columns[input_column].labor;
|
|
|
|
|
|
|
|
if (events->count(interface_key::SELECT) && (cur->allowEdit) && Units::isValidLabor(unit, cur_labor))
|
|
|
|
|
|
|
|
{
|
|
|
|
const SkillColumn &col = columns[input_column];
|
|
|
|
const SkillColumn &col = columns[input_column];
|
|
|
|
bool newstatus = !unit->status.labors[col.labor];
|
|
|
|
bool newstatus = !unit->status.labors[col.labor];
|
|
|
|
if (col.special)
|
|
|
|
if (col.special)
|
|
|
@ -1650,16 +1643,15 @@ void viewscreen_unitlaborsst::feed(set<df::interface_key> *events)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unit->status.labors[col.labor] = newstatus;
|
|
|
|
unit->status.labors[col.labor] = newstatus;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (events->count(interface_key::SELECT_ALL) && (cur->allowEdit) && columns[input_column].isValidLabor(ui->main.fortress_entity))
|
|
|
|
if (events->count(interface_key::SELECT_ALL) && (cur->allowEdit) && Units::isValidLabor(unit, cur_labor))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
df::unit *unit = cur->unit;
|
|
|
|
|
|
|
|
const SkillColumn &col = columns[input_column];
|
|
|
|
const SkillColumn &col = columns[input_column];
|
|
|
|
bool newstatus = !unit->status.labors[col.labor];
|
|
|
|
bool newstatus = !unit->status.labors[col.labor];
|
|
|
|
for (int i = 0; i < NUM_COLUMNS; i++)
|
|
|
|
for (int i = 0; i < NUM_COLUMNS; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (columns[i].group != col.group)
|
|
|
|
if (columns[i].group != col.group)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
if (!columns[i].isValidLabor(ui->main.fortress_entity))
|
|
|
|
if (!Units::isValidLabor(unit, columns[i].labor))
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
if (columns[i].special)
|
|
|
|
if (columns[i].special)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2055,7 +2047,7 @@ void viewscreen_unitlaborsst::render()
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
canToggle = (cur->allowEdit) && columns[sel_column].isValidLabor(ui->main.fortress_entity);
|
|
|
|
canToggle = (cur->allowEdit) && Units::isValidLabor(unit, columns[sel_column].labor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int x = 2, y = dim.y - 4;
|
|
|
|
int x = 2, y = dim.y - 4;
|
|
|
|