(svn r25490) -Fix [FS#5610]: the face of the manager differed on clients when the company was started after the clients joined

This commit is contained in:
rubidium 2013-06-27 20:20:13 +00:00
parent 868001a1e0
commit 11e6d5c8df
2 changed files with 6 additions and 3 deletions

View File

@ -551,7 +551,7 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
c->avail_railtypes = GetCompanyRailtypes(c->index); c->avail_railtypes = GetCompanyRailtypes(c->index);
c->avail_roadtypes = GetCompanyRoadtypes(c->index); c->avail_roadtypes = GetCompanyRoadtypes(c->index);
c->inaugurated_year = _cur_year; c->inaugurated_year = _cur_year;
RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false); // create a random company manager face RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false, false); // create a random company manager face
SetDefaultCompanySettings(c->index); SetDefaultCompanySettings(c->index);

View File

@ -201,12 +201,15 @@ static inline void ScaleAllCompanyManagerFaceBits(CompanyManagerFace &cmf)
* @param cmf the company manager's face to write the bits to * @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 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 adv if it for the advanced company manager's face window
* @param interactive is the call from within the user interface?
* *
* @pre scale 'ge' to a valid gender/ethnicity combination * @pre scale 'ge' to a valid gender/ethnicity combination
*/ */
static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv) static inline void RandomCompanyManagerFaceBits(CompanyManagerFace &cmf, GenderEthnicity ge, bool adv, bool interactive = true)
{ {
cmf = InteractiveRandom(); // random all company manager's face bits /* 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
/* scale ge: 0 == GE_WM, 1 == GE_WF, 2 == GE_BM, 3 == GE_BF (and maybe in future: ...) */ /* scale ge: 0 == GE_WM, 1 == GE_WF, 2 == GE_BM, 3 == GE_BF (and maybe in future: ...) */
ge = (GenderEthnicity)((uint)ge % GE_END); ge = (GenderEthnicity)((uint)ge % GE_END);