diff options
author | frosch <frosch@openttd.org> | 2009-11-24 23:34:46 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-11-24 23:34:46 +0000 |
commit | 324396ec74c018daf1dbda962ebb2a8fb093f8fd (patch) | |
tree | b2963992c7b05e06262917291155e094d0a5f097 | |
parent | 830231e2bda3a2a68d3e8cc466059d8b5fcadb63 (diff) | |
download | openttd-324396ec74c018daf1dbda962ebb2a8fb093f8fd.tar.xz |
(svn r18284) -Cleanup (r18268, r18283): Replace magic value with enum.
-rw-r--r-- | src/economy_type.h | 1 | ||||
-rw-r--r-- | src/newgrf.cpp | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/economy_type.h b/src/economy_type.h index 24c8ca575..fd861e0b2 100644 --- a/src/economy_type.h +++ b/src/economy_type.h @@ -192,6 +192,7 @@ static const uint64 MAX_INFLATION = (1ull << (63 - 32)) - 1; enum { MIN_PRICE_MODIFIER = -8, MAX_PRICE_MODIFIER = 16, + INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1, }; struct CargoPayment; diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 54c26de72..25fc2eba4 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5683,7 +5683,7 @@ static void InitNewGRFFile(const GRFConfig *config, int sprite_offset) /* Mark price_base_multipliers as 'not set' */ for (Price i = PR_BEGIN; i < PR_END; i++) { - newfile->price_base_multipliers[i] = 0x80; + newfile->price_base_multipliers[i] = INVALID_PRICE_MODIFIER; } /* Copy the initial parameter list */ @@ -6174,7 +6174,7 @@ static void FinalisePriceBaseMultipliers() for (Price p = PR_BEGIN; p < PR_END; p++) { /* No price defined -> nothing to do */ - if (!HasBit(features, _price_base_specs[p].grf_feature) || (byte)source->price_base_multipliers[p] == 0x80) continue; + if (!HasBit(features, _price_base_specs[p].grf_feature) || source->price_base_multipliers[p] == INVALID_PRICE_MODIFIER) continue; DEBUG(grf, 3, "'%s' overrides price base multiplier %d of '%s'", source->filename, p, dest->filename); dest->price_base_multipliers[p] = source->price_base_multipliers[p]; } @@ -6192,7 +6192,7 @@ static void FinalisePriceBaseMultipliers() for (Price p = PR_BEGIN; p < PR_END; p++) { /* Already a price defined -> nothing to do */ - if (!HasBit(features, _price_base_specs[p].grf_feature) || (byte)dest->price_base_multipliers[p] != 0x80) continue; + if (!HasBit(features, _price_base_specs[p].grf_feature) || dest->price_base_multipliers[p] != INVALID_PRICE_MODIFIER) continue; DEBUG(grf, 3, "Price base multiplier %d from '%s' propagated to '%s'", p, source->filename, dest->filename); dest->price_base_multipliers[p] = source->price_base_multipliers[p]; } @@ -6223,7 +6223,7 @@ static void FinalisePriceBaseMultipliers() PriceMultipliers &price_base_multipliers = (*file)->price_base_multipliers; for (Price p = PR_BEGIN; p < PR_END; p++) { Price fallback_price = _price_base_specs[p].fallback_price; - if (fallback_price != INVALID_PRICE && (byte)price_base_multipliers[p] == 0x80) { + if (fallback_price != INVALID_PRICE && price_base_multipliers[p] == INVALID_PRICE_MODIFIER) { /* No price multiplier has been set. * So copy the multiplier from the fallback price, maybe a multiplier was set there. */ price_base_multipliers[p] = price_base_multipliers[fallback_price]; @@ -6235,7 +6235,7 @@ static void FinalisePriceBaseMultipliers() for (GRFFile **file = _grf_files.Begin(); file != end; file++) { PriceMultipliers &price_base_multipliers = (*file)->price_base_multipliers; for (Price p = PR_BEGIN; p < PR_END; p++) { - if ((byte)price_base_multipliers[p] == 0x80) { + if (price_base_multipliers[p] == INVALID_PRICE_MODIFIER) { /* No multiplier was set; set it to a neutral value */ price_base_multipliers[p] = 0; } else { |