src/station_cmd.cpp
changeset 7645 efa25fcf7917
parent 7642 535e5d93ffb1
child 7652 a2048af4a7f9
equal deleted inserted replaced
7644:a7ff5c8ae47e 7645:efa25fcf7917
   163 static bool CMSAMine(TileIndex tile)
   163 static bool CMSAMine(TileIndex tile)
   164 {
   164 {
   165 	/* No industry */
   165 	/* No industry */
   166 	if (!IsTileType(tile, MP_INDUSTRY)) return false;
   166 	if (!IsTileType(tile, MP_INDUSTRY)) return false;
   167 
   167 
   168 	const IndustrySpec *indsp = GetIndustrySpec(GetIndustryByTile(tile)->type);
   168 	const Industry *ind = GetIndustryByTile(tile);
   169 
   169 
   170 	/* No extractive industry */
   170 	/* No extractive industry */
   171 	if ((indsp->life_type & INDUSTRYLIFE_EXTRACTIVE) == 0) return false;
   171 	if ((GetIndustrySpec(ind->type)->life_type & INDUSTRYLIFE_EXTRACTIVE) == 0) return false;
   172 
   172 
   173 	for (uint i = 0; i < lengthof(indsp->produced_cargo); i++) {
   173 	for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
   174 		/* The industry extracts something non-liquid, i.e. no oil or plastic, so it is a mine */
   174 		/* The industry extracts something non-liquid, i.e. no oil or plastic, so it is a mine */
   175 		if (indsp->produced_cargo[i] != CT_INVALID && (GetCargo(indsp->produced_cargo[i])->classes & CC_LIQUID) == 0) return true;
   175 		if (ind->produced_cargo[i] != CT_INVALID && (GetCargo(ind->produced_cargo[i])->classes & CC_LIQUID) == 0) return true;
   176 	}
   176 	}
   177 
   177 
   178 	return false;
   178 	return false;
   179 }
   179 }
   180 
   180 
   206 static bool CMSAForest(TileIndex tile)
   206 static bool CMSAForest(TileIndex tile)
   207 {
   207 {
   208 	/* No industry */
   208 	/* No industry */
   209 	if (!IsTileType(tile, MP_INDUSTRY)) return false;
   209 	if (!IsTileType(tile, MP_INDUSTRY)) return false;
   210 
   210 
   211 	const IndustrySpec *indsp = GetIndustrySpec(GetIndustryByTile(tile)->type);
   211 	const Industry *ind = GetIndustryByTile(tile);
   212 
   212 
   213 	/* No extractive industry */
   213 	/* No extractive industry */
   214 	if ((indsp->life_type & INDUSTRYLIFE_ORGANIC) == 0) return false;
   214 	if ((GetIndustrySpec(ind->type)->life_type & INDUSTRYLIFE_ORGANIC) == 0) return false;
   215 
   215 
   216 	for (uint i = 0; i < lengthof(indsp->produced_cargo); i++) {
   216 	for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
   217 		/* The industry produces wood. */
   217 		/* The industry produces wood. */
   218 		if (indsp->produced_cargo[i] != CT_INVALID && GetCargo(indsp->produced_cargo[i])->label == 'WOOD') return true;
   218 		if (ind->produced_cargo[i] != CT_INVALID && GetCargo(ind->produced_cargo[i])->label == 'WOOD') return true;
   219 	}
   219 	}
   220 
   220 
   221 	return false;
   221 	return false;
   222 }
   222 }
   223 
   223