summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-03-20 14:30:16 +0000
committerfrosch <frosch@openttd.org>2010-03-20 14:30:16 +0000
commit116a5f56a4c1362446bcf921e4436a19057d105e (patch)
treeeeb12e8765bc1997310546c701043efd81c9b410 /src/newgrf_industries.cpp
parente27e5febb60f1cd2a2c70b100652c9365d97dbbd (diff)
downloadopenttd-116a5f56a4c1362446bcf921e4436a19057d105e.tar.xz
(svn r19481) -Codechange: Turn _industry_counts into a static member of Industry.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index ceff4923f..f5d5301fa 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -135,7 +135,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout
/* If the filter is 0, it could be because none was specified as well as being really a 0.
* In either case, just do the regular var67 */
closest_dist = GetClosestIndustry(current->location.tile, ind_index, current);
- count = GetIndustryTypeCount(ind_index);
+ count = min(Industry::GetIndustryTypeCount(ind_index), UINT8_MAX); // clamp to 8 bit
} else {
/* Count only those who match the same industry type and layout filter
* Unfortunately, we have to do it manually */
@@ -465,7 +465,7 @@ CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, uin
Industry ind;
ind.index = INVALID_INDUSTRY;
ind.location.tile = tile;
- ind.location.w = 0;
+ ind.location.w = 0; // important to mark the industry invalid
ind.type = type;
ind.selected_layout = layout;
ind.town = ClosestTownFromTile(tile, UINT_MAX);