| 1270 | } |
| 1271 | |
| 1272 | void viewscreen_unitlaborsst::refreshNames() |
| 1273 | { |
| 1274 | do_refresh_names = false; |
| 1275 | |
| 1276 | for (size_t i = 0; i < units.size(); i++) |
| 1277 | { |
| 1278 | UnitInfo *cur = units[i]; |
| 1279 | df::unit *unit = cur->unit; |
| 1280 | |
| 1281 | cur->name = Translation::TranslateName(Units::getVisibleName(unit), false); |
| 1282 | cur->transname = Translation::TranslateName(Units::getVisibleName(unit), true); |
| 1283 | cur->profession = Units::getProfessionName(unit); |
| 1284 | cur->goal = Units::getGoalName(unit); |
| 1285 | df::goal_type goal = Units::getGoalType(unit); |
| 1286 | if (goal == df::goal_type::START_A_FAMILY) { |
| 1287 | cur->goal_gender = unit->sex; |
| 1288 | } else { |
| 1289 | cur->goal_gender = df::pronoun_type::it; |
| 1290 | } |
| 1291 | cur->achieved_goal = Units::isGoalAchieved(unit); |
| 1292 | |
| 1293 | if (unit->job.current_job == NULL) { |
| 1294 | df::activity_event *event = Units::getMainSocialEvent(unit); |
| 1295 | if (event) { |
| 1296 | event->getName(unit->id, &cur->job_desc); |
| 1297 | cur->job_mode = UnitInfo::SOCIAL; |
| 1298 | } |
| 1299 | else { |
| 1300 | cur->job_desc = "Idle"; |
| 1301 | cur->job_mode = UnitInfo::IDLE; |
| 1302 | } |
| 1303 | } else { |
| 1304 | cur->job_desc = DFHack::Job::getName(unit->job.current_job); |
| 1305 | cur->job_mode = UnitInfo::JOB; |
| 1306 | } |
| 1307 | if (unit->military.squad_id > -1) { |
| 1308 | cur->squad_effective_name = Military::getSquadName(unit->military.squad_id); |
| 1309 | cur->squad_info = stl_sprintf("%i", unit->military.squad_position + 1) + "." + cur->squad_effective_name; |
| 1310 | } else { |
| 1311 | cur->squad_effective_name = ""; |
| 1312 | cur->squad_info = ""; |
| 1313 | } |
| 1314 | } |
| 1315 | calcSize(); |
| 1316 | } |
| 1317 | |
| 1318 | void viewscreen_unitlaborsst::calcSize() |
| 1319 | { |
nothing calls this directly
no test coverage detected