summaryrefslogtreecommitdiff
path: root/disaster_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-24 08:00:45 +0000
committertron <tron@openttd.org>2006-03-24 08:00:45 +0000
commit4b0e8947d5053d0987e9d9024156786acd3aec67 (patch)
tree4204c22d52637b86f21c6792b4e8b1b842f5ed7e /disaster_cmd.c
parent742e806d737335cb62a2d471addf19fcbe220f49 (diff)
downloadopenttd-4b0e8947d5053d0987e9d9024156786acd3aec67.tar.xz
(svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
Diffstat (limited to 'disaster_cmd.c')
-rw-r--r--disaster_cmd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/disaster_cmd.c b/disaster_cmd.c
index d773abfb7..59346e6e7 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "industry_map.h"
#include "table/strings.h"
#include "functions.h"
#include "map.h"
@@ -336,7 +337,7 @@ static void DestructIndustry(Industry *i)
TileIndex tile;
for (tile = 0; tile != MapSize(); tile++) {
- if (IsTileType(tile, MP_INDUSTRY) && _m[tile].m2 == i->index) {
+ if (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == i->index) {
_m[tile].m1 = 0;
MarkTileDirtyByTile(tile);
}
@@ -393,7 +394,7 @@ static void DisasterTick_2(Vehicle *v)
} else if (v->current_order.station == 0) {
int x,y;
TileIndex tile;
- int ind;
+ uint ind;
x = v->x_pos - 15*16;
y = v->y_pos;
@@ -405,7 +406,8 @@ static void DisasterTick_2(Vehicle *v)
if (!IsTileType(tile, MP_INDUSTRY))
return;
- v->dest_tile = ind = _m[tile].m2;
+ ind = GetIndustryIndex(tile);
+ v->dest_tile = ind;
if (GetIndustry(ind)->type == IT_OIL_REFINERY) {
v->current_order.station = 1;
@@ -464,7 +466,7 @@ static void DisasterTick_3(Vehicle *v)
} else if (v->current_order.station == 0) {
int x,y;
TileIndex tile;
- int ind;
+ uint ind;
x = v->x_pos - 15*16;
y = v->y_pos;
@@ -476,7 +478,8 @@ static void DisasterTick_3(Vehicle *v)
if (!IsTileType(tile, MP_INDUSTRY))
return;
- v->dest_tile = ind = _m[tile].m2;
+ ind = GetIndustryIndex(tile);
+ v->dest_tile = ind;
if (GetIndustry(ind)->type == IT_FACTORY) {
v->current_order.station = 1;