summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-05-30 20:20:58 +0000
committerbelugas <belugas@openttd.org>2007-05-30 20:20:58 +0000
commit06bc9866aac08bb5682470d78524234cf1411f48 (patch)
treec886ca4d96352ab20a7685f1637ba209083eb6b6 /src
parent1e371a99d2b24b5c040bc159e42bbfd41e3139ef (diff)
downloadopenttd-06bc9866aac08bb5682470d78524234cf1411f48.tar.xz
(svn r9992) -Codechange: Remove some hardcoded references to Industry IDs.
A few more to go
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp7
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/smallmap_gui.cpp2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 5077f4b96..7f8a38ff7 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1481,7 +1481,7 @@ int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
indspec->accepts_cargo[0] == CT_INVALID &&
indspec->accepts_cargo[1] == CT_INVALID &&
indspec->accepts_cargo[2] == CT_INVALID &&
- p1 != IT_LUMBER_MILL) {
+ !(ind_spc->behaviour & INDUSTRYBEH_CUT_TREES) {
return CMD_ERROR;
}
@@ -1522,9 +1522,10 @@ static const byte _numof_industry_table[5][12] = {
static void PlaceInitialIndustry(IndustryType type, int amount)
{
int num = _numof_industry_table[_opt.diff.number_industries][amount];
+ const IndustrySpec *ind_spc = GetIndustrySpec(type);
/* These are always placed next to the coastline, so we scale by the perimeter instead. */
- num = (type == IT_OIL_REFINERY || type == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
+ num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
if (_opt.diff.number_industries != 0) {
PlayerID old_player = _current_player;
@@ -1567,7 +1568,7 @@ void GenerateIndustries()
int num = _numof_industry_table[_opt.diff.number_industries][chance];
/* These are always placed next to the coastline, so we scale by the perimeter instead. */
- num = (it == IT_OIL_REFINERY || it == IT_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
+ num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
i += num;
}
}
diff --git a/src/openttd.cpp b/src/openttd.cpp
index a5fa6ffca..062d2185b 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1781,7 +1781,7 @@ bool AfterLoadGame()
FOR_ALL_INDUSTRIES(i) {
uint j;
- if (i->type == IT_FARM || i->type == IT_FARM_2) {
+ if (GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_PLANT_ON_BUILT) {
for (j = 0; j != 50; j++) PlantRandomFarmField(i);
}
}
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 10452b5cf..0c10e7fc5 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -430,7 +430,7 @@ static inline uint32 GetSmallMapVegetationPixels(TileIndex tile)
break;
case MP_INDUSTRY:
- bits = GetIndustryType(tile) == IT_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
+ bits = GetIndustrySpec(GetIndustryByTile(tile)->type)->check_proc == CHECK_FOREST ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
break;
case MP_TREES: