#pragma once #include "Texture.h" namespace ui { enum class vehicle_type { none = -1, electric_loco, diesel_loco, steam_loco, railcar, emu, utility, draisine, tram, carriage, truck, bus, car, man, animal, unknown }; class deferred_image { public: deferred_image() = default; deferred_image(const std::string &p) : path(p) { } deferred_image(const deferred_image&) = delete; deferred_image(deferred_image&&) = default; deferred_image &operator=(deferred_image&&) = default; operator bool() const; GLuint get() const; glm::ivec2 size() const; private: mutable std::string path; mutable texture_handle image = 0; }; struct skin_set { std::vector skins; deferred_image mini; std::string group; }; struct vehicle_desc; struct texture_rule { std::shared_ptr previous_vehicle; std::vector> replace_rules; }; struct coupling_rule { std::shared_ptr coupled_vehicle; int coupling_flag; }; struct vehicle_desc { vehicle_type type; std::filesystem::path path; std::vector matching_skinsets; std::vector coupling_rules; std::vector texture_rules; }; class vehicles_bank { public: std::unordered_map category_icons; std::map group_icons; std::map> vehicles; std::map>> group_map; void scan_textures(); private: void parse_entry(const std::string &line); void parse_category_entry(const std::string ¶m); void parse_coupling_rule(const std::string &target, const std::string ¶m); void parse_texture_rule(const std::string &target, const std::string ¶m); void parse_texture_info(const std::string &target, const std::string ¶m, const std::string &comment); std::shared_ptr get_vehicle(const std::string &name); vehicle_type ctx_type = vehicle_type::unknown; std::filesystem::path ctx_path; std::string ctx_model; }; }