Use Units module to get profession strings

develop
Quietust 2012-08-22 11:15:05 -05:00
parent 83214ccb72
commit 92c0b555dc
1 changed files with 4 additions and 24 deletions

@ -5,6 +5,7 @@
#include <MiscUtils.h> #include <MiscUtils.h>
#include <modules/Screen.h> #include <modules/Screen.h>
#include <modules/Translation.h> #include <modules/Translation.h>
#include <modules/Units.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include <set> #include <set>
@ -522,11 +523,7 @@ void viewscreen_unitlaborsst::render()
name.resize(name_width); name.resize(name_width);
Screen::paintString(Screen::Pen(' ', fg, bg), 1, 3 + row, name); Screen::paintString(Screen::Pen(' ', fg, bg), 1, 3 + row, name);
string profession = unit->custom_profession; string profession = Units::getProfessionName(unit);
if (!profession.length())
profession = ENUM_ATTR_STR(profession, caption, unit->profession);
profession.resize(prof_width);
fg = ENUM_ATTR(profession, color, unit->profession); fg = ENUM_ATTR(profession, color, unit->profession);
if (fg == -1) if (fg == -1)
fg = 3; // TODO: fetch from creature raws fg = 3; // TODO: fetch from creature raws
@ -565,26 +562,9 @@ void viewscreen_unitlaborsst::render()
{ {
string str = Translation::TranslateName(&unit->name, true); string str = Translation::TranslateName(&unit->name, true);
if (str.length()) if (str.length())
{
str += ", "; str += ", ";
if (unit->custom_profession.length()) str += Units::getProfessionName(unit);
str += unit->custom_profession;
else
str += ENUM_ATTR_STR(profession, caption, unit->profession);
str += ":"; str += ":";
}
else
{
if (unit->profession == profession::TRAINED_HUNTER)
str = "Hunting " + Translation::capitalize(world->raws.creatures.all[unit->race]->caste[unit->caste]->caste_name[0]);
else if (unit->profession == profession::TRAINED_WAR)
str = "War " + Translation::capitalize(world->raws.creatures.all[unit->race]->caste[unit->caste]->caste_name[0]);
else if (unit->profession == profession::STANDARD)
str = Translation::capitalize(world->raws.creatures.all[unit->race]->caste[unit->caste]->caste_name[0]);
else
str = Translation::capitalize(world->raws.creatures.all[unit->race]->caste[unit->caste]->caste_name[2]) + " " + ENUM_ATTR_STR(profession, caption, unit->profession);
str += ":";
}
Screen::paintString(Screen::Pen(' ', 15, 0), 1, 3 + height + 2, str); Screen::paintString(Screen::Pen(' ', 15, 0), 1, 3 + height + 2, str);
int y = 1 + str.length() + 1; int y = 1 + str.length() + 1;