My implementation of Hangar mods, had this "-1" wildcard already. If rules for crafts didn't have an entry for hangar type, they were automatically assigned a "-1" Id, which corresponds with the default id for vanilla hangar.
This way my OXCE engine version didn't break mods made for official OXCE+ branch.
I'm sure Meridian has special care with compatibility for previous mods, so probably he has in mind a similar mechanism.
First I just want to say thank you! for implementing this as a short term solution! I really appreciate all your work!
The capability I'm looking for is if I have a hangar type -1 (the original 2x2 hangar), automobiles are craft type 1 and aircrafts are craft type 0, I want both to be able be able to go into (the original 2x2 hangar) with a hangar type -1, and if I have a different hangar that is hangar type 0 then only aircrafts could go in there and not automobiles and hangarType 1 only automobiles. Currently the issues I'm having is where I have a hangar type -1 (the original 2x2 hangar), then I have to set aircrafts to craftType -1 for them to be stored there, if I set aircrafts to craftType 0 then they won't go into hangarType -1.
The code implementation I think would work would be to crate a sum of hayngar types and crafts types
Example:
Garage = (size 1x1) capacity (1) hangarType (1)
Original Hangar = (size 2x2) capacity (1) hangarType (-1)
Aerodock = (size 2x2) capacity (3) hangarType (0)
Base has (0 crafts), (2 garages), (1 original hangar)
Space:
hangarType 0 = (1 spaces)
hangarType 1 = (2 spaces)
hangarType -1 = (1 spaces)
1.) add craftType 1,
- check hangarType 1 spaces available,
- if available then count against hangerType 1
- if no spaces left in hangarType 1, then check if hangarType -1 spaces available
- if available then count against hangarType -1
- if no spaces left in hangarType -1, then present GUI error "no craft spaces available"
2.) add craftType 0
- check hangarType 0 spaces available,
- if available then count against hangerType 0
- if no spaces left in hangarType 1, then check if hangarType -1 spaces available
- if available then count against hangarType -1
- if no spaces left in hangarType -1, then present GUI error "no craft spaces available"
follow this same logic for additional hangar types, you's also have to key track of what crafts types are stored in hangar type -1,
for example base has hangarType -1 (space available = 3)
1.) store craftType 0 in hangarType -1, hangarType -1 (stored spaces = craftTypes [{0, 1}]
next store craftType 1 in hangar type -1, hangarType -1 (stored spaces = craftTypes [{0, 1}, {1, 1}]
next store craftType 0, hangarType -1 (stored spaces = craftTypes [{0, 2}, {1, 1}]
when removing crafts from the base, sell or transfer, logic would always check hangerType -1 first and remove the craft from that hangar 1st before removing craftType 0 from hangarType 0 where 2 craftType 0 are being stored, one in hangarType 0, and one in hangarType -1
For backwards compatibility would be that if a hangarType is unspecified for a hangar then it's -1, and if a craftType for a craft isn't specified, then it's -1, and craftType -1 can only go into hangarType -1.
Related Posts
------------------------------
https://openxcom.org/forum/index.php/topic,11590.0.html