diff options
| author | Quietust | 2012-08-22 16:54:34 -0500 |
|---|---|---|
| committer | Quietust | 2012-08-22 16:54:34 -0500 |
| commit | 132491e868df855d7cb53f0dafff6de7801400a8 (patch) | |
| tree | 8632ec1477cda792f5ca0f25ec37b402a262e54d /plugins/manipulator.cpp | |
| parent | 1e28ceff6dd10d78d6261bc9b018f4743e692b10 (diff) | |
| download | dfhack-132491e868df855d7cb53f0dafff6de7801400a8.tar.gz dfhack-132491e868df855d7cb53f0dafff6de7801400a8.tar.bz2 dfhack-132491e868df855d7cb53f0dafff6de7801400a8.tar.xz | |
Use Units module to get unit colors, fix initial scroll position
Diffstat (limited to 'plugins/manipulator.cpp')
| -rw-r--r-- | plugins/manipulator.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp index 48081095..dfc20da0 100644 --- a/plugins/manipulator.cpp +++ b/plugins/manipulator.cpp @@ -369,6 +369,10 @@ void viewscreen_unitlaborsst::calcSize() labors_width--; } + // don't adjust scroll position immediately after the window opened + if (units.size() == 0) + return; + // if the window grows vertically, scroll upward to eliminate blank rows from the bottom if (first_row > units.size() - height) first_row = units.size() - height; @@ -494,9 +498,9 @@ void viewscreen_unitlaborsst::render() if (col_offset >= NUM_COLUMNS) break; - int8_t fg = ENUM_ATTR(profession, color, columns[col_offset].profession), bg = 0; - if (fg == -1) - fg = 3; // teal + int8_t fg = Units::getCasteProfessionColor(ui->race_id, -1, columns[col_offset].profession); + int8_t bg = 0; + if (col_offset == sel_column) { fg = 0; @@ -524,10 +528,7 @@ void viewscreen_unitlaborsst::render() Screen::paintString(Screen::Pen(' ', fg, bg), 1, 3 + row, name); string profession = Units::getProfessionName(unit); - fg = ENUM_ATTR(profession, color, unit->profession); - if (fg == -1) - fg = 3; // TODO: fetch from creature raws - // TODO: check for entity positions and alter profession/color accordingly + fg = Units::getProfessionColor(unit); bg = 0; Screen::paintString(Screen::Pen(' ', fg, bg), 1 + prof_width + 1, 3 + row, profession); |
