CommonLibSSE (Parapets fork)
FormTraits.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/A/Actor.h"
4 #include "RE/A/ActorValueInfo.h"
5 #include "RE/A/AlchemyItem.h"
6 #include "RE/A/ArrowProjectile.h"
8 #include "RE/B/BGSAction.h"
9 #include "RE/B/BGSAddonNode.h"
10 #include "RE/B/BGSApparatus.h"
11 #include "RE/B/BGSArtObject.h"
13 #include "RE/B/BGSBodyPartData.h"
14 #include "RE/B/BGSCameraPath.h"
15 #include "RE/B/BGSCameraShot.h"
16 #include "RE/B/BGSCollisionLayer.h"
17 #include "RE/B/BGSColorForm.h"
19 #include "RE/B/BGSDebris.h"
21 #include "RE/B/BGSDialogueBranch.h"
22 #include "RE/B/BGSDualCastData.h"
23 #include "RE/B/BGSEncounterZone.h"
24 #include "RE/B/BGSEquipSlot.h"
25 #include "RE/B/BGSExplosion.h"
26 #include "RE/B/BGSFootstep.h"
27 #include "RE/B/BGSFootstepSet.h"
28 #include "RE/B/BGSHazard.h"
29 #include "RE/B/BGSHeadPart.h"
30 #include "RE/B/BGSIdleMarker.h"
31 #include "RE/B/BGSImpactData.h"
32 #include "RE/B/BGSImpactDataSet.h"
33 #include "RE/B/BGSKeyword.h"
34 #include "RE/B/BGSLensFlare.h"
36 #include "RE/B/BGSListForm.h"
37 #include "RE/B/BGSLocation.h"
39 #include "RE/B/BGSMaterialObject.h"
40 #include "RE/B/BGSMaterialType.h"
41 #include "RE/B/BGSMenuIcon.h"
42 #include "RE/B/BGSMessage.h"
43 #include "RE/B/BGSMovableStatic.h"
44 #include "RE/B/BGSMovementType.h"
46 #include "RE/B/BGSMusicType.h"
47 #include "RE/B/BGSNote.h"
48 #include "RE/B/BGSOutfit.h"
49 #include "RE/B/BGSPerk.h"
50 #include "RE/B/BGSProjectile.h"
51 #include "RE/B/BGSRagdoll.h"
53 #include "RE/B/BGSRelationship.h"
55 #include "RE/B/BGSScene.h"
57 #include "RE/B/BGSSoundCategory.h"
59 #include "RE/B/BGSSoundOutput.h"
65 #include "RE/B/BGSTextureSet.h"
66 #include "RE/B/BGSVoiceType.h"
68 #include "RE/B/BarrierProjectile.h"
69 #include "RE/B/BeamProjectile.h"
70 #include "RE/C/Character.h"
71 #include "RE/C/ConeProjectile.h"
72 #include "RE/E/EffectSetting.h"
73 #include "RE/E/EnchantmentItem.h"
74 #include "RE/F/FlameProjectile.h"
75 #include "RE/G/GrenadeProjectile.h"
76 #include "RE/H/Hazard.h"
77 #include "RE/I/IngredientItem.h"
78 #include "RE/M/MissileProjectile.h"
79 #include "RE/N/NavMesh.h"
80 #include "RE/N/NavMeshInfoMap.h"
81 #include "RE/P/PlayerCharacter.h"
82 #include "RE/S/Script.h"
83 #include "RE/S/ScrollItem.h"
84 #include "RE/S/SpellItem.h"
85 #include "RE/T/TESAmmo.h"
86 #include "RE/T/TESClass.h"
87 #include "RE/T/TESClimate.h"
88 #include "RE/T/TESCombatStyle.h"
89 #include "RE/T/TESEffectShader.h"
90 #include "RE/T/TESEyes.h"
91 #include "RE/T/TESFaction.h"
92 #include "RE/T/TESFlora.h"
93 #include "RE/T/TESForm.h"
94 #include "RE/T/TESFurniture.h"
95 #include "RE/T/TESGlobal.h"
96 #include "RE/T/TESGrass.h"
97 #include "RE/T/TESIdleForm.h"
98 #include "RE/T/TESImageSpace.h"
100 #include "RE/T/TESKey.h"
101 #include "RE/T/TESLandTexture.h"
102 #include "RE/T/TESLevCharacter.h"
103 #include "RE/T/TESLevItem.h"
104 #include "RE/T/TESLevSpell.h"
105 #include "RE/T/TESLoadScreen.h"
106 #include "RE/T/TESNPC.h"
107 #include "RE/T/TESObjectACTI.h"
108 #include "RE/T/TESObjectANIO.h"
109 #include "RE/T/TESObjectARMA.h"
110 #include "RE/T/TESObjectARMO.h"
111 #include "RE/T/TESObjectBOOK.h"
112 #include "RE/T/TESObjectCELL.h"
113 #include "RE/T/TESObjectCONT.h"
114 #include "RE/T/TESObjectDOOR.h"
115 #include "RE/T/TESObjectLAND.h"
116 #include "RE/T/TESObjectLIGH.h"
117 #include "RE/T/TESObjectMISC.h"
118 #include "RE/T/TESObjectREFR.h"
119 #include "RE/T/TESObjectSTAT.h"
120 #include "RE/T/TESObjectTREE.h"
121 #include "RE/T/TESObjectWEAP.h"
122 #include "RE/T/TESPackage.h"
123 #include "RE/T/TESQuest.h"
124 #include "RE/T/TESRace.h"
125 #include "RE/T/TESRegion.h"
126 #include "RE/T/TESShout.h"
127 #include "RE/T/TESSoulGem.h"
128 #include "RE/T/TESSound.h"
129 #include "RE/T/TESTopic.h"
130 #include "RE/T/TESTopicInfo.h"
131 #include "RE/T/TESWaterForm.h"
132 #include "RE/T/TESWeather.h"
133 #include "RE/T/TESWordOfPower.h"
134 #include "RE/T/TESWorldSpace.h"
135 
136 #define SKSE_FORMTRAITS(a_elem) \
137  case a_elem::FORMTYPE: \
138  if constexpr (std::is_convertible_v<const a_elem*, const T*>) { \
139  return static_cast<const a_elem*>(this); \
140  } \
141  break
142 
143 namespace RE
144 {
145  extern template const TESBoundObject* TESForm::As() const noexcept;
146  extern template const TESContainer* TESForm::As() const noexcept;
147  extern template const TESEnchantableForm* TESForm::As() const noexcept;
148  extern template const TESFullName* TESForm::As() const noexcept;
149  extern template const TESLeveledList* TESForm::As() const noexcept;
150  extern template const TESModel* TESForm::As() const noexcept;
151  extern template const TESWeightForm* TESForm::As() const noexcept;
152 
153  template <class T>
154  requires(!requires { T::FORMTYPE; })
155  const T* TESForm::As() const noexcept
156  {
157  switch (GetFormType()) {
158  SKSE_FORMTRAITS(TESForm);
159  SKSE_FORMTRAITS(BGSKeyword);
160  SKSE_FORMTRAITS(BGSLocationRefType);
161  SKSE_FORMTRAITS(BGSAction);
162  SKSE_FORMTRAITS(BGSTextureSet);
163  SKSE_FORMTRAITS(BGSMenuIcon);
164  SKSE_FORMTRAITS(TESGlobal);
165  SKSE_FORMTRAITS(TESClass);
166  SKSE_FORMTRAITS(TESFaction);
167  SKSE_FORMTRAITS(BGSHeadPart);
168  SKSE_FORMTRAITS(TESEyes);
169  SKSE_FORMTRAITS(TESRace);
170  SKSE_FORMTRAITS(TESSound);
171  SKSE_FORMTRAITS(BGSAcousticSpace);
172  SKSE_FORMTRAITS(EffectSetting);
173  SKSE_FORMTRAITS(Script);
174  SKSE_FORMTRAITS(TESLandTexture);
175  SKSE_FORMTRAITS(EnchantmentItem);
176  SKSE_FORMTRAITS(SpellItem);
177  SKSE_FORMTRAITS(ScrollItem);
178  SKSE_FORMTRAITS(TESObjectACTI);
179  SKSE_FORMTRAITS(BGSTalkingActivator);
180  SKSE_FORMTRAITS(TESObjectARMO);
181  SKSE_FORMTRAITS(TESObjectBOOK);
182  SKSE_FORMTRAITS(TESObjectCONT);
183  SKSE_FORMTRAITS(TESObjectDOOR);
184  SKSE_FORMTRAITS(IngredientItem);
185  SKSE_FORMTRAITS(TESObjectLIGH);
186  SKSE_FORMTRAITS(TESObjectMISC);
187  SKSE_FORMTRAITS(BGSApparatus);
188  SKSE_FORMTRAITS(TESObjectSTAT);
189  SKSE_FORMTRAITS(BGSStaticCollection);
190  SKSE_FORMTRAITS(BGSMovableStatic);
191  SKSE_FORMTRAITS(TESGrass);
192  SKSE_FORMTRAITS(TESObjectTREE);
193  SKSE_FORMTRAITS(TESFlora);
194  SKSE_FORMTRAITS(TESFurniture);
195  SKSE_FORMTRAITS(TESObjectWEAP);
196  SKSE_FORMTRAITS(TESAmmo);
197  SKSE_FORMTRAITS(TESNPC);
198  SKSE_FORMTRAITS(TESLevCharacter);
199  SKSE_FORMTRAITS(TESKey);
200  SKSE_FORMTRAITS(AlchemyItem);
201  SKSE_FORMTRAITS(BGSIdleMarker);
202  SKSE_FORMTRAITS(BGSNote);
203  SKSE_FORMTRAITS(BGSConstructibleObject);
204  SKSE_FORMTRAITS(BGSProjectile);
205  SKSE_FORMTRAITS(BGSHazard);
206  SKSE_FORMTRAITS(TESSoulGem);
207  SKSE_FORMTRAITS(TESLevItem);
208  SKSE_FORMTRAITS(TESWeather);
209  SKSE_FORMTRAITS(TESClimate);
210  SKSE_FORMTRAITS(BGSShaderParticleGeometryData);
211  SKSE_FORMTRAITS(BGSReferenceEffect);
212  SKSE_FORMTRAITS(TESRegion);
213  SKSE_FORMTRAITS(NavMeshInfoMap);
214  SKSE_FORMTRAITS(TESObjectCELL);
215  SKSE_FORMTRAITS(TESObjectREFR);
216  SKSE_FORMTRAITS(Character);
217  SKSE_FORMTRAITS(MissileProjectile);
218  SKSE_FORMTRAITS(ArrowProjectile);
219  SKSE_FORMTRAITS(GrenadeProjectile);
220  SKSE_FORMTRAITS(BeamProjectile);
221  SKSE_FORMTRAITS(FlameProjectile);
222  SKSE_FORMTRAITS(ConeProjectile);
223  SKSE_FORMTRAITS(BarrierProjectile);
224  SKSE_FORMTRAITS(Hazard);
225  SKSE_FORMTRAITS(TESWorldSpace);
226  SKSE_FORMTRAITS(TESObjectLAND);
227  SKSE_FORMTRAITS(NavMesh);
228  SKSE_FORMTRAITS(TESTopic);
229  SKSE_FORMTRAITS(TESTopicInfo);
230  SKSE_FORMTRAITS(TESQuest);
231  SKSE_FORMTRAITS(TESIdleForm);
232  SKSE_FORMTRAITS(TESPackage);
233  SKSE_FORMTRAITS(TESCombatStyle);
234  SKSE_FORMTRAITS(TESLoadScreen);
235  SKSE_FORMTRAITS(TESLevSpell);
236  SKSE_FORMTRAITS(TESObjectANIO);
237  SKSE_FORMTRAITS(TESWaterForm);
238  SKSE_FORMTRAITS(TESEffectShader);
239  SKSE_FORMTRAITS(BGSExplosion);
240  SKSE_FORMTRAITS(BGSDebris);
241  SKSE_FORMTRAITS(TESImageSpace);
242  SKSE_FORMTRAITS(TESImageSpaceModifier);
243  SKSE_FORMTRAITS(BGSListForm);
244  SKSE_FORMTRAITS(BGSPerk);
245  SKSE_FORMTRAITS(BGSBodyPartData);
246  SKSE_FORMTRAITS(BGSAddonNode);
247  SKSE_FORMTRAITS(ActorValueInfo);
248  SKSE_FORMTRAITS(BGSCameraShot);
249  SKSE_FORMTRAITS(BGSCameraPath);
250  SKSE_FORMTRAITS(BGSVoiceType);
251  SKSE_FORMTRAITS(BGSMaterialType);
252  SKSE_FORMTRAITS(BGSImpactData);
253  SKSE_FORMTRAITS(BGSImpactDataSet);
254  SKSE_FORMTRAITS(TESObjectARMA);
255  SKSE_FORMTRAITS(BGSEncounterZone);
256  SKSE_FORMTRAITS(BGSLocation);
257  SKSE_FORMTRAITS(BGSMessage);
258  SKSE_FORMTRAITS(BGSRagdoll);
259  SKSE_FORMTRAITS(BGSDefaultObjectManager);
260  SKSE_FORMTRAITS(BGSLightingTemplate);
261  SKSE_FORMTRAITS(BGSMusicType);
262  SKSE_FORMTRAITS(BGSFootstep);
263  SKSE_FORMTRAITS(BGSFootstepSet);
264  SKSE_FORMTRAITS(BGSStoryManagerBranchNode);
265  SKSE_FORMTRAITS(BGSStoryManagerQuestNode);
266  SKSE_FORMTRAITS(BGSStoryManagerEventNode);
267  SKSE_FORMTRAITS(BGSDialogueBranch);
268  SKSE_FORMTRAITS(BGSMusicTrackFormWrapper);
269  SKSE_FORMTRAITS(TESWordOfPower);
270  SKSE_FORMTRAITS(TESShout);
271  SKSE_FORMTRAITS(BGSEquipSlot);
272  SKSE_FORMTRAITS(BGSRelationship);
273  SKSE_FORMTRAITS(BGSScene);
274  SKSE_FORMTRAITS(BGSAssociationType);
275  SKSE_FORMTRAITS(BGSOutfit);
276  SKSE_FORMTRAITS(BGSArtObject);
277  SKSE_FORMTRAITS(BGSMaterialObject);
278  SKSE_FORMTRAITS(BGSMovementType);
279  SKSE_FORMTRAITS(BGSSoundDescriptorForm);
280  SKSE_FORMTRAITS(BGSDualCastData);
281  SKSE_FORMTRAITS(BGSSoundCategory);
282  SKSE_FORMTRAITS(BGSSoundOutput);
283  SKSE_FORMTRAITS(BGSCollisionLayer);
284  SKSE_FORMTRAITS(BGSColorForm);
285  SKSE_FORMTRAITS(BGSReverbParameters);
286  SKSE_FORMTRAITS(BGSLensFlare);
287  SKSE_FORMTRAITS(BGSVolumetricLighting);
288  default:
289  break;
290  }
291 
292  return nullptr;
293  }
294 }
295 
296 #undef SKSE_FORMTRAITS
#define SKSE_FORMTRAITS(a_elem)
Definition: FormTraits.h:136
constexpr REL::ID GetFormType(static_cast< std::uint64_t >(13982))
Definition: AbsorbEffect.h:6
requires(std::invocable< std::remove_reference_t< EF >>) class scope_exit
Definition: PCH.h:190