REGoth crashes due to not yet loaded resources
Steps to reproduce:
- Use current master (2d71e247cec81dac3fdaaa365f114d0ebc9c73fb)
- Load
ADDONWORLD.ZEN(Gothic 2) in the world viewer and make sure the init scripts are run (world->runInitScripts();) - Quit the world viewer
- Start the world viewer without deleting the cache
An exception with the description Trying to access a resource that hasn't been loaded yet. will be raised in the function ModelScriptFile::_buildMeshesByNameMap by the call bs::String nameUpperCase = m->getName();.
The exception is most likely a sign that resources are accessed which are not saved as part of the prefab. The "hasn't been loaded yet" is a bit misleading here, as those resources will never be loaded.
The display name of the affected ModelScriptFile is "SCAVANGER" if that helps.
Can you try using the AI branch? I did a lot of work on rtti for worlds which has the init scripts ran because it didn't work.
It seems like this happens only on some ModelScriptFile-resources, SCAVANGER being one of them. If you just ignore those during loading, the world loads fine. I'll commit the workaround, but we should look into what's different for those model script files.