mirror of https://github.com/OpenTTD/OpenTTD
(svn r9870) -Codechange: Silence two compiler warnings and give proper type to the "type" member of industry struct
parent
ba24c34f85
commit
49570edfe9
|
@ -1190,7 +1190,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
|
||||||
Industry *ind;
|
Industry *ind;
|
||||||
const IndustrySpec *indspec;
|
const IndustrySpec *indspec;
|
||||||
uint best_dist;
|
uint best_dist;
|
||||||
uint accepted_cargo_index;
|
uint accepted_cargo_index = 0; ///< unlikely value, just for warning removing
|
||||||
|
|
||||||
/* Check if there's an industry close to the station that accepts the cargo
|
/* Check if there's an industry close to the station that accepts the cargo
|
||||||
* XXX - Think of something better to
|
* XXX - Think of something better to
|
||||||
|
@ -1199,10 +1199,10 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
|
||||||
best_dist = (_patches.station_spread + 8) * 2;
|
best_dist = (_patches.station_spread + 8) * 2;
|
||||||
FOR_ALL_INDUSTRIES(ind) {
|
FOR_ALL_INDUSTRIES(ind) {
|
||||||
indspec = GetIndustrySpec(ind->type);
|
indspec = GetIndustrySpec(ind->type);
|
||||||
|
uint i;
|
||||||
|
|
||||||
if (indspec->produced_cargo[0] == CT_INVALID) continue;
|
if (indspec->produced_cargo[0] == CT_INVALID) continue;
|
||||||
|
|
||||||
uint i;
|
|
||||||
for (i = 0; i < lengthof(indspec->accepts_cargo); i++) {
|
for (i = 0; i < lengthof(indspec->accepts_cargo); i++) {
|
||||||
if (cargo_type == indspec->accepts_cargo[i] &&
|
if (cargo_type == indspec->accepts_cargo[i] &&
|
||||||
(indspec->input_cargo_multiplier[i][0] != 0 || indspec->input_cargo_multiplier[i][1] != 0)) {
|
(indspec->input_cargo_multiplier[i][0] != 0 || indspec->input_cargo_multiplier[i][1] != 0)) {
|
||||||
|
@ -1210,6 +1210,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if matching cargo has been found */
|
||||||
if (i == lengthof(indspec->accepts_cargo)) continue;
|
if (i == lengthof(indspec->accepts_cargo)) continue;
|
||||||
|
|
||||||
uint dist = DistanceManhattan(ind->xy, xy);
|
uint dist = DistanceManhattan(ind->xy, xy);
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct Industry {
|
||||||
uint16 total_transported[2]; ///< total units transported per cargo
|
uint16 total_transported[2]; ///< total units transported per cargo
|
||||||
uint16 counter; ///< used for animation and/or production (if available cargo)
|
uint16 counter; ///< used for animation and/or production (if available cargo)
|
||||||
|
|
||||||
byte type; ///< type of industry. see IT_COAL_MINE and others
|
IndustryType type; ///< type of industry. see IT_COAL_MINE and others
|
||||||
OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
|
OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE
|
||||||
byte random_color; ///< randomized colour of the industry, for display purpose
|
byte random_color; ///< randomized colour of the industry, for display purpose
|
||||||
Year last_prod_year; ///< last year of production
|
Year last_prod_year; ///< last year of production
|
||||||
|
|
|
@ -63,8 +63,8 @@ IndustryType GetIndustryType(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert(IsTileType(tile, MP_INDUSTRY));
|
||||||
|
|
||||||
const Industry *ind = GetIndustry(GetIndustryIndex(tile));
|
const Industry *ind = GetIndustryByTile(tile);
|
||||||
return IsValidIndustry(ind) ? ind->type : IT_INVALID;
|
return IsValidIndustry(ind) ? ind->type : (IndustryType)IT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue