equal
deleted
inserted
replaced
8 #include "newgrf.h" |
8 #include "newgrf.h" |
9 #include "newgrf_callbacks.h" |
9 #include "newgrf_callbacks.h" |
10 #include "newgrf_commons.h" |
10 #include "newgrf_commons.h" |
11 #include "newgrf_spritegroup.h" |
11 #include "newgrf_spritegroup.h" |
12 #include "newgrf_canal.h" |
12 #include "newgrf_canal.h" |
|
13 #include "tile_map.h" |
|
14 #include "water_map.h" |
13 |
15 |
14 |
16 |
15 /** Table of canal 'feature' sprite groups */ |
17 /** Table of canal 'feature' sprite groups */ |
16 const SpriteGroup *_canal_sg[CF_END]; |
18 WaterFeature _water_feature[CF_END]; |
17 |
19 |
18 |
20 |
19 /* Random bits and triggers are not supported for canals, so the following |
21 /* Random bits and triggers are not supported for canals, so the following |
20 * three functions are stubs. */ |
22 * three functions are stubs. */ |
21 static uint32 CanalGetRandomBits(const ResolverObject *object) |
23 static uint32 CanalGetRandomBits(const ResolverObject *object) |
22 { |
24 { |
23 return 0; |
25 return GetWaterTileRandomBits(object->u.canal.tile); |
24 } |
26 } |
25 |
27 |
26 |
28 |
27 static uint32 CanalGetTriggers(const ResolverObject *object) |
29 static uint32 CanalGetTriggers(const ResolverObject *object) |
28 { |
30 { |
44 case 0x80: |
46 case 0x80: |
45 return GetTileZ(tile) / TILE_HEIGHT; |
47 return GetTileZ(tile) / TILE_HEIGHT; |
46 |
48 |
47 case 0x81: |
49 case 0x81: |
48 return GetTerrainType(tile); |
50 return GetTerrainType(tile); |
|
51 |
|
52 case 0x83: |
|
53 return GetWaterTileRandomBits(tile); |
49 } |
54 } |
50 |
55 |
51 DEBUG(grf, 1, "Unhandled canal property 0x%02X", variable); |
56 DEBUG(grf, 1, "Unhandled canal property 0x%02X", variable); |
52 |
57 |
53 *available = false; |
58 *available = false; |
87 ResolverObject object; |
92 ResolverObject object; |
88 const SpriteGroup *group; |
93 const SpriteGroup *group; |
89 |
94 |
90 NewCanalResolver(&object, tile); |
95 NewCanalResolver(&object, tile); |
91 |
96 |
92 group = Resolve(_canal_sg[feature], &object); |
97 group = Resolve(_water_feature[feature].group, &object); |
93 if (group == NULL || group->type != SGT_RESULT) return 0; |
98 if (group == NULL || group->type != SGT_RESULT) return 0; |
94 |
99 |
95 return group->g.result.sprite; |
100 return group->g.result.sprite; |
96 } |
101 } |