File diff r3662:7232cd353d38 → r3663:faa6c3affaf3
industry_cmd.c
Show inline comments
 
@@ -441,28 +441,20 @@ static int32 ClearTile_Industry(TileInde
 
	}
 

	
 
	if (flags & DC_EXEC) DeleteIndustry(i);
 
	return 0;
 
}
 

	
 

	
 
static const byte _industry_min_cargo[] = {
 
	5, 5, 5, 30, 5, 5, 5, 5,
 
	5, 5, 5, 5, 2, 5, 5, 5,
 
	5, 5, 5, 15, 15, 5, 5, 5,
 
	5, 5, 30, 5, 30, 5, 5, 5,
 
	5, 5, 5, 5, 5,
 
};
 

	
 
static void TransportIndustryGoods(TileIndex tile)
 
{
 
	Industry *i = GetIndustryByTile(tile);
 
	const IndustrySpec *spec = GetIndustrySpecification(i->type);
 
	uint cw, am;
 

	
 
	cw = min(i->cargo_waiting[0], 255);
 
	if (cw > _industry_min_cargo[i->type]/* && i->produced_cargo[0] != 0xFF*/) {
 
	if (cw > spec->minimal_cargo/* && i->produced_cargo[0] != 0xFF*/) {
 
		i->cargo_waiting[0] -= cw;
 

	
 
		/* fluctuating economy? */
 
		if (_economy.fluct <= 0) cw = (cw + 1) / 2;
 

	
 
		i->last_mo_production[0] += cw;
 
@@ -479,13 +471,13 @@ static void TransportIndustryGoods(TileI
 
				MarkTileDirtyByTile(tile);
 
			}
 
		}
 
	}
 

	
 
	cw = min(i->cargo_waiting[1], 255);
 
	if (cw > _industry_min_cargo[i->type]) {
 
	if (cw > spec->minimal_cargo) {
 
		i->cargo_waiting[1] -= cw;
 

	
 
		if (_economy.fluct <= 0) cw = (cw + 1) / 2;
 

	
 
		i->last_mo_production[1] += cw;
 

	
 
@@ -1211,13 +1203,13 @@ static bool CheckNewIndustry_Lumbermill(
 
static bool CheckNewIndustry_BubbleGen(TileIndex tile, IndustryType type)
 
{
 
	return GetTileZ(tile) <= TILE_HEIGHT * 4;
 
}
 

	
 
typedef bool CheckNewIndustryProc(TileIndex tile, IndustryType type);
 
static CheckNewIndustryProc * const _check_new_industry_procs[] = {
 
static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = {
 
	CheckNewIndustry_NULL,
 
	CheckNewIndustry_Forest,
 
	CheckNewIndustry_Oil,
 
	CheckNewIndustry_Farm,
 
	CheckNewIndustry_Plantation,
 
	CheckNewIndustry_Water,
 
@@ -1380,13 +1372,13 @@ static bool CheckIfTooCloseToIndustry(Ti
 
			_error_message = STR_INDUSTRY_TOO_CLOSE;
 
			return false;
 
		}
 

	
 
		// check "not close to" field.
 
		if (i->xy != 0 &&
 
				(i->type == spec->a || i->type == spec->b || i->type == spec->c) &&
 
				(i->type == spec->conflicting[0] || i->type == spec->conflicting[1] || i->type == spec->conflicting[2]) &&
 
				DistanceMax(tile, i->xy) <= 14) {
 
			_error_message = STR_INDUSTRY_TOO_CLOSE;
 
			return false;
 
		}
 
	}
 
	return true;