|
23 | 23 | #include "modules/Buildings.h"
|
24 | 24 |
|
25 | 25 | #include <map>
|
26 |
| - |
| 26 | +#include <limits> |
27 | 27 | using namespace DFHack;
|
28 | 28 | using namespace df::enums;
|
29 | 29 |
|
30 | 30 | DFHACK_PLUGIN("building-hacks");
|
31 | 31 | REQUIRE_GLOBAL(world);
|
32 | 32 |
|
| 33 | +constexpr uint32_t invalid_tile = std::numeric_limits<uint32_t>::max(); |
33 | 34 | struct graphic_tile //could do just 31x31 and be done, but it's nicer to have flexible imho.
|
34 | 35 | {
|
35 | 36 | int16_t tile=-1; //originally uint8_t but we need to indicate non-animated tiles
|
36 | 37 | int8_t fore;
|
37 | 38 | int8_t back;
|
38 | 39 | int8_t bright;
|
39 | 40 | //index of texpos
|
40 |
| - uint32_t graphics_tile = -1; |
41 |
| - uint32_t overlay_tile = -1; |
42 |
| - uint32_t item_tile = -1; |
| 41 | + uint32_t graphics_tile = invalid_tile; |
| 42 | + uint32_t overlay_tile = invalid_tile; |
| 43 | + uint32_t item_tile = invalid_tile; |
43 | 44 | //only for first line
|
44 |
| - uint32_t signpost_tile = -1; |
| 45 | + uint32_t signpost_tile = invalid_tile; |
45 | 46 | };
|
46 | 47 | struct workshop_hack_data
|
47 | 48 | {
|
@@ -304,14 +305,14 @@ struct work_hook : df::building_workshopst{
|
304 | 305 | db->bright[tx][ty]= cf.bright;
|
305 | 306 | db->fore[tx][ty]= cf.fore;
|
306 | 307 | }
|
307 |
| - if (cf.graphics_tile != -1) |
| 308 | + if (cf.graphics_tile != invalid_tile) |
308 | 309 | db->building_one_texpos[tx][ty] = cf.graphics_tile;
|
309 |
| - if (cf.overlay_tile != -1) |
| 310 | + if (cf.overlay_tile != invalid_tile) |
310 | 311 | db->building_two_texpos[tx][ty] = cf.overlay_tile;
|
311 |
| - if (cf.item_tile != -1) |
| 312 | + if (cf.item_tile != invalid_tile) |
312 | 313 | db->item_texpos[tx][ty] = cf.item_tile;
|
313 | 314 | //only first line has signpost graphics
|
314 |
| - if (cf.item_tile != -1 && ty==0) |
| 315 | + if (cf.item_tile != invalid_tile && ty==0) |
315 | 316 | db->signpost_texpos[tx] = cf.signpost_tile;
|
316 | 317 | }
|
317 | 318 | }
|
|
0 commit comments