diff options
author | belugas <belugas@openttd.org> | 2007-03-28 20:06:28 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-03-28 20:06:28 +0000 |
commit | 72fc068844949f4584a7d1fb98b23b10df7e7356 (patch) | |
tree | 57823e3248ecacb9f203d77ba0d52ea3527bf7cd /src/disaster_cmd.cpp | |
parent | 29b2455761bd253981a2f7ba1118fbdecfd43149 (diff) | |
download | openttd-72fc068844949f4584a7d1fb98b23b10df7e7356.tar.xz |
(svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
Diffstat (limited to 'src/disaster_cmd.cpp')
-rw-r--r-- | src/disaster_cmd.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index bab9f4138..98181f603 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -459,7 +459,7 @@ static void DisasterTick_Airplane(Vehicle *v) ind = GetIndustryIndex(tile); v->dest_tile = ind; - if (GetIndustry(ind)->type == IT_OIL_REFINERY) { + if (GetIndustrySpec(GetIndustry(ind)->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) { v->current_order.dest = 1; v->age = 0; } @@ -532,7 +532,7 @@ static void DisasterTick_Helicopter(Vehicle *v) ind = GetIndustryIndex(tile); v->dest_tile = ind; - if (GetIndustry(ind)->type == IT_FACTORY) { + if (GetIndustrySpec(GetIndustry(ind)->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) { v->current_order.dest = 1; v->age = 0; } @@ -828,7 +828,7 @@ static void Disaster_Airplane_Init() found = NULL; FOR_ALL_INDUSTRIES(i) { - if (i->type == IT_OIL_REFINERY && + if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_AIRPLANE_ATTACKS) && (found == NULL || CHANCE16(1, 2))) { found = i; } @@ -864,7 +864,7 @@ static void Disaster_Helicopter_Init() found = NULL; FOR_ALL_INDUSTRIES(i) { - if (i->type == IT_FACTORY && + if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CHOPPER_ATTACKS) && (found == NULL || CHANCE16(1, 2))) { found = i; } @@ -982,7 +982,7 @@ static void Disaster_CoalMine_Init() const Industry *i; FOR_ALL_INDUSTRIES(i) { - if (i->type == IT_COAL_MINE && --index < 0) { + if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) { SetDParam(0, i->town->index); AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0); |