File diff r24596:eddf98238034 → r24597:afde5721a3b6
src/company_cmd.cpp
Show inline comments
 
@@ -262,15 +262,15 @@ void SubtractMoneyFromCompanyFract(Compa
 
}
 

	
 
/** Update the landscaping limits per company. */
 
void UpdateLandscapingLimits()
 
{
 
	for (Company *c : Company::Iterate()) {
 
		c->terraform_limit = min(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, (uint32)_settings_game.construction.terraform_frame_burst << 16);
 
		c->clear_limit     = min(c->clear_limit     + _settings_game.construction.clear_per_64k_frames,     (uint32)_settings_game.construction.clear_frame_burst << 16);
 
		c->tree_limit      = min(c->tree_limit      + _settings_game.construction.tree_per_64k_frames,      (uint32)_settings_game.construction.tree_frame_burst << 16);
 
		c->terraform_limit = std::min<uint32>(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, _settings_game.construction.terraform_frame_burst << 16);
 
		c->clear_limit     = std::min<uint32>(c->clear_limit     + _settings_game.construction.clear_per_64k_frames,     _settings_game.construction.clear_frame_burst << 16);
 
		c->tree_limit      = std::min<uint32>(c->tree_limit      + _settings_game.construction.tree_per_64k_frames,      _settings_game.construction.tree_frame_burst << 16);
 
	}
 
}
 

	
 
/**
 
 * Set the right DParams to get the name of an owner.
 
 * @param owner the owner to get the name of.
 
@@ -551,13 +551,13 @@ Company *DoStartupNewCompany(bool is_ai,
 

	
 
	c->colour = colour;
 

	
 
	ResetCompanyLivery(c);
 
	_company_colours[c->index] = (Colours)c->colour;
 

	
 
	c->money = c->current_loan = (min(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000;
 
	c->money = c->current_loan = (std::min<int64>(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000;
 

	
 
	c->share_owners[0] = c->share_owners[1] = c->share_owners[2] = c->share_owners[3] = INVALID_OWNER;
 

	
 
	c->avail_railtypes = GetCompanyRailtypes(c->index);
 
	c->avail_roadtypes = GetCompanyRoadTypes(c->index);
 
	c->inaugurated_year = _cur_year;
 
@@ -705,13 +705,13 @@ void OnTick_Companies()
 
		if (c->name_1 != 0) GenerateCompanyName(c);
 
		if (c->bankrupt_asked != 0) HandleBankruptcyTakeover(c);
 
	}
 

	
 
	if (_next_competitor_start == 0) {
 
		/* AI::GetStartNextTime() can return 0. */
 
		_next_competitor_start = max(1, AI::GetStartNextTime() * DAY_TICKS);
 
		_next_competitor_start = std::max(1, AI::GetStartNextTime() * DAY_TICKS);
 
	}
 

	
 
	if (_game_mode != GM_MENU && AI::CanStartNew() && --_next_competitor_start == 0) {
 
		/* Allow multiple AIs to possibly start in the same tick. */
 
		do {
 
			if (!MaybeStartNewCompany()) break;
 
@@ -1195,13 +1195,13 @@ uint32 CompanyInfrastructure::GetTramTot
 
 */
 
CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 
{
 
	if (!_settings_game.economy.give_money) return CMD_ERROR;
 

	
 
	const Company *c = Company::Get(_current_company);
 
	CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL));
 
	CommandCost amount(EXPENSES_OTHER, std::min<Money>(p1, 20000000LL));
 
	CompanyID dest_company = (CompanyID)p2;
 

	
 
	/* You can only transfer funds that is in excess of your loan */
 
	if (c->money - c->current_loan < amount.GetCost() || amount.GetCost() < 0) return_cmd_error(STR_ERROR_INSUFFICIENT_FUNDS);
 
	if (!Company::IsValidID(dest_company)) return CMD_ERROR;