File diff r2497:4f8fde59a2e8 → r2498:8dfa040ed505
industry_cmd.c
Show inline comments
 
@@ -1033,25 +1033,25 @@ static void ChopLumberMillTrees(Industry
 
	int dir, a, j;
 

	
 
	if ((_m[tile].m1 & 0x80) == 0)
 
		return;
 

	
 
	/* search outwards as a rectangular spiral */
 
	for(a=1; a!=41; a+=2) {
 
		for(dir=0; dir!=4; dir++) {
 
			j = a;
 
			do {
 
				tile = TILE_MASK(tile);
 
				if (IsTileType(tile, MP_TREES)) {
 
					uint old_player = _current_player;
 
					PlayerID old_player = _current_player;
 
					/* found a tree */
 

	
 
					_current_player = OWNER_NONE;
 
					_industry_sound_ctr = 1;
 
					_industry_sound_tile = tile;
 
					SndPlayTileFx(SND_38_CHAINSAW, tile);
 

	
 
					DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
					SetMapExtraBits(tile, 0);
 

	
 
					i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + 45);
 

	
 
@@ -1653,25 +1653,25 @@ static void PlaceInitialIndustry(byte ty
 
{
 
	int num = _numof_industry_table[_opt.diff.number_industries][amount];
 

	
 
	if (type == IT_OIL_REFINERY || type == IT_OIL_RIG) {
 
		// These are always placed next to the coastline, so we scale by the perimeter instead.
 
		num = ScaleByMapSize1D(num);
 
	} else {
 
		num = ScaleByMapSize(num);
 
	}
 

	
 
	if (_opt.diff.number_industries != 0)
 
	{
 
		byte old_player = _current_player;
 
		PlayerID old_player = _current_player;
 
		_current_player = OWNER_NONE;
 
		assert(num > 0);
 

	
 
		do {
 
			int i = 2000;
 
			do {
 
				if (CreateNewIndustry(RandomTile(), type) != NULL)
 
					break;
 
			} while (--i != 0);
 
		} while (--num);
 

	
 
		_current_player = old_player;
 
@@ -1893,25 +1893,25 @@ static void ChangeIndustryProduction(Ind
 
			break;
 
	}
 

	
 
	if (str != STR_NULL) {
 
		SetDParam(0, i->index);
 
		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
 
	}
 
}
 

	
 
void IndustryMonthlyLoop(void)
 
{
 
	Industry *i;
 
	byte old_player = _current_player;
 
	PlayerID old_player = _current_player;
 
	_current_player = OWNER_NONE;
 

	
 
	FOR_ALL_INDUSTRIES(i) {
 
		if (i->xy != 0)
 
			UpdateIndustryStatistics(i);
 
	}
 

	
 
	/* 3% chance that we start a new industry */
 
	if (CHANCE16(3, 100)) {
 
		MaybeNewIndustry(Random());
 
	} else if (!_patches.smooth_economy && _total_industries > 0) {
 
		i = GetIndustry(RandomRange(_total_industries));