18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 22:55:16 +01:00
Files
maszyna/world/SleeperModels.cpp
jerrrrycho 7059644209 fix(editor): a model file named outside the code page no longer crashes the first track selection (#470)
* fix(editor): a model file named outside the code page no longer crashes the first track selection

The first selection of a track builds the track property list, and with
it the sleeper and timber model choices. pack_models() walked the whole
models/ tree and turned the name of every .t3d/.e3d into a narrow string
before looking at whether it was a sleeper at all. On Windows that goes
through the ANSI code page, so a single model file anywhere under models/
named with a character the code page lacks threw std::system_error
"No mapping for the Unicode character exists in the target multi-byte
code page" out of the editor frame and the editor stopped (GE#560).

The conversions are now in a try, as in the editor's other folder scans:
a file whose name can't be converted is left out (the game couldn't load
it by that name anyway) and the scan goes on. Names that convert give the
same list as before.

The scan itself moved to world/SleeperPack.cpp in the core library as
pack_models(root), which pack_models() calls once with models/, so the
unit tests can run it on a folder of their own.

* fix(launcher): a vehicle folder named outside the code page is skipped by the skin scan

scan_textures() keeps the folder of each textures.txt as a wide path and
get_vehicle() turns it into a narrow name with no try. On Windows a
folder under dynamic/ named with a character the code page lacks threw
the same std::system_error out of the editor's vehicle tool, the
launcher and the vehicle picker. Such a folder is now left out of the
scan, as the model scan does with such a file.
2026-11-25 05:13:18 +01:00

9.2 KiB