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
1 changed files with 67 additions and 60 deletions

View File

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