MCPcopy Create free account
hub / github.com/DFHack/dfhack / render

Method render

plugins/manipulator.cpp:1075–1112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073 }
1074 }
1075 void render()
1076 {
1077 dfhack_viewscreen::render();
1078 Screen::clear();
1079 int x = 2, y = 2;
1080 Screen::drawBorder(" Dwarf Manipulator - Custom Profession ");
1081 if (!manager.templates.size())
1082 {
1083 OutputString(COLOR_LIGHTRED, x, y, "No saved professions");
1084 return;
1085 }
1086 if (selection_empty)
1087 {
1088 OutputString(COLOR_LIGHTRED, x, y, "No dwarves selected!");
1089 return;
1090 }
1091 menu_options.display(true);
1092 OutputString(COLOR_LIGHTGREEN, x, y, itos(units.size()));
1093 OutputString(COLOR_GREY, x, y, string(" ") + (units.size() > 1 ? "dwarves" : "dwarf") + " selected: ");
1094 size_t max_x = gps->dimx - 2;
1095 size_t i = 0;
1096 for ( ; i < units.size(); i++)
1097 {
1098 string name = unit_ops::get_nickname(units[i]);
1099 if (name.size() + x + 12 >= max_x) // 12 = "and xxx more"
1100 break;
1101 OutputString(COLOR_WHITE, x, y, name + ", ");
1102 }
1103 if (i == units.size())
1104 {
1105 x -= 2;
1106 OutputString(COLOR_WHITE, x, y, " ");
1107 }
1108 else
1109 {
1110 OutputString(COLOR_GREY, x, y, "and " + itos(units.size() - i) + " more");
1111 }
1112 }
1113protected:
1114 bool selection_empty;
1115 ListColumn<size_t> menu_options;

Callers

nothing calls this directly

Calls 6

OutputStringFunction · 0.85
itosFunction · 0.85
get_nicknameFunction · 0.85
displayMethod · 0.80
clearFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected