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

Method populateDwarfColumn

plugins/dwarfmonitor.cpp:1495–1546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1493 }
1494
1495 void populateDwarfColumn()
1496 {
1497 dwarf_column.clear();
1498 if (preferences_column.getDisplayListSize() > 0)
1499 {
1500 auto selected_preference = preferences_column.getFirstSelectedElem();
1501 for (auto dfit = preferences_store[selected_preference].dwarves.begin();
1502 dfit != preferences_store[selected_preference].dwarves.end();
1503 dfit++)
1504 {
1505 string label = getUnitName(*dfit);
1506 auto happy = get_happiness_cat(*dfit);
1507 UIColor color = monitor_colors[happy];
1508 switch (happy)
1509 {
1510 case 0:
1511 label += " (miserable)";
1512 break;
1513
1514 case 1:
1515 label += " (very unhappy)";
1516 break;
1517
1518 case 2:
1519 label += " (unhappy)";
1520 break;
1521
1522 case 3:
1523 label += " (fine)";
1524 break;
1525
1526 case 4:
1527 label += " (quite content)";
1528 break;
1529
1530 case 5:
1531 label += " (happy)";
1532 break;
1533
1534 case 6:
1535 label += " (ecstatic)";
1536 break;
1537 }
1538
1539 ListEntry<df::unit *> elem(label, *dfit, "", color);
1540 dwarf_column.add(elem);
1541 }
1542 }
1543
1544 dwarf_column.clearSearch();
1545 dwarf_column.setHighlight(0);
1546 }
1547
1548 df::unit *getSelectedUnit() override
1549 {

Callers

nothing calls this directly

Calls 10

getUnitNameFunction · 0.85
get_happiness_catFunction · 0.85
getDisplayListSizeMethod · 0.80
getFirstSelectedElemMethod · 0.80
clearSearchMethod · 0.80
setHighlightMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected