17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 15:39:20 +02:00
Files
maszyna/launcher/scenery_scanner.cppm
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

94 lines
1.7 KiB
C++

module;
#include <array>
#include <chrono>
#include <deque>
#include <limits>
#include <mutex>
#include <ostream>
#include <type_traits>
#include <unordered_map>
#include <cstddef>
#include <sstream>
#include <memory>
#include <string>
#include <utility>
#include <map>
#include <vector>
#include <filesystem>
export module eu07.launcher.scenery_scanner;
import eu07.global_include.interfaces.itexture;
import eu07.model.texture;
import eu07.utilities.parser;
import eu07.launcher.textures_scanner;
export {
struct dynamic_desc {
std::string name;
std::string drivertype = "nobody";
float offset;
std::string loadtype = "none";
int loadcount;
unsigned int coupling;
std::string params;
std::shared_ptr<ui::vehicle_desc> vehicle;
std::shared_ptr<ui::skin_set> skin;
};
struct trainset_desc {
std::pair<int, int> file_bounds;
std::string description;
std::string name;
std::string track;
float offset { 0.f };
float velocity { 0.f };
std::vector<dynamic_desc> vehicles;
};
struct scenery_desc {
std::filesystem::path path;
std::string name;
std::string description;
std::string category;
std::string image_path;
texture_handle image = 0;
std::vector<std::pair<std::string, std::string>> links;
std::vector<trainset_desc> trainsets;
std::string title() {
if (!name.empty())
return name;
else
return path.stem().string();
}
};
class scenery_scanner {
public:
scenery_scanner(ui::vehicles_bank &bank);
std::vector<scenery_desc> scenarios;
std::map<std::string, std::vector<scenery_desc*>> categories;
void scan();
private:
void scan_scn(std::filesystem::path path);
void parse_trainset(cParser &parser);
void build_categories();
ui::vehicles_bank &bank;
};
} // export