Mercurial > hg > openttd
annotate road_cmd.c @ 84:784a9e9bb932 draft
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
-Add: generalised A* Algorithm
-Add: generalised queues (Fifo, Stack, InsSort, BinaryHeap)
author | truelight <truelight@openttd.org> |
---|---|
date | Fri, 20 Aug 2004 09:32:32 +0000 |
parents | 0ecf460b53fc |
children | 811875caee5f |
rev | line source |
---|---|
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1 #include "stdafx.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
2 #include "ttd.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
3 #include "vehicle.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
4 #include "viewport.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
5 #include "command.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
6 #include "player.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
7 #include "town.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
8 #include "gfx.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
9 |
22
7a15e52a1c8f
(svn r23) -Some omments on the code (blathijs)
darkvater <darkvater@openttd.org>
parents:
13
diff
changeset
|
10 /* When true, GetTrackStatus for roads will treat roads under reconstruction |
7a15e52a1c8f
(svn r23) -Some omments on the code (blathijs)
darkvater <darkvater@openttd.org>
parents:
13
diff
changeset
|
11 * as normal roads instead of impassable. This is used when detecting whether |
7a15e52a1c8f
(svn r23) -Some omments on the code (blathijs)
darkvater <darkvater@openttd.org>
parents:
13
diff
changeset
|
12 * a road can be removed. This is of course ugly, but I don't know a better |
7a15e52a1c8f
(svn r23) -Some omments on the code (blathijs)
darkvater <darkvater@openttd.org>
parents:
13
diff
changeset
|
13 * solution just like that... */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
14 static bool _road_special_gettrackstatus; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
15 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
16 void RoadVehEnterDepot(Vehicle *v); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
17 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
18 |
84
784a9e9bb932
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight <truelight@openttd.org>
parents:
72
diff
changeset
|
19 bool HasTileRoadAt(uint tile, int i) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
20 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
21 int mask; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
22 byte b; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
23 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
24 switch(GET_TILETYPE(tile)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
25 case MP_STREET: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
26 b = _map5[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
27 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
28 if ((b & 0xF0) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
29 } else if ((b & 0xF0) == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
30 b = (b&8)?5:10; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
31 } else if ((b & 0xF0) == 0x20) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
32 return (~b & 3) == i; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
33 } else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
34 return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
35 break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
36 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
37 case MP_STATION: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
38 b = _map5[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
39 if (!IS_BYTE_INSIDE(b, 0x43, 0x43+8)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
40 return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
41 return ((~(b - 0x43) & 3) == i); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
42 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
43 case MP_TUNNELBRIDGE: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
44 mask = GetRoadBitsByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
45 b = 10; if (mask & 1) break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
46 b = 5; if (mask & 2) break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
47 return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
48 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
49 default: |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
50 return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
51 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
52 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
53 return HASBIT(b, i); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
54 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
55 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
56 static bool CheckAllowRemoveRoad(uint tile, uint br, bool *edge_road) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
57 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
58 int blocks; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
59 byte owner; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
60 uint n; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
61 *edge_road = true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
62 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
63 if (_game_mode == GM_EDITOR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
64 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
65 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
66 blocks = GetRoadBitsByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
67 if (blocks == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
68 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
69 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
70 // Only do the special processing for actual players. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
71 if (_current_player >= MAX_PLAYERS) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
72 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
73 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
74 // A railway crossing has the road owner in the map3_lo byte. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
75 if (IS_TILETYPE(tile, MP_STREET) && (_map5[tile] & 0xF0) == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
76 owner = _map3_lo[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
77 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
78 owner = _map_owner[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
79 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
80 // Only do the special processing if the road is owned |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
81 // by a town |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
82 if (owner != OWNER_TOWN) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
83 return owner == OWNER_NONE || CheckOwnership(owner); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
84 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
85 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
86 if (_cheats.magic_bulldozer.value) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
87 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
88 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
89 // Get a bitmask of which neighbouring roads has a tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
90 n = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
91 if (blocks&0x25 && HasTileRoadAt(TILE_ADDXY(tile,-1, 0), 1)) n |= 8; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
92 if (blocks&0x2A && HasTileRoadAt(TILE_ADDXY(tile, 0, 1), 0)) n |= 4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
93 if (blocks&0x19 && HasTileRoadAt(TILE_ADDXY(tile, 1, 0), 3)) n |= 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
94 if (blocks&0x16 && HasTileRoadAt(TILE_ADDXY(tile, 0,-1), 2)) n |= 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
95 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
96 // If 0 or 1 bits are set in n, or if no bits that match the bits to remove, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
97 // then allow it |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
98 if ((n & (n-1)) != 0 && (n & br) != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
99 Town *t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
100 *edge_road = false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
101 // you can remove all kind of roads with extra dynamite |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
102 if (_patches.extra_dynamite) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
103 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
104 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
105 t = ClosestTownFromTile(tile, (uint)-1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
106 SET_DPARAM16(0, t->index); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
107 _error_message = STR_2009_LOCAL_AUTHORITY_REFUSES; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
108 return false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
109 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
110 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
111 return true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
112 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
113 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
114 bool IsRoadDepotTile(TileIndex tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
115 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
116 return IS_TILETYPE(tile, MP_STREET) && |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
117 (_map5[tile] & 0xF0) == 0x20; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
118 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
119 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
120 uint GetRoadBitsByTile(TileIndex tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
121 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
122 uint32 r = GetTileTrackStatus(tile, 2); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
123 return (byte)(r | (r >> 8)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
124 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
125 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
126 // cost for removing inner/edge -roads |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
127 static const uint16 _road_remove_cost[2] = {50, 18}; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
128 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
129 /* Delete a piece of road |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
130 * p1 = piece type |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
131 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
132 int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
133 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
134 TileInfo ti; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
135 int32 cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
136 uint tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
137 Town *t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
138 /* true if the roadpiece was always removeable, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
139 false if it was a center piece. Affects town ratings drop |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
140 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
141 bool edge_road; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
142 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
143 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
144 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
145 FindLandscapeHeight(&ti, x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
146 tile = ti.tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
147 t = ClosestTownFromTile(tile, (uint)-1); // needed for town rating penalty |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
148 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
149 // allow deleting road under bridge |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
150 if (ti.type != MP_TUNNELBRIDGE && !EnsureNoVehicle(tile)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
151 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
152 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
153 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
154 bool b; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
155 _road_special_gettrackstatus = true; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
156 b = CheckAllowRemoveRoad(tile, p1, &edge_road); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
157 _road_special_gettrackstatus = false; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
158 if (!b) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
159 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
160 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
161 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
162 if (ti.type == MP_TUNNELBRIDGE) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
163 if (!EnsureNoVehicleZ(tile, GET_TILEHEIGHT(tile))) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
164 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
165 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
166 if ((ti.map5 & 0xE9) == 0xE8) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
167 if (p1 & 10) goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
168 } else if ((ti.map5 & 0xE9) == 0xE9) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
169 if (p1 & 5) goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
170 } else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
171 goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
172 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
173 cost = _price.remove_road * 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
174 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
175 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
176 _map5[tile] = ti.map5 & 0xC7; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
177 _map_owner[tile] = OWNER_NONE; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
178 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
179 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
180 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
181 } else if (ti.type == MP_STREET) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
182 if (!(ti.map5 & 0xF0)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
183 uint c = p1, t2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
184 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
185 if (ti.tileh != 0 && (ti.map5 == 5 || ti.map5 == 10)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
186 c |= (c & 0xC) >> 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
187 c |= (c & 0x3) << 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
188 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
189 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
190 // limit the bits to delete to the existing bits. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
191 if ((c &= ti.map5) == 0) goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
192 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
193 // calculate the cost |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
194 t2 = c; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
195 cost = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
196 do { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
197 if (t2&1) cost += _price.remove_road; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
198 } while(t2>>=1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
199 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
200 // check if you're allowed to remove the street owned by a town |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
201 // removal allowance depends on difficulty setting |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
202 if(_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
203 if (!CheckforTownRating(tile, flags, t, ROAD_REMOVE)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
204 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
205 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
206 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
207 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
208 // checks if the owner is town than decrease town rating by 50 until you have |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
209 // a "Poor" town rating |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
210 if(_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
211 ChangeTownRating(t, -_road_remove_cost[(byte)edge_road], -100); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
212 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
213 _map5[tile] ^= c; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
214 if ((_map5[tile]&0xF) == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
215 DoClearSquare(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
216 else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
217 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
218 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
219 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
220 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
221 } else if (!(ti.map5 & 0xE0)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
222 byte c; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
223 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
224 if (!(ti.map5 & 8)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
225 c = 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
226 if (p1 & 5) goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
227 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
228 c = 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
229 if (p1 & 10) goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
230 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
231 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
232 cost = _price.remove_road * 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
233 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
234 ModifyTile(tile, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
235 MP_SETTYPE(MP_RAILWAY) | |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
236 MP_MAP2_CLEAR | MP_MAP3LO | MP_MAP3HI_CLEAR | MP_MAP5, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
237 _map3_hi[tile] & 0xF, /* map3_lo */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
238 c /* map5 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
239 ); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
240 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
241 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
242 } else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
243 goto return_error; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
244 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
245 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
246 return_error:; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
247 return_cmd_error(INVALID_STRING_ID); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
248 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
249 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
250 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
251 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
252 enum { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
253 ROAD_NW = 1, // NW road track |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
254 ROAD_SW = 2, // SW road track |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
255 ROAD_SE = 4, // SE road track |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
256 ROAD_NE = 8, // NE road track |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
257 ROAD_ALL = (ROAD_NW | ROAD_SW | ROAD_SE | ROAD_NE) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
258 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
259 |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
260 static const byte _valid_tileh_slopes_road[3][15] = { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
261 // set of normal ones |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
262 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
263 ROAD_ALL, 0, 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
264 ROAD_SW | ROAD_NE, 0, 0, // 3, 4, 5 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
265 ROAD_NW | ROAD_SE, 0, 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
266 ROAD_NW | ROAD_SE, 0, 0, // 9, 10, 11 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
267 ROAD_SW | ROAD_NE, 0, 0 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
268 }, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
269 // allowed road for an evenly raised platform |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
270 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
271 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
272 ROAD_SW | ROAD_NW, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
273 ROAD_SW | ROAD_SE, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
274 ROAD_NW | ROAD_SE | ROAD_SW, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
275 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
276 ROAD_SE | ROAD_NE, // 4 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
277 ROAD_ALL, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
278 ROAD_SW | ROAD_NE | ROAD_SE, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
279 ROAD_ALL, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
280 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
281 ROAD_NW | ROAD_NE, // 8 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
282 ROAD_SW | ROAD_NE | ROAD_NW, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
283 ROAD_ALL, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
284 ROAD_ALL, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
285 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
286 ROAD_NW | ROAD_SE | ROAD_NE, // 12 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
287 ROAD_ALL, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
288 ROAD_ALL |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
289 }, |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
290 // valid railway crossings on slopes |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
291 { |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
292 1, 0, 0, // 0, 1, 2 |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
293 0, 0, 1, // 3, 4, 5 |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
294 0, 1, 0, // 6, 7, 8 |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
295 0, 1, 1, // 9, 10, 11 |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
296 0, 1, 1, // 12, 13, 14 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
297 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
298 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
299 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
300 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
301 static uint32 CheckRoadSlope(int tileh, byte *pieces, byte existing) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
302 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
303 if (!(tileh & 0x10)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
304 byte road_bits = *pieces | existing; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
305 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
306 // no special foundation |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
307 if ((~_valid_tileh_slopes_road[0][tileh] & road_bits) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
308 // force that all bits are set when we have slopes |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
309 if (tileh != 0) *pieces |= _valid_tileh_slopes_road[0][tileh]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
310 return 0; // no extra cost |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
311 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
312 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
313 // foundation is used. Whole tile is leveled up |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
314 if ((~_valid_tileh_slopes_road[1][tileh] & road_bits) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
315 return existing ? 0 : _price.terraform; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
316 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
317 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
318 // partly leveled up tile, only if there's no road on that tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
319 if ( !existing && (tileh == 1 || tileh == 2 || tileh == 4 || tileh == 8) ) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
320 // force full pieces. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
321 *pieces |= (*pieces & 0xC) >> 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
322 *pieces |= (*pieces & 0x3) << 2; |
72
0ecf460b53fc
(svn r73) -Fix: Wrong building of road-slopes for a future AI/Town
darkvater <darkvater@openttd.org>
parents:
39
diff
changeset
|
323 return (*pieces == (ROAD_NE|ROAD_SW) || *pieces == (ROAD_SE|ROAD_NW)) ? _price.terraform : CMD_ERROR; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
324 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
325 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
326 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
327 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
328 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
329 /* Build a piece of road |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
330 * p1 = piece flags |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
331 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
332 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
333 int32 CmdBuildRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
334 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
335 TileInfo ti; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
336 int32 cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
337 byte pieces = (byte)p1, existing = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
338 uint tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
339 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
340 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
341 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
342 FindLandscapeHeight(&ti, x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
343 tile = ti.tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
344 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
345 // allow building road under bridge |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
346 if (ti.type != MP_TUNNELBRIDGE && !EnsureNoVehicle(tile)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
347 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
348 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
349 if (ti.type == MP_STREET) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
350 if (!(ti.map5 & 0xF0)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
351 if ( ((pieces) & (byte)(ti.map5)) == (pieces)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
352 return_cmd_error(STR_1007_ALREADY_BUILT); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
353 existing = ti.map5; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
354 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
355 if (!(ti.map5 & 0xE0) && pieces != ((ti.map5 & 8) ? 5 : 10)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
356 return_cmd_error(STR_1007_ALREADY_BUILT); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
357 goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
358 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
359 } else if (ti.type == MP_RAILWAY) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
360 byte m5; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
361 |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
362 if (ti.tileh & 0x10) // very steep tile |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
363 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
364 |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
365 if(!_valid_tileh_slopes_road[2][ti.tileh]) // prevent certain slopes |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
366 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
367 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
368 if (ti.map5 == 2) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
369 if (pieces & 5) goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
370 m5 = 0x10; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
371 } else if (ti.map5 == 1) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
372 if (pieces & 10) goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
373 m5 = 0x18; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
374 } else |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
375 goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
376 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
377 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
378 ModifyTile(tile, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
379 MP_SETTYPE(MP_STREET) | |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
380 MP_MAP2_CLEAR | MP_MAP3LO | MP_MAP3HI | MP_MAP5, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
381 _current_player, /* map3_lo */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
382 _map3_lo[tile] & 0xF, /* map3_hi */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
383 m5 /* map5 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
384 ); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
385 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
386 return _price.build_road * 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
387 } else if (ti.type == MP_TUNNELBRIDGE) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
388 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
389 /* check for flat land */ |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
390 if (ti.tileh & 0x10) // very steep tile |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
391 return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
392 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
393 /* is this middle part of a bridge? */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
394 if ((ti.map5 & 0xC0) != 0xC0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
395 goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
396 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
397 /* only allow roads pertendicular to bridge */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
398 if ((pieces & 5) == (ti.map5 & 0x01)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
399 goto do_clear; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
400 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
401 /* check if clear land under bridge */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
402 if ((ti.map5 & 0xF8) == 0xE8) /* road under bridge */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
403 return_cmd_error(STR_1007_ALREADY_BUILT); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
404 else if ((ti.map5 & 0xE0) == 0xE0) /* other transport route under bridge */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
405 return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
406 else if ((ti.map5 & 0xF8) == 0xC8) /* water under bridge */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
407 return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
408 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
409 /* all checked, can build road now! */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
410 cost = _price.build_road * 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
411 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
412 ModifyTile(tile, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
413 MP_MAPOWNER_CURRENT | MP_MAP5, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
414 (ti.map5 & 0xC7) | 0x28 // map5 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
415 ); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
416 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
417 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
418 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
419 do_clear:; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
420 if (DoCommandByTile(tile, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR) == CMD_ERROR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
421 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
422 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
423 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
424 cost = CheckRoadSlope(ti.tileh, &pieces, existing); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
425 if (cost == CMD_ERROR) return_cmd_error(STR_1800_LAND_SLOPED_IN_WRONG_DIRECTION); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
426 |
84
784a9e9bb932
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight <truelight@openttd.org>
parents:
72
diff
changeset
|
427 if (cost && (!_patches.build_on_slopes || (!_patches.ainew_active && _is_ai_player))) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
428 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
429 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
430 if (!(ti.type == MP_STREET && (ti.map5 & 0xF0) == 0)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
431 cost += DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
432 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
433 // Don't put the pieces that already exist |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
434 pieces &= ~ti.map5; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
435 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
436 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
437 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
438 byte t = pieces; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
439 while (t) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
440 if (t & 1) cost += _price.build_road; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
441 t >>= 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
442 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
443 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
444 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
445 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
446 if (ti.type != MP_STREET) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
447 _map_type_and_height[tile] &= 0xF; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
448 _map_type_and_height[tile] |= MP_STREET << 4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
449 _map5[tile] = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
450 _map_owner[tile] = _current_player; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
451 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
452 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
453 _map5[tile] |= (byte)pieces; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
454 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
455 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
456 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
457 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
458 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
459 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
460 int32 DoConvertStreetRail(uint tile, uint totype, bool exec) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
461 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
462 // not a railroad crossing? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
463 if ((_map5[tile] & 0xF0) != 0x10) return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
464 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
465 // not owned by me? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
466 if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
467 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
468 // tile is already of requested type? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
469 if ( (uint)(_map3_hi[tile] & 0xF) == totype) return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
470 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
471 if (exec) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
472 // change type. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
473 _map3_hi[tile] = (_map3_hi[tile] & 0xF0) + totype; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
474 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
475 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
476 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
477 return _price.build_rail >> 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
478 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
479 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
480 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
481 // Build a long piece of road. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
482 // x,y = end tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
483 // p1 = start tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
484 // p2&1 = start tile starts in the 2nd half |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
485 // p2&2 = end tile starts in the 2nd half |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
486 // p2&4 = direction (0 = along x, 1=along y) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
487 int32 CmdBuildLongRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
488 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
489 uint start_tile, end_tile, tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
490 int mode; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
491 int32 cost,ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
492 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
493 start_tile = p1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
494 end_tile = TILE_FROM_XY(x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
495 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
496 if (start_tile > end_tile || (start_tile == end_tile && (p2&1))) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
497 uint t = start_tile; start_tile = end_tile; end_tile = t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
498 p2 ^= IS_INT_INSIDE(p2&3, 1, 3) ? 3 : 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
499 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
500 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
501 cost = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
502 tile = start_tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
503 // Start tile is the small number. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
504 for(;;) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
505 mode = (p2&4) ? 5 : 10; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
506 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
507 if (tile == start_tile && (p2&1)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
508 mode &= (4+2); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
509 else if (tile == end_tile && !(p2&2)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
510 mode &= (1+8); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
511 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
512 ret = DoCommandByTile(tile, mode, 0, flags, CMD_BUILD_ROAD); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
513 if (ret == CMD_ERROR) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
514 if (_error_message != STR_1007_ALREADY_BUILT) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
515 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
516 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
517 cost += ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
518 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
519 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
520 if (tile == end_tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
521 break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
522 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
523 tile += (p2&4)?TILE_XY(0,1):TILE_XY(1,0); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
524 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
525 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
526 // already built? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
527 if (cost == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
528 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
529 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
530 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
531 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
532 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
533 // Remove a long piece of road. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
534 // x,y = end tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
535 // p1 = start tile |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
536 // p2&1 = start tile starts in the 2nd half |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
537 // p2&2 = end tile starts in the 2nd half |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
538 // p2&4 = direction (0 = along x, 1=along y) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
539 int32 CmdRemoveLongRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
540 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
541 uint start_tile, end_tile, tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
542 int32 cost,ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
543 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
544 start_tile = p1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
545 end_tile = TILE_FROM_XY(x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
546 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
547 if (start_tile > end_tile || (start_tile == end_tile && (p2&1))) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
548 uint t = start_tile; start_tile = end_tile; end_tile = t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
549 p2 ^= IS_INT_INSIDE(p2&3, 1, 3) ? 3 : 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
550 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
551 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
552 cost = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
553 tile = start_tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
554 // Start tile is the small number. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
555 for(;;) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
556 uint bits = (p2 & 4) ? ROAD_SE | ROAD_NW : ROAD_SW | ROAD_NE; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
557 if (tile == end_tile && !(p2&2)) bits &= ROAD_NW | ROAD_NE; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
558 if (tile == start_tile && (p2&1)) bits &= ROAD_SE | ROAD_SW; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
559 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
560 // try to remove the halves. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
561 if (bits) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
562 ret = DoCommandByTile(tile, bits, 0, flags, CMD_REMOVE_ROAD); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
563 if (ret != CMD_ERROR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
564 cost += ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
565 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
566 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
567 if (tile == end_tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
568 break; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
569 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
570 tile += (p2&4)?TILE_XY(0,1):TILE_XY(1,0); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
571 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
572 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
573 // already built? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
574 if (cost == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
575 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
576 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
577 return cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
578 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
579 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
580 /* Build a road depot |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
581 * p1 - direction (0-3) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
582 * p2 - unused |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
583 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
584 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
585 int32 CmdBuildRoadDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
586 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
587 TileInfo ti; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
588 int32 cost; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
589 Depot *dep; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
590 uint tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
591 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
592 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
593 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
594 FindLandscapeHeight(&ti, x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
595 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
596 tile = ti.tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
597 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
598 if (!EnsureNoVehicle(tile)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
599 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
600 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
601 if (ti.tileh != 0) { |
84
784a9e9bb932
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight <truelight@openttd.org>
parents:
72
diff
changeset
|
602 if (!_patches.build_on_slopes || (ti.tileh & 0x10 || !((0x4C >> p1) & ti.tileh) )) |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
603 return_cmd_error(STR_0007_FLAT_LAND_REQUIRED); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
604 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
605 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
606 cost = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
607 if (cost == CMD_ERROR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
608 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
609 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
610 dep = AllocateDepot(); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
611 if (dep == NULL) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
612 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
613 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
614 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
615 if (_current_player == _local_player) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
616 _last_built_road_depot_tile = (TileIndex)tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
617 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
618 dep->xy = tile; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
619 dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
620 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
621 ModifyTile(tile, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
622 MP_SETTYPE(MP_STREET) | |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
623 MP_MAPOWNER_CURRENT | MP_MAP5, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
624 (p1 | 0x20) /* map5 */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
625 ); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
626 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
627 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
628 return cost + _price.build_road_depot; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
629 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
630 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
631 static int32 RemoveRoadDepot(uint tile, uint32 flags) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
632 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
633 if (!CheckTileOwnership(tile)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
634 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
635 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
636 if (!EnsureNoVehicle(tile)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
637 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
638 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
639 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
640 DoDeleteDepot(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
641 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
642 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
643 return _price.remove_road_depot; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
644 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
645 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
646 #define M(x) (1<<(x)) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
647 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
648 static int32 ClearTile_Road(uint tile, byte flags) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
649 int32 ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
650 byte m5 = _map5[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
651 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
652 if ( (m5 & 0xF0) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
653 byte b = m5 & 0xF; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
654 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
655 if (! ((1 << b) & (M(1)|M(2)|M(4)|M(8))) ) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
656 if ( (!(flags & DC_AI_BUILDING) || _map_owner[tile]!=OWNER_TOWN) && flags&DC_AUTO) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
657 return_cmd_error(STR_1801_MUST_REMOVE_ROAD_FIRST); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
658 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
659 return DoCommandByTile(tile, b, 0, flags, CMD_REMOVE_ROAD); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
660 } else if ( (m5 & 0xE0) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
661 if (flags & DC_AUTO) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
662 return_cmd_error(STR_1801_MUST_REMOVE_ROAD_FIRST); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
663 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
664 ret = DoCommandByTile(tile, (m5&8)?5:10, 0, flags, CMD_REMOVE_ROAD); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
665 if (ret == CMD_ERROR) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
666 return CMD_ERROR; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
667 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
668 if (flags & DC_EXEC) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
669 DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
670 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
671 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
672 return ret; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
673 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
674 if (flags & DC_AUTO) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
675 return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
676 return RemoveRoadDepot(tile,flags); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
677 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
678 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
679 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
680 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
681 typedef struct DrawRoadTileStruct { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
682 uint16 image; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
683 byte subcoord_x; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
684 byte subcoord_y; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
685 } DrawRoadTileStruct; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
686 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
687 typedef struct DrawRoadSeqStruct { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
688 uint32 image; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
689 byte subcoord_x; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
690 byte subcoord_y; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
691 byte width; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
692 byte height; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
693 } DrawRoadSeqStruct; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
694 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
695 #include "table/road_land.h" |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
696 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
697 |
84
784a9e9bb932
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight <truelight@openttd.org>
parents:
72
diff
changeset
|
698 uint GetRoadFoundation(uint tileh, uint bits) { |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
699 int i; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
700 // normal level sloped building |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
701 if ((~_valid_tileh_slopes_road[1][tileh] & bits) == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
702 return tileh; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
703 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
704 // inclined sloped building |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
705 if ( ((i=0, tileh == 1) || (i+=2, tileh == 2) || (i+=2, tileh == 4) || (i+=2, tileh == 8)) && |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
706 ((bits == (ROAD_SW | ROAD_NE)) || (i++, bits == (ROAD_NW | ROAD_SE)))) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
707 return i + 15; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
708 |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
709 // rail crossing |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
710 if ((bits & 0x10) && _valid_tileh_slopes_road[2][tileh]) |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
711 return tileh; |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
712 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
713 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
714 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
715 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
716 const byte _road_sloped_sprites[14] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
717 0, 0, 2, 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
718 0, 1, 0, 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
719 3, 0, 0, 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
720 0, 0 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
721 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
722 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
723 static void DrawTile_Road(TileInfo *ti) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
724 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
725 uint32 image; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
726 byte m2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
727 const byte *s; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
728 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
729 if ( (ti->map5 & 0xF0) == 0) { // if it is a road the upper 4 bits are 0 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
730 const DrawRoadTileStruct *drts; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
731 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
732 if (ti->tileh != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
733 int f = GetRoadFoundation(ti->tileh, ti->map5 & 0xF); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
734 if (f) DrawFoundation(ti, f); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
735 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
736 // default sloped sprites.. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
737 if (ti->tileh != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
738 image = _road_sloped_sprites[ti->tileh - 1] + 0x53F; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
739 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
740 image = _road_tile_sprites_1[ti->map5 & 0xF]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
741 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
742 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
743 image = _road_tile_sprites_1[ti->map5 & 0xF]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
744 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
745 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
746 m2 = _map2[ti->tile] & 7; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
747 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
748 if (m2 == 0) image |= 0x3178000; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
749 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
750 if (_map3_hi[ti->tile] & 0x80) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
751 image += 19; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
752 } else if (m2 > 1 && m2 != 6) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
753 image -= 19; /* pavement along the road? */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
754 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
755 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
756 DrawGroundSprite(image); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
757 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
758 if (!(_display_opt & DO_FULL_DETAIL) || _cur_dpi->zoom == 2) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
759 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
760 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
761 if (m2 >= 6) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
762 // roadwork |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
763 DrawGroundSprite(0x586 + ((ti->map5&8)!=0 ? 0 : 1)); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
764 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
765 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
766 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
767 drts = (const DrawRoadTileStruct*)_road_display_table[m2][ti->map5 & 0xF]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
768 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
769 while ((image = drts->image) != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
770 int x = ti->x | drts->subcoord_x; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
771 int y = ti->y | drts->subcoord_y; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
772 byte z = ti->z; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
773 if (ti->tileh != 0) z = GetSlopeZ(x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
774 AddSortableSpriteToDraw(image, x, y, 2, 2, 0x10, z); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
775 drts++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
776 } |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
777 } else if ( (ti->map5 & 0xE0) == 0) { // railroad crossing |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
778 int f = GetRoadFoundation(ti->tileh, ti->map5 & 0xF); |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
779 if (f) DrawFoundation(ti, f); |
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
780 |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
781 image = 0x55B; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
782 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
783 if ( (ti->map5 & 8) != 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
784 image--; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
785 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
786 if ( (ti->map5 & 4) != 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
787 image += 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
788 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
789 if ( _map3_hi[ti->tile] & 0x80) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
790 image += 8; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
791 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
792 m2 = _map2[ti->tile] & 7; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
793 if (m2 == 0) image |= 0x3178000; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
794 if (m2 > 1) image += 4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
795 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
796 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
797 DrawGroundSprite(image + (_map3_hi[ti->tile] & 0xF) * 12); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
798 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
799 uint32 ormod; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
800 int player; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
801 const DrawRoadSeqStruct *drss; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
802 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
803 if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
804 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
805 ormod = 0x315; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
806 player = _map_owner[ti->tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
807 if (player < MAX_PLAYERS) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
808 ormod = PLAYER_SPRITE_COLOR(player); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
809 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
810 s = _road_display_datas[ti->map5 & 0xF]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
811 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
812 DrawGroundSprite(*(uint32*)s); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
813 s += sizeof(uint32); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
814 drss = (DrawRoadSeqStruct*)s; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
815 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
816 while ((image=drss->image) != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
817 if (image & 0x8000) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
818 image |= ormod; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
819 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
820 AddSortableSpriteToDraw(image, ti->x | drss->subcoord_x, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
821 ti->y | drss->subcoord_y, drss->width, drss->height, 0x14, ti->z); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
822 drss++; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
823 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
824 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
825 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
826 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
827 void DrawRoadDepotSprite(int x, int y, int image) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
828 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
829 uint32 ormod; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
830 const DrawRoadSeqStruct *dtss; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
831 const byte *t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
832 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
833 ormod = PLAYER_SPRITE_COLOR(_local_player); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
834 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
835 t = _road_display_datas[image]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
836 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
837 x+=33; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
838 y+=17; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
839 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
840 DrawSprite(*(uint32*)t, x, y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
841 t += sizeof(uint32); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
842 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
843 for(dtss = (DrawRoadSeqStruct *)t; dtss->image != 0; dtss++) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
844 Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
845 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
846 image = dtss->image; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
847 if (image & 0x8000) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
848 image |= ormod; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
849 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
850 DrawSprite(image, x + pt.x, y + pt.y); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
851 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
852 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
853 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
854 uint GetSlopeZ_Road(TileInfo *ti) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
855 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
856 uint z = ti->z; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
857 int th = ti->tileh; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
858 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
859 // check if it's a foundation |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
860 if (ti->tileh != 0) { |
13
c8795721b2d5
(svn r14) Fix: railroad crossings on slopes are now possible
dominik <dominik@openttd.org>
parents:
0
diff
changeset
|
861 if ((ti->map5 & 0xE0) == 0) { /* road or crossing */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
862 uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
863 if (f != 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
864 if (f < 15) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
865 // leveled foundation |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
866 return z + 8; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
867 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
868 // inclined foundation |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
869 th = _inclined_tileh[f - 15]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
870 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
871 } else if ((ti->map5 & 0xF0) == 0x20) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
872 // depot |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
873 return z + 8; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
874 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
875 return GetPartialZ(ti->x&0xF, ti->y&0xF, th) + z; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
876 } |
39
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
877 return z; // normal Z if no slope |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
878 } |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
879 |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
880 uint GetSlopeTileh_Road(TileInfo *ti) |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
881 { |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
882 // check if it's a foundation |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
883 if (ti->tileh != 0) { |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
884 if ((ti->map5 & 0xE0) == 0) { /* road or crossing */ |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
885 uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F); |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
886 if (f != 0) { |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
887 if (f < 15) { |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
888 // leveled foundation |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
889 return 0; |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
890 } |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
891 // inclined foundation |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
892 return _inclined_tileh[f - 15]; |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
893 } |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
894 } else if ((ti->map5 & 0xF0) == 0x20) { |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
895 // depot |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
896 return 0; |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
897 } |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
898 } |
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
899 return ti->tileh; |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
900 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
901 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
902 static void GetAcceptedCargo_Road(uint tile, AcceptedCargo *ac) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
903 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
904 /* not used */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
905 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
906 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
907 static void AnimateTile_Road(uint tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
908 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
909 if ((_map5[tile] & 0xF0) == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
910 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
911 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
912 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
913 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
914 static const byte _town_road_types[5][2] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
915 {1,1}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
916 {2,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
917 {2,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
918 {5,5}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
919 {3,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
920 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
921 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
922 static const byte _town_road_types_2[5][2] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
923 {1,1}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
924 {2,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
925 {3,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
926 {3,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
927 {3,2}, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
928 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
929 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
930 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
931 static void TileLoop_Road(uint tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
932 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
933 Town *t; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
934 int grp; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
935 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
936 if (_opt.landscape == LT_HILLY) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
937 // Fix snow style if the road is above the snowline |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
938 if ((_map3_hi[tile] & 0x80) != ((GetTileZ(tile) > _opt.snow_line) ? 0x80 : 0x00)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
939 _map3_hi[tile] ^= 0x80; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
940 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
941 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
942 } else if (_opt.landscape == LT_DESERT) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
943 // Fix desert style |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
944 if (GetMapExtraBits(tile) == 1 && !(_map3_hi[tile] & 0x80)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
945 _map3_hi[tile] |= 0x80; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
946 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
947 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
948 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
949 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
950 if (_map5[tile] & 0xE0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
951 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
952 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
953 if ((_map2[tile] & 7) < 6) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
954 t = ClosestTownFromTile(tile, (uint)-1); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
955 grp = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
956 if (t != NULL) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
957 // If in the scenario editor, set the owner to a town. |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
958 if (_game_mode == GM_EDITOR) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
959 _map_owner[tile] = OWNER_TOWN; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
960 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
961 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
962 grp = GetTownRadiusGroup(t, tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
963 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
964 // Show an animation to indicate road work |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
965 if (t->road_build_months != 0 && |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
966 !(GetTileDist(t->xy, tile) >= 8 && grp==0) && |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
967 (_map5[tile]==5 || _map5[tile]==10)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
968 if (GetTileSlope(tile, NULL) == 0 && EnsureNoVehicle(tile) && CHANCE16(1,20)) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
969 _map2[tile] = ((_map2[tile]&7) <= 1) ? 6 : 7; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
970 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
971 SndPlayTileFx(0x1F,tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
972 CreateEffectVehicleAbove( |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
973 GET_TILE_X(tile) * 16 + 7, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
974 GET_TILE_Y(tile) * 16 + 7, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
975 0, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
976 EV_ROADWORK); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
977 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
978 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
979 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
980 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
981 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
982 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
983 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
984 const byte *p = (_opt.landscape == LT_CANDY) ? _town_road_types_2[grp] : _town_road_types[grp]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
985 byte b = _map2[tile] & 7; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
986 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
987 if (b == p[0]) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
988 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
989 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
990 if (b == p[1]) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
991 b = p[0]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
992 } else if (b == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
993 b = p[1]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
994 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
995 b = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
996 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
997 _map2[tile] = (_map2[tile] & ~7) | b; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
998 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
999 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1000 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1001 // Handle road work |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1002 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1003 byte b = _map2[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1004 if (b < 0x80) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1005 _map2[tile] = b + 8; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1006 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1007 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1008 _map2[tile] = ((b&7) == 6) ? 1 : 2; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1009 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1010 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1011 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1012 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1013 void ShowRoadDepotWindow(uint tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1014 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1015 static void ClickTile_Road(uint tile) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1016 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1017 if ((_map5[tile] & 0xF0) == 0x20) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1018 ShowRoadDepotWindow(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1019 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1020 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1021 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1022 static const byte _road_trackbits[16] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1023 0x0, 0x0, 0x0, 0x10, 0x0, 0x2, 0x8, 0x1A, 0x0, 0x4, 0x1, 0x15, 0x20, 0x26, 0x29, 0x3F, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1024 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1025 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1026 static uint32 GetTileTrackStatus_Road(uint tile, int mode) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1027 if (mode == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1028 if ((_map5[tile] & 0xF0) != 0x10) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1029 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1030 return _map5[tile] & 8 ? 0x101 : 0x202; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1031 } else if (mode == 2) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1032 byte b = _map5[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1033 if ((b & 0xF0) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1034 if (!_road_special_gettrackstatus && (_map2[tile]&7) >= 6) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1035 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1036 return _road_trackbits[b&0xF] * 0x101; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1037 } else if ((b&0xE0) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1038 uint32 r = 0x101; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1039 if (b&8) r <<= 1; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1040 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1041 if (b&4) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1042 r *= 0x10001; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1043 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1044 return r; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1045 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1046 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1047 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1048 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1049 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1050 static const StringID _road_tile_strings[] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1051 STR_1818_ROAD_RAIL_LEVEL_CROSSING, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1052 STR_1817_ROAD_VEHICLE_DEPOT, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1053 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1054 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1055 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1056 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1057 STR_1815_ROAD_WITH_STREETLIGHTS, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1058 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1059 STR_1816_TREE_LINED_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1060 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1061 STR_1814_ROAD, |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1062 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1063 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1064 static void GetTileDesc_Road(uint tile, TileDesc *td) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1065 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1066 int i = (_map5[tile] >> 4); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1067 if (i == 0) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1068 i = (_map2[tile] & 7) + 3; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1069 td->str = _road_tile_strings[i - 1]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1070 td->owner = _map_owner[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1071 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1072 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1073 static const byte _roadveh_enter_depot_unk0[4] = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1074 8, 9, 0, 1 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1075 }; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1076 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1077 static uint32 VehicleEnter_Road(Vehicle *v, uint tile, int x, int y) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1078 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1079 if ((_map5[tile] & 0xF0) == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1080 if (v->type == VEH_Train && (_map5[tile] & 4) == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1081 /* train crossing a road */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1082 SndPlayVehicleFx(12, v); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1083 _map5[tile] |= 4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1084 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1085 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1086 } else if ((_map5[tile]&0xF0) == 0x20){ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1087 if (v->type == VEH_Road && v->u.road.frame == 11) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1088 if (_roadveh_enter_depot_unk0[_map5[tile]&3] == v->u.road.state) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1089 RoadVehEnterDepot(v); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1090 return 4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1091 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1092 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1093 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1094 return 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1095 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1096 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1097 static void VehicleLeave_Road(Vehicle *v, uint tile, int x, int y) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1098 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1099 if ((_map5[tile] & 0xF0) == 0x10 && v->type == VEH_Train && v->next == NULL) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1100 _map5[tile] &= ~4; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1101 MarkTileDirtyByTile(tile); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1102 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1103 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1104 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1105 static void ChangeTileOwner_Road(uint tile, byte old_player, byte new_player) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1106 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1107 byte b; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1108 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1109 // road/rail crossing where the road is owned by the current player? |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1110 if (old_player == _map3_lo[tile] && (_map5[tile]&0xF0) == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1111 _map3_lo[tile] = (new_player == 0xFF) ? OWNER_NONE : new_player; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1112 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1113 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1114 if (_map_owner[tile] != old_player) |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1115 return; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1116 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1117 if (new_player != 255) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1118 _map_owner[tile] = new_player; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1119 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1120 b = _map5[tile]&0xF0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1121 if (b == 0) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1122 _map_owner[tile] = OWNER_NONE; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1123 } else if (b == 0x10) { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1124 _map5[tile] = (_map5[tile]&8) ? 0x5 : 0xA; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1125 _map_owner[tile] = _map3_lo[tile]; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1126 _map3_lo[tile] = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1127 _map3_hi[tile] &= 0x80; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1128 } else { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1129 DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1130 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1131 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1132 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1133 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1134 void InitializeRoad() |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1135 { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1136 _last_built_road_depot_tile = 0; |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1137 } |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1138 |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1139 const TileTypeProcs _tile_type_road_procs = { |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1140 DrawTile_Road, /* draw_tile_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1141 GetSlopeZ_Road, /* get_slope_z_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1142 ClearTile_Road, /* clear_tile_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1143 GetAcceptedCargo_Road, /* get_accepted_cargo_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1144 GetTileDesc_Road, /* get_tile_desc_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1145 GetTileTrackStatus_Road, /* get_tile_track_status_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1146 ClickTile_Road, /* click_tile_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1147 AnimateTile_Road, /* animate_tile_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1148 TileLoop_Road, /* tile_loop_clear */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1149 ChangeTileOwner_Road, /* change_tile_owner_clear */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1150 NULL, /* get_produced_cargo_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1151 VehicleEnter_Road, /* vehicle_enter_tile_proc */ |
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1152 VehicleLeave_Road, /* vehicle_leave_tile_proc */ |
39
927ba896b4a5
(svn r40) Final slope graphics fix
dominik <dominik@openttd.org>
parents:
22
diff
changeset
|
1153 GetSlopeTileh_Road, /* get_slope_tileh_proc */ |
0
fa6ee4d75c8a
(svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff
changeset
|
1154 }; |