Changeset - r26349:89c1e28eb0f3
[Not reviewed]
master
0 1 0
Tyler Trahan - 2 years ago 2022-08-30 14:26:02
tyler@tylertrahan.com
Change: New player companies use favorite manager face, if saved (#9895)
1 file changed with 12 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -562,7 +562,14 @@ Company *DoStartupNewCompany(bool is_ai,
 
	c->avail_railtypes = GetCompanyRailtypes(c->index);
 
	c->avail_roadtypes = GetCompanyRoadTypes(c->index);
 
	c->inaugurated_year = _cur_year;
 
	RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false, false); // create a random company manager face
 

	
 
	/* If starting a player company in singleplayer and a favorite company manager face is selected, choose it. Otherwise, use a random face.
 
	 * In a network game, we'll choose the favorite face later in CmdCompanyCtrl to sync it to all clients. */
 
	if (_company_manager_face != 0 && !is_ai && !_networking) {
 
		c->face = _company_manager_face;
 
	} else {
 
		RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false, false);
 
	}
 

	
 
	SetDefaultCompanySettings(c->index);
 
	ClearEnginesHiddenFlagOfCompany(c->index);
 
@@ -838,6 +845,10 @@ CommandCost CmdCompanyCtrl(DoCommandFlag
 
					NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
 
				}
 

	
 
				/* In network games, we need to try setting the company manager face here to sync it to all clients.
 
				 * If a favorite company manager face is selected, choose it. Otherwise, use a random face. */
 
				if (_company_manager_face != 0) Command<CMD_SET_COMPANY_MANAGER_FACE>::Post(_company_manager_face);
 

	
 
				/* Now that we have a new company, broadcast our company settings to
 
				 * all clients so everything is in sync */
 
				SyncCompanySettings();
0 comments (0 inline, 0 general)