Codechange: pass the randomizer to use directly to the company face generation

This commit is contained in:
Rubidium
2023-01-13 22:30:18 +01:00
committed by rubidium42
parent 5e6dac6fd4
commit b3b8c3fd2d
4 changed files with 6 additions and 8 deletions

View File

@@ -199,15 +199,13 @@ static inline void ScaleAllCompanyManagerFaceBits(CompanyManagerFace &cmf)
* @param cmf the company manager's face to write the bits to
* @param ge the gender and ethnicity of the old company manager's face
* @param adv if it for the advanced company manager's face window
* @param interactive is the call from within the user interface?
* @param randomizer the source of random to use for creating the manager face
*
* @pre scale 'ge' to a valid gender/ethnicity combination
*/
static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, bool interactive = true)
static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, Randomizer &randomizer)
{
/* This method is called from a command when not interactive and
* then we must use Random to get the same result on all clients. */
cmf = interactive ? InteractiveRandom() : Random(); // random all company manager's face bits
cmf = randomizer.Next(); // random all company manager's face bits
/* scale ge: 0 == GE_WM, 1 == GE_WF, 2 == GE_BM, 3 == GE_BF (and maybe in future: ...) */
ge = (GenderEthnicity)((uint)ge % GE_END);