MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateData

Method UpdateData

src/company_gui.cpp:1221–1240  ·  view source on GitHub ↗

* Make face bits valid and update visible face variables. */

Source from the content-addressed store, hash-verified

1219 * Make face bits valid and update visible face variables.
1220 */
1221 void UpdateData()
1222 {
1223 FaceVars vars = GetCompanyManagerFaceVars(this->face.style);
1224 ScaleAllCompanyManagerFaceBits(this->face, vars);
1225
1226 uint64_t active_vars = GetActiveFaceVars(this->face, vars);
1227 /* Exclude active parts which have no string. */
1228 for (auto var : SetBitIterator(active_vars)) {
1229 if (vars[var].name == STR_NULL) ClrBit(active_vars, var);
1230 }
1231
1232 /* Rebuild the sorted list of face variable pointers. */
1233 this->face_vars.clear();
1234 for (auto var : SetBitIterator(active_vars)) {
1235 this->face_vars.emplace_back(&vars[var]);
1236 }
1237 std::ranges::sort(this->face_vars, std::less{}, &FaceVar::position);
1238
1239 this->GetScrollbar(WID_SCMF_PARTS_SCROLLBAR)->SetCount(std::size(this->face_vars));
1240 }
1241
1242public:
1243 SelectCompanyManagerFaceWindow(WindowDesc &desc, Window *parent) : Window(desc)

Callers 3

OnClickMethod · 0.95
OnQueryTextFinishedMethod · 0.95

Calls 9

GetActiveFaceVarsFunction · 0.85
SetBitIteratorClass · 0.85
ClrBitFunction · 0.85
GetScrollbarMethod · 0.80
sizeFunction · 0.50
clearMethod · 0.45
SetCountMethod · 0.45

Tested by

no test coverage detected