industry_cmd.c
changeset 3663 548dfb4ad4cc
parent 3662 d9683fb55b45
child 3669 753648f181a0
--- a/industry_cmd.c	Wed Apr 26 14:58:06 2006 +0000
+++ b/industry_cmd.c	Wed Apr 26 17:01:27 2006 +0000
@@ -444,22 +444,14 @@
 	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? */
@@ -482,7 +474,7 @@
 	}
 
 	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;
@@ -1214,7 +1206,7 @@
 }
 
 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,
@@ -1383,7 +1375,7 @@
 
 		// 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;