by tdammers » Mon Jul 30, 2018 6:52 am
Could you make it such that instead of arbitrary integer indexes, you'd use something standardized, like ICAO type codes for civil aircraft, and military codes for military aircraft? You probably still need to extend the system to cater for different configurations of the same type (e.g., DHC6 with wheels, tundra wheels, skis or floats), but I don't think that would be an unsurmountable problem.
Arbitrary integers have a number of problems that would be avoided this way:
- Compatibility between fallback_models.xml versions: what if my fallback_models.xml has a different aircraft type at index 8? To avoid this, the development of individual aircraft and of the centrally-distributed fallback_models.xml must be synchronized, and we already have too many dependencies between fg core, fgdata, and add-ons.
- Multi-level fallbacks: e.g. say you encounter a 777-200ER; if you want to provide multiple fallback candidates to be tried in order, you now have to list them in the model file itself. But with the ICAO code approach, this information could be embedded in the code system itself: the aircraft would just specify as its fallback model "B772-ER", where the "B772" part is the standard ICAO code, and the "-ER" part is custom, and then you'd first look for the full code in the fallbacks, and, not having found it, try just the ICAO code "B772". After that, the system might even be smart enough to also try "B777", but that would require some more magic on the fallback_models.xml side of things.
- Concurrent development is impeded. Say you and I both develop new multiplayer model; you add an A320, I add a 737. We both add an entry to our local copies of fallback_models.xml, and we both do the logical thing of picking the next integer index, let's say 37. To test it, you add 37 as the MP fallback to all your A320 models, while I add 37 as the fallback to all my 737 flavours. But now comes the time to integrate both our changes, and whoever does the merge has to make the impossible decisions whose code they want to break - either the A320 becomes #37, but then my 737s all need to be fixed to use #38; or the 737 becomes #37, but then all your A320s need fixing. But if we were to use ICAO codes, then nothing bad will happen: you pick "A320", I pick "B735", and when it's time to merge, all the merge committer will have to decide is which one to list first in the XML, a decision that has absolutely no impact whatsoever.