| 46 | static df::tiletype tile_to_mat[NUM_CVTABLES][NUM_TILETYPES]; |
| 47 | |
| 48 | static df::tiletype find_match( |
| 49 | df::tiletype_material mat, df::tiletype_shape shape, df::tiletype_special special, |
| 50 | std::string dir, df::tiletype_variant variant, bool warn |
| 51 | ) { |
| 52 | using namespace df::enums::tiletype_shape; |
| 53 | using namespace df::enums::tiletype_special; |
| 54 | |
| 55 | if (mat < 0 || mat >= NUM_MATERIALS) |
| 56 | return tiletype::Void; |
| 57 | |
| 58 | auto &sh_map = tile_table[mat]; |
| 59 | |
| 60 | if (!sh_map.count(shape)) |
| 61 | { |
| 62 | if (warn) |
| 63 | { |
| 64 | fmt::print( |
| 65 | stderr, "NOTE: No shape {} in {}.\n", |
| 66 | enum_item_key(shape), enum_item_key(mat) |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | switch (shape) |
| 71 | { |
| 72 | case BROOK_BED: |
| 73 | if (sh_map.count(FORTIFICATION)) { shape = FORTIFICATION; break; } |
| 74 | |
| 75 | case FORTIFICATION: |
| 76 | if (sh_map.count(WALL)) { shape = WALL; break; } |
| 77 | return tiletype::Void; |
| 78 | |
| 79 | case BROOK_TOP: |
| 80 | case BOULDER: |
| 81 | case PEBBLES: |
| 82 | if (sh_map.count(FLOOR)) { shape = FLOOR; break; } |
| 83 | return tiletype::Void; |
| 84 | |
| 85 | default: |
| 86 | return tiletype::Void; |
| 87 | }; |
| 88 | } |
| 89 | |
| 90 | auto &sp_map = sh_map[shape]; |
| 91 | |
| 92 | if (!sp_map.count(special)) |
| 93 | { |
| 94 | if (warn) |
| 95 | { |
| 96 | fmt::print( |
| 97 | stderr, "NOTE: No special {} in {}:{}.\n", |
| 98 | enum_item_key(special), enum_item_key(mat), |
| 99 | enum_item_key(shape) |
| 100 | ); |
| 101 | } |
| 102 | |
| 103 | switch (special) |
| 104 | { |
| 105 | case TRACK: |
no test coverage detected