It might help, I'm not sure, I'll have to look at it again.
However, I will still likely go for the full solution.
I feel some modders will not accept just one type, and "force" me to implement multiple types later anyway... and it's better for me to do it that way from the start. Splitting it into two phases will again likely make it more complicated around backwards-compatibility (I'd have to be backwards-compatible not only with vanilla but also with phase 1 solution).
As for solving the "sorting/assigning mini-game", I already have a solution for that... it will be purely manual, the player will be forced to do it
Real-world mini-games are going to be much less complicated than a generic algorithm I'd have to do for worst cases.
And the manual mini-game GUI is necessary anyway for when the player wants to move craft within available hangars to allow buying/manufacturing more craft.
Hello,
are you considering a lot of different types of crafts? Or just big/small? If it's the later, I've developed a variation of your code in which every craft has an "assigned" variable, so it's possible to know if that kind is already allocated in the next facilities to draw. Sadly, it's necessary to check for all the crafts when drawing every hangar facility -and its crafts-, until you find the more apropriate, but as vector-of-crafts it's not expected to be large, I think it works well.
Facilities for small-crafts-only are allocated at the front of the facilities vector when created, so "smallcrafts" are assigned first at small slots, and then, when all small slots are busy, all types of crafts are allocated at big slots.
In craft rules you must use a key for big/small craft (no key=big); in facilities rules (hangar type), you should use another key for "allow_only_small_crafts/allow_any_craft" (no key = any craft).
I also added to hangars rules, when they can contain more than 1 craft, a list of positions for the crafts sprites in the hangar tile (offsets with respect to the center of the tile). This way you can allocate more than 1 craft in a Hangar, and see the crafts in the BaseEscape.
I've made some tests, and draw routine works well, though there are a lot of changes to do -and mainly, to test- yet, regarding rules of acquisitions/manufcaturing/transfers and so on. At now purchase-of-crafts seems to work well too, observing rules of which-crafts-can-be-purchased depending of free (big/small) slots; manufacture of crafts seems to work also; I've not touched transfers yet, but I think it could be done using similar structures than in purchase/manufacture.
I must work also on what happens when an hangar is destroyed, as if there is more than 1 craft, current rules of craft destruction (based on the sprite at the hangar tile) must be reworked.
I'm sure that changes you are doing towards this feature will be better, but I don't know if I could be any help towards the introduction of this feature. If so, please let me know.
Finally, thanks a lot for your work with this engine. Xcom was one of mi favourite games when I was a child, and it was a big-pleasant surprise when I found this great port. Not only to play again, with better and polished mechanics, but also for the opportunity to learn about how it works.