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

Function IsValidCompanyManagerFace

src/company_cmd.cpp:186–197  ·  view source on GitHub ↗

* Checks whether a company manager's face is a valid encoding. * Unused bits are not enforced to be 0. * @param cmf the fact to check * @return true if and only if the face is valid */

Source from the content-addressed store, hash-verified

184 * @return true if and only if the face is valid
185 */
186static bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
187{
188 if (cmf.style >= GetNumCompanyManagerFaceStyles()) return false;
189
190 /* Test if each enabled part is valid. */
191 FaceVars vars = GetCompanyManagerFaceVars(cmf.style);
192 for (uint var : SetBitIterator(GetActiveFaceVars(cmf, vars))) {
193 if (!vars[var].IsValid(cmf)) return false;
194 }
195
196 return true;
197}
198
199static CompanyMask _dirty_company_finances{}; ///< Bitmask of company finances that should be marked dirty.
200

Callers 1

CmdSetCompanyManagerFaceFunction · 0.85

Calls 5

SetBitIteratorClass · 0.85
GetActiveFaceVarsFunction · 0.85
IsValidMethod · 0.45

Tested by

no test coverage detected