Skip to content

Commit 8158be4

Browse files
committed
fix: clang-cl
1 parent 413eeb5 commit 8158be4

11 files changed

Lines changed: 56 additions & 37 deletions

include/RE/B/BSStringT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ namespace RE
134134
[[nodiscard]] inline friend bool operator==(const std::string_view& a_lhs, const BSStringT& a_rhs) { return a_rhs == a_lhs; }
135135
[[nodiscard]] inline friend bool operator!=(const std::string_view& a_lhs, const BSStringT& a_rhs) { return !(a_lhs == a_rhs); }
136136

137-
TES_HEAP_REDEFINE_NEW();
137+
TES4_DEFINE_NEW();
138138

139139
private:
140140
[[nodiscard]] static int stricmp(const char* a_lhs, const char* a_rhs) { return _stricmp(a_lhs, a_rhs); }

include/RE/B/BSTList.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace RE
7171
return *this;
7272
}
7373

74-
TES_HEAP_REDEFINE_NEW();
74+
TES4_DEFINE_NEW();
7575

7676
// members
7777
value_type item; // 00
@@ -207,7 +207,7 @@ namespace RE
207207
return *this;
208208
}
209209

210-
TES_HEAP_REDEFINE_NEW();
210+
TES4_DEFINE_NEW();
211211

212212
[[nodiscard]] inline reference front()
213213
{

include/RE/B/BaseFormComponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace RE
1414
virtual void CopyComponent(BaseFormComponent* a_rhs); // 02
1515
virtual bool CompareComponent(BaseFormComponent* a_rhs); // 03
1616

17-
TES_HEAP_REDEFINE_NEW();
17+
TES4_DEFINE_NEW();
1818
};
1919
static_assert(sizeof(BaseFormComponent) == 0x8);
2020
}

include/RE/C/Calendar.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace RE
2020
float GetTime() const;
2121
float GetTimeScale() const;
2222
float GetYear() const;
23-
void SetTimeScale(float a_value);
23+
void SetTimeScale(float a_value) const;
2424

2525
// members
2626
TESGlobal* gameYear; // 000
@@ -35,44 +35,45 @@ namespace RE
3535

3636
namespace RE
3737
{
38-
float Calendar::GetDay() const
38+
inline float Calendar::GetDay() const
3939
{
4040
return gameDay ? gameDay->value : 17.0F;
4141
}
4242

43-
float Calendar::GetDaysPassed() const
43+
inline float Calendar::GetDaysPassed() const
4444
{
4545
return gameDaysPassed ? gameDaysPassed->value : 1.0F;
4646
}
4747

48-
float Calendar::GetHour() const
48+
inline float Calendar::GetHour() const
4949
{
5050
return gameHour ? gameHour->value : 12.0F;
5151
}
5252

53-
float Calendar::GetMonth() const
53+
inline float Calendar::GetMonth() const
5454
{
5555
return gameMonth ? gameMonth->value : 7.0F;
5656
}
5757

58-
float Calendar::GetTime() const
58+
inline float Calendar::GetTime() const
5959
{
60-
return GetDaysPassed() + (GetHour() / 24.0f);
60+
return GetDaysPassed() + (GetHour() / 24.0F);
6161
}
6262

63-
float Calendar::GetTimeScale() const
63+
inline float Calendar::GetTimeScale() const
6464
{
6565
return timeScale->value;
6666
}
6767

68-
float Calendar::GetYear() const
68+
inline float Calendar::GetYear() const
6969
{
7070
return gameYear ? gameYear->value : 427.0F;
7171
}
7272

73-
void Calendar::SetTimeScale(float a_value)
73+
inline void Calendar::SetTimeScale(float a_value) const
7474
{
75-
if (timeScale)
75+
if (timeScale) {
7676
timeScale->value = a_value;
77+
}
7778
}
7879
}

include/RE/E/EffectItemList.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ namespace RE
88
class Actor;
99
class EffectItem;
1010

11-
class EffectItemList :
12-
public BSSimpleList<EffectItem*>
11+
class EffectItemList
1312
{
1413
public:
1514
// add
@@ -18,7 +17,8 @@ namespace RE
1817
virtual SkillLevel::Value GetLevel(); // 02
1918

2019
// members
21-
std::int32_t hostileCount; // 18
20+
BSSimpleList<EffectItem*> effectList; // 08
21+
std::int32_t hostileCount; // 18
2222
};
2323
static_assert(sizeof(EffectItemList) == 0x20);
2424
}

include/RE/M/MemoryManager.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,25 @@ namespace RE
8989
}
9090
}
9191

92-
#define TES_HEAP_REDEFINE_NEW() \
92+
#define TES4_DEFINE_NEW() \
9393
[[nodiscard]] inline void* operator new(std::size_t a_count) \
9494
{ \
9595
const auto mem = RE::malloc(a_count); \
96-
if (mem) { \
97-
return mem; \
98-
} else { \
96+
if (!mem) { \
9997
REX::FAIL("out of memory"); \
10098
} \
99+
\
100+
return mem; \
101101
} \
102102
\
103103
[[nodiscard]] inline void* operator new[](std::size_t a_count) \
104104
{ \
105105
const auto mem = RE::malloc(a_count); \
106-
if (mem) { \
107-
return mem; \
108-
} else { \
106+
if (!mem) { \
109107
REX::FAIL("out of memory"); \
110108
} \
109+
\
110+
return mem; \
111111
} \
112112
\
113113
[[nodiscard]] constexpr void* operator new(std::size_t, void* a_ptr) noexcept { return a_ptr; } \

include/UE/T/TFunction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ namespace UE::Core::Private::Function
138138
TFunction_OwnedObject<T, H>(MoveTemp(a_object))
139139
{}
140140

141-
virtual void* CloneToEmptyStorage(void* a_storage) const override
141+
virtual void* CloneToEmptyStorage(void*) const override
142142
{
143143
assert(false);
144144
return nullptr;

include/UE/T/TSizedHeapAllocator.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ namespace UE
3131
result = static_cast<T>(grow);
3232
}
3333

34-
if (a_num > result)
34+
if (a_num > result) {
3535
result = std::numeric_limits<T>::max();
36+
}
3637

3738
return result;
3839
}
@@ -45,9 +46,10 @@ namespace UE
4546
assert(a_num > 0);
4647

4748
if (a_allowQuantize) {
48-
result = static_cast<T>(FMemory::QuantizeSize(static_cast<std::size_t>(result) * static_cast<std::size_t>(a_numBytes), a_alignment) / a_numBytes);
49-
if (a_num > result)
49+
result = static_cast<T>(FMemory::QuantizeSize(static_cast<std::size_t>(result) * a_numBytes, a_alignment) / a_numBytes);
50+
if (a_num > result) {
5051
result = std::numeric_limits<T>::max();
52+
}
5153
}
5254

5355
return result;
@@ -64,8 +66,9 @@ namespace UE
6466
const std::size_t slackBytes = (a_numAlloc - a_num) * a_numBytes;
6567
if ((slackBytes >= 16384 || 3 * a_num < 2 * a_numAlloc) && (slackElements > 64 || !a_num)) {
6668
result = a_num;
67-
if (result > 0 && a_allowQuantize)
68-
result = (T)(FMemory::QuantizeSize(result * a_numBytes, a_alignment) / a_numBytes);
69+
if (result > 0 && a_allowQuantize) {
70+
result = static_cast<T>((FMemory::QuantizeSize(result * a_numBytes, a_alignment) / a_numBytes));
71+
}
6972
} else {
7073
result = a_numAlloc;
7174
}
@@ -90,8 +93,9 @@ namespace UE
9093

9194
~ForAnyElementType()
9295
{
93-
if (data)
96+
if (data) {
9497
M::Free(data);
98+
}
9599
}
96100

97101
SizeType CalculateSlackReserve(SizeType a_num, std::size_t a_numBytes) const
@@ -139,13 +143,14 @@ namespace UE
139143
return data;
140144
}
141145

142-
void ResizeAllocation(SizeType a_numPrevious, SizeType a_num, std::size_t a_numBytes)
146+
void ResizeAllocation(SizeType, SizeType a_num, std::size_t a_numBytes)
143147
{
144148
if (data || a_num) {
145149
bool invalid = a_num < 0 || a_numBytes < 1 || a_numBytes > static_cast<std::size_t>(std::numeric_limits<std::int32_t>::max());
146150

147-
if constexpr (sizeof(SizeType) == sizeof(std::size_t))
151+
if constexpr (sizeof(SizeType) == sizeof(std::size_t)) {
148152
invalid = invalid || (static_cast<std::size_t>(static_cast<USizeType>(a_num)) > static_cast<std::size_t>(std::numeric_limits<SizeType>::max()) / a_numBytes);
153+
}
149154

150155
assert(!invalid);
151156

@@ -158,8 +163,9 @@ namespace UE
158163
if (data || a_num) {
159164
bool invalid = a_num < 0 || a_numBytes < 1 || a_numBytes > static_cast<std::size_t>(std::numeric_limits<std::int32_t>::max());
160165

161-
if constexpr (sizeof(SizeType) == sizeof(std::size_t))
166+
if constexpr (sizeof(SizeType) == sizeof(std::size_t)) {
162167
invalid = invalid || (static_cast<std::size_t>(static_cast<USizeType>(a_num)) > static_cast<std::size_t>(std::numeric_limits<SizeType>::max()) / a_numBytes);
168+
}
163169

164170
assert(!invalid);
165171

include/UE/T/TStringBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace UE
7575
return FMemory::Malloc(a_count * sizeof(T));
7676
}
7777

78-
void FreeBuffer(void* a_buffer, std::size_t a_count)
78+
void FreeBuffer(void* a_buffer, std::size_t)
7979
{
8080
FMemory::Free(a_buffer);
8181
}

include/UE/U/UObjectBaseUtility.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,16 @@ namespace UE
7272
return objects->IndexToObject(internalIndex)->HasAnyFlags(a_flags);
7373
}
7474

75+
template <class T>
76+
static bool IsChildOf(const T* a_classA, const T* a_classB)
77+
{
78+
a_classA->IsChildOf(a_classB);
79+
}
80+
7581
template <class T>
7682
bool IsA(const T* a_class) const
7783
{
78-
return GetClass()->IsChildOf(a_class);
84+
return IsChildOf(GetClass(), a_class);
7985
}
8086

8187
template <class T>

0 commit comments

Comments
 (0)