Resolve a string to a content type. */
| 2183 | |
| 2184 | /** Resolve a string to a content type. */ |
| 2185 | static ContentType StringToContentType(std::string_view str) |
| 2186 | { |
| 2187 | static const std::initializer_list<std::pair<std::string_view, ContentType>> content_types = { |
| 2188 | {"base", CONTENT_TYPE_BASE_GRAPHICS}, |
| 2189 | {"newgrf", CONTENT_TYPE_NEWGRF}, |
| 2190 | {"ai", CONTENT_TYPE_AI}, |
| 2191 | {"ailib", CONTENT_TYPE_AI_LIBRARY}, |
| 2192 | {"scenario", CONTENT_TYPE_SCENARIO}, |
| 2193 | {"heightmap", CONTENT_TYPE_HEIGHTMAP}, |
| 2194 | }; |
| 2195 | for (const auto &ct : content_types) { |
| 2196 | if (StrEqualsIgnoreCase(str, ct.first)) return ct.second; |
| 2197 | } |
| 2198 | return CONTENT_TYPE_END; |
| 2199 | } |
| 2200 | |
| 2201 | /** Asynchronous callback */ |
| 2202 | struct ConsoleContentCallback : public ContentCallback { |
no test coverage detected