Changeset - r12032:8eefa482e9a8
[Not reviewed]
master
0 4 0
yexo - 15 years ago 2009-05-26 23:14:02
yexo@openttd.org
(svn r16444) -Codechange: Set all company settings to their default value for a new company instead of zeroing them.
4 files changed with 16 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -436,11 +436,7 @@ Company *DoStartupNewCompany(bool is_ai)
 
	c->inaugurated_year = _cur_year;
 
	RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false); // create a random company manager face
 

	
 
	/* Settings for non-ai companies are copied from the client settings later. */
 
	if (is_ai) {
 
		c->settings.engine_renew_money = 100000;
 
		c->settings.engine_renew_months = 6;
 
	}
 
	SetDefaultCompanySettings(c->index);
 

	
 
	GeneratePresidentName(c);
 

	
src/genworld_gui.cpp
Show inline comments
 
@@ -7,7 +7,6 @@
 
#include "heightmap.h"
 
#include "gui.h"
 
#include "variables.h"
 
#include "settings_func.h"
 
#include "debug.h"
 
#include "genworld.h"
 
#include "network/network.h"
 
@@ -27,6 +26,7 @@
 
#include "querystring_gui.h"
 
#include "town.h"
 
#include "thread.h"
 
#include "settings_func.h"
 

	
 
#include "table/strings.h"
 
#include "table/sprites.h"
src/settings.cpp
Show inline comments
 
@@ -1508,6 +1508,19 @@ void SetCompanySetting(uint index, int32
 
}
 

	
 
/**
 
 * Set the company settings for a new company to their default values.
 
 */
 
void SetDefaultCompanySettings(CompanyID cid)
 
{
 
	Company *c = Company::Get(cid);
 
	const SettingDesc *sd;
 
	for (sd = _company_settings; sd->save.cmd != SL_END; sd++) {
 
		void *var = GetVariableAddress(&c->settings, &sd->save);
 
		Write_ValidateSetting(var, sd, (int32)sd->desc.def);
 
	}
 
}
 

	
 
/**
 
 * Sync all company settings in a multiplayer game.
 
 */
 
void SyncCompanySettings()
src/settings_func.h
Show inline comments
 
@@ -27,5 +27,6 @@ void DeleteGRFPresetFromConfig(const cha
 

	
 
uint GetCompanySettingIndex(const char *name);
 
void SyncCompanySettings();
 
void SetDefaultCompanySettings(CompanyID cid);
 

	
 
#endif /* SETTINGS_FUNC_H */
0 comments (0 inline, 0 general)