ResearchTree: use a macro to add nodes.

This will look better, IMO.
This commit is contained in:
Guillaume Jacquemin 2021-08-03 23:00:53 +02:00
parent e786cf2d7a
commit 55b15381c6

View file

@ -270,61 +270,63 @@ void ResearchTree::generateEngineTree() {
"Redirection of power into fuel management for more power and acceleration.",
"Power +16, Acceleration +50", ""});
_engineNodes.at(VerseEngine).addChild(_engineNodes.at(MetalPlatings1));
_engineNodes.at(VerseEngine).addChild(_engineNodes.at(HeatTurbines1));
_engineNodes.at(VerseEngine).addChild(_engineNodes.at(LoadedEngine));
_engineNodes.at(LoadedEngine).addChild(_engineNodes.at(Microcontroller1));
_engineNodes.at(LoadedEngine).addChild(_engineNodes.at(CombustionController1));
_engineNodes.at(MetalPlatings1).addChild(_engineNodes.at(ModAlloyEngine));
_engineNodes.at(HeatTurbines1).addChild(_engineNodes.at(ChargedEngine));
_engineNodes.at(Microcontroller1).addChild(_engineNodes.at(ChargedEngine));
_engineNodes.at(CombustionController1).addChild(_engineNodes.at(ReinforcedLoadedEngine));
_engineNodes.at(ModAlloyEngine).addChild(_engineNodes.at(MetalPlatings2));
_engineNodes.at(ModAlloyEngine).addChild(_engineNodes.at(HeatTurbines2));
_engineNodes.at(ChargedEngine).addChild(_engineNodes.at(HeatTurbines2));
_engineNodes.at(ChargedEngine).addChild(_engineNodes.at(Microcontroller2));
_engineNodes.at(ChargedEngine).addChild(_engineNodes.at(WeaponsCargo1));
_engineNodes.at(ReinforcedLoadedEngine).addChild(_engineNodes.at(CombustionController2));
_engineNodes.at(ReinforcedLoadedEngine).addChild(_engineNodes.at(PoweredRewiring1));
_engineNodes.at(ReinforcedLoadedEngine).addChild(_engineNodes.at(HeavyImpactsEnabler));
_engineNodes.at(MetalPlatings2).addChild(_engineNodes.at(ModSteelEngine));
_engineNodes.at(HeatTurbines2).addChild(_engineNodes.at(SuperchargedEngine));
_engineNodes.at(Microcontroller2).addChild(_engineNodes.at(SuperchargedEngine));
_engineNodes.at(WeaponsCargo1).addChild(_engineNodes.at(SuperchargedEngine));
_engineNodes.at(CombustionController2).addChild(_engineNodes.at(NecriumAlloyEngine));
_engineNodes.at(PoweredRewiring1).addChild(_engineNodes.at(NecriumAlloyEngine));
_engineNodes.at(ModSteelEngine).addChild(_engineNodes.at(MetalPlatings3));
_engineNodes.at(ModSteelEngine).addChild(_engineNodes.at(HeatTurbines3));
_engineNodes.at(SuperchargedEngine).addChild(_engineNodes.at(HeatTurbines3));
_engineNodes.at(SuperchargedEngine).addChild(_engineNodes.at(Microcontroller3));
_engineNodes.at(SuperchargedEngine).addChild(_engineNodes.at(WeaponsCargo2));
_engineNodes.at(NecriumAlloyEngine).addChild(_engineNodes.at(WeaponsCargo2));
_engineNodes.at(NecriumAlloyEngine).addChild(_engineNodes.at(CombustionController3));
_engineNodes.at(NecriumAlloyEngine).addChild(_engineNodes.at(PoweredRewiring2));
_engineNodes.at(MetalPlatings3).addChild(_engineNodes.at(ModLunariteEngine));
_engineNodes.at(HeatTurbines3).addChild(_engineNodes.at(ChargedLunariteEngine));
_engineNodes.at(Microcontroller3).addChild(_engineNodes.at(ChargedLunariteEngine));
_engineNodes.at(WeaponsCargo2).addChild(_engineNodes.at(ChargedLunariteEngine));
_engineNodes.at(CombustionController3).addChild(_engineNodes.at(LunariteEngine));
_engineNodes.at(PoweredRewiring2).addChild(_engineNodes.at(LunariteEngine));
_engineNodes.at(ModLunariteEngine).addChild(_engineNodes.at(InfusedEngine));
_engineNodes.at(ModLunariteEngine).addChild(_engineNodes.at(MetalPlatings4));
_engineNodes.at(ChargedLunariteEngine).addChild(_engineNodes.at(HeatTurbines4));
_engineNodes.at(ChargedLunariteEngine).addChild(_engineNodes.at(Microcontroller4));
_engineNodes.at(ChargedLunariteEngine).addChild(_engineNodes.at(WeaponsCargo3));
_engineNodes.at(LunariteEngine).addChild(_engineNodes.at(CombustionController4));
_engineNodes.at(LunariteEngine).addChild(_engineNodes.at(PoweredRewiring3));
_engineNodes.at(InfusedEngine).addChild(_engineNodes.at(ArmouredCargo1));
_engineNodes.at(InfusedEngine).addChild(_engineNodes.at(ArmouredFuelTank1));
_engineNodes.at(MetalPlatings4).addChild(_engineNodes.at(ArmouredCargo1));
_engineNodes.at(MetalPlatings4).addChild(_engineNodes.at(ArmouredFuelTank1));
_engineNodes.at(HeatTurbines4).addChild(_engineNodes.at(ExtraCapacity1));
_engineNodes.at(Microcontroller4).addChild(_engineNodes.at(ExtraCapacity1));
_engineNodes.at(WeaponsCargo3).addChild(_engineNodes.at(ExtraCapacity1));
_engineNodes.at(CombustionController4).addChild(_engineNodes.at(HighmetalEngine));
_engineNodes.at(CombustionController4).addChild(_engineNodes.at(PowerRedirector1));
_engineNodes.at(PoweredRewiring3).addChild(_engineNodes.at(HighmetalEngine));
_engineNodes.at(PoweredRewiring3).addChild(_engineNodes.at(PowerRedirector1));
#define engineAddChild(parent, child) _engineNodes.at(parent).addChild(_engineNodes.at(child));
engineAddChild(VerseEngine, MetalPlatings1)
engineAddChild(VerseEngine, HeatTurbines1)
engineAddChild(VerseEngine, LoadedEngine)
engineAddChild(LoadedEngine, Microcontroller1)
engineAddChild(LoadedEngine, CombustionController1)
engineAddChild(MetalPlatings1, ModAlloyEngine)
engineAddChild(HeatTurbines1, ChargedEngine)
engineAddChild(Microcontroller1, ChargedEngine)
engineAddChild(CombustionController1, ReinforcedLoadedEngine)
engineAddChild(ModAlloyEngine, MetalPlatings2)
engineAddChild(ModAlloyEngine, HeatTurbines2)
engineAddChild(ChargedEngine, HeatTurbines2)
engineAddChild(ChargedEngine, Microcontroller2)
engineAddChild(ChargedEngine, WeaponsCargo1)
engineAddChild(ReinforcedLoadedEngine, CombustionController2)
engineAddChild(ReinforcedLoadedEngine, PoweredRewiring1)
engineAddChild(ReinforcedLoadedEngine, HeavyImpactsEnabler)
engineAddChild(MetalPlatings2, ModSteelEngine)
engineAddChild(HeatTurbines2, SuperchargedEngine)
engineAddChild(Microcontroller2, SuperchargedEngine)
engineAddChild(WeaponsCargo1, SuperchargedEngine)
engineAddChild(CombustionController2, NecriumAlloyEngine)
engineAddChild(PoweredRewiring1, NecriumAlloyEngine)
engineAddChild(ModSteelEngine, MetalPlatings3)
engineAddChild(ModSteelEngine, HeatTurbines3)
engineAddChild(SuperchargedEngine, HeatTurbines3)
engineAddChild(SuperchargedEngine, Microcontroller3)
engineAddChild(SuperchargedEngine, WeaponsCargo2)
engineAddChild(NecriumAlloyEngine, WeaponsCargo2)
engineAddChild(NecriumAlloyEngine, CombustionController3)
engineAddChild(NecriumAlloyEngine, PoweredRewiring2)
engineAddChild(MetalPlatings3, ModLunariteEngine)
engineAddChild(HeatTurbines3, ChargedLunariteEngine)
engineAddChild(Microcontroller3, ChargedLunariteEngine)
engineAddChild(WeaponsCargo2, ChargedLunariteEngine)
engineAddChild(CombustionController3, LunariteEngine)
engineAddChild(PoweredRewiring2, LunariteEngine)
engineAddChild(ModLunariteEngine, InfusedEngine)
engineAddChild(ModLunariteEngine, MetalPlatings4)
engineAddChild(ChargedLunariteEngine, HeatTurbines4)
engineAddChild(ChargedLunariteEngine, Microcontroller4)
engineAddChild(ChargedLunariteEngine, WeaponsCargo3)
engineAddChild(LunariteEngine, CombustionController4)
engineAddChild(LunariteEngine, PoweredRewiring3)
engineAddChild(InfusedEngine, ArmouredCargo1)
engineAddChild(InfusedEngine, ArmouredFuelTank1)
engineAddChild(MetalPlatings4, ArmouredCargo1)
engineAddChild(MetalPlatings4, ArmouredFuelTank1)
engineAddChild(HeatTurbines4, ExtraCapacity1)
engineAddChild(Microcontroller4, ExtraCapacity1)
engineAddChild(WeaponsCargo3, ExtraCapacity1)
engineAddChild(CombustionController4, HighmetalEngine)
engineAddChild(CombustionController4, PowerRedirector1)
engineAddChild(PoweredRewiring3, HighmetalEngine)
engineAddChild(PoweredRewiring3, PowerRedirector1)
#undef engineAddChild
_engineNodes.at(VerseEngine).setState(Node::State::Unlocked);
}
@ -356,11 +358,13 @@ void ResearchTree::generateOSTree() {
"Controlling module that helps in stabilisation for higher accuracy and reload speed.",
"Accuracy +2, Fuel burn rate +50, Magazine reload +25, Energy recharge +33", ""});
_osNodes.at(NeuralOS).addChild(_osNodes.at(Shields1));
_osNodes.at(NeuralOS).addChild(_osNodes.at(Enhancements1));
_osNodes.at(NeuralOS).addChild(_osNodes.at(ExoSkelOS));
_osNodes.at(ExoSkelOS).addChild(_osNodes.at(FuelSave1));
_osNodes.at(ExoSkelOS).addChild(_osNodes.at(LongRange1));
#define osAddChild(parent, child) _osNodes.at(parent).addChild(_osNodes.at(child));
osAddChild(NeuralOS, Shields1)
osAddChild(NeuralOS, Enhancements1)
osAddChild(NeuralOS, ExoSkelOS)
osAddChild(ExoSkelOS, FuelSave1)
osAddChild(ExoSkelOS, LongRange1)
#undef osAddChild
_osNodes.at(NeuralOS).setState(Node::State::Unlocked);
}
@ -375,6 +379,9 @@ void ResearchTree::generateArchTree() {
"Durability +300, Shield +200, Physical damage +600, Piercing damage +300, Plasma damage +300",
""});
#define archAddChild(parent, child) _archNodes.at(parent).addChild(_archNodes.at(child));
#undef archAddChild
_archNodes.at(StandardFrame).setState(Node::State::Unlocked);
}