CommonLibVR
TempEffectTraits.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSTempEffect.h"
7 #include "RE/B/BSTempEffectSPG.h"
10 #include "RE/B/BSTerrainEffect.h"
12 #include "RE/R/ReferenceEffect.h"
15 
16 #define TEMPEFFECT_TRAITS(a_elem) \
17  case a_elem::TYPE: \
18  if constexpr (std::is_convertible_v<const a_elem*, const T*>) { \
19  return static_cast<const a_elem*>(this); \
20  } \
21  break
22 
23 namespace RE
24 {
25  template <class T, class>
26  T* BSTempEffect::As() noexcept
27  {
28  return const_cast<T*>(
29  static_cast<const BSTempEffect*>(this)->As<T>());
30  }
31 
32  template <class T, class>
33  const T* BSTempEffect::As() const noexcept
34  {
35  switch (GetType()) {
48  default:
49  break;
50  }
51 
52  return nullptr;
53  }
54 }
55 
56 #undef TEMPEFFECT_TRAITS
#define TEMPEFFECT_TRAITS(a_elem)
Definition: TempEffectTraits.h:16
Definition: BSTempEffectDebris.h:11
Definition: BSTempEffectGeometryDecal.h:17
Definition: BSTempEffectParticle.h:19
Definition: BSTempEffectSPG.h:12
Definition: BSTempEffectSimpleDecal.h:18
Definition: BSTempEffectWeaponBlood.h:11
Definition: BSTempEffect.h:29
T * As() noexcept
Definition: TempEffectTraits.h:26
virtual TEMP_EFFECT_TYPE GetType() const
Definition: BSTerrainEffect.h:19
Definition: ModelReferenceEffect.h:20
Definition: ReferenceEffect.h:12
Definition: ShaderReferenceEffect.h:21
Definition: SummonPlacementEffect.h:22
Definition: AbsorbEffect.h:6