static */
| 103 | } |
| 104 | |
| 105 | /* static */ bool ScriptCompany::SetPresidentGender(Gender gender) |
| 106 | { |
| 107 | EnforceCompanyModeValid(false); |
| 108 | EnforcePrecondition(false, gender == GENDER_MALE || gender == GENDER_FEMALE); |
| 109 | EnforcePrecondition(false, GetPresidentGender(ScriptCompany::COMPANY_SELF) != gender); |
| 110 | |
| 111 | assert(GetNumCompanyManagerFaceStyles() >= 2); /* At least two styles are needed to fake a gender. */ |
| 112 | |
| 113 | /* Company faces no longer have a defined gender, so pick a random face style instead. */ |
| 114 | Randomizer &randomizer = ScriptObject::GetRandomizer(); |
| 115 | CompanyManagerFace cmf{}; |
| 116 | do { |
| 117 | cmf.style = randomizer.Next(GetNumCompanyManagerFaceStyles()); |
| 118 | } while ((HasBit(cmf.style, 0) ? GENDER_FEMALE : GENDER_MALE) != gender); |
| 119 | |
| 120 | RandomiseCompanyManagerFaceBits(cmf, GetCompanyManagerFaceVars(cmf.style), randomizer); |
| 121 | |
| 122 | return ScriptObject::Command<CMD_SET_COMPANY_MANAGER_FACE>::Do(cmf.style, cmf.bits); |
| 123 | } |
| 124 | |
| 125 | /* static */ ScriptCompany::Gender ScriptCompany::GetPresidentGender(ScriptCompany::CompanyID company) |
| 126 | { |
nothing calls this directly
no test coverage detected