Skip to content

Commit 31e4edf

Browse files
committed
this contains a temporary test to check for any duplicate keywords when returning from the Keyword_t filter.
1 parent d882a5c commit 31e4edf

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

SKSE/Plugins/doticu_skypal.dll

12 KB
Binary file not shown.

Source/Plugins/doticu_skypal/src/references.cpp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
#include "doticu_skypal/main.h"
3737
#include "doticu_skypal/references.h"
3838

39+
//temp
40+
#include "doticu_skylib/virtual_debug.h"
41+
//
42+
3943
namespace doticu_skypal {
4044

4145
String_t References_t::Class_Name()
@@ -85,16 +89,42 @@ namespace doticu_skypal {
8589
#undef STATIC
8690
}
8791

92+
//temp
93+
void Test_For_Dupes(Vector_t<Reference_t*>& refs)
94+
{
95+
for (size_t idx = 0, end = refs.size(); idx < end; idx += 1) {
96+
maybe<Reference_t*> reference = refs[idx];
97+
SKYLIB_ASSERT_SOME(reference);
98+
99+
size_t count = 0;
100+
for (size_t idx = 0, end = refs.size(); idx < end; idx += 1) {
101+
if (refs[idx] == reference) {
102+
count += 1;
103+
}
104+
}
105+
106+
if (count > 1) {
107+
std::string note =
108+
std::string("SkyPal: FOUND A DUPLICATE") +
109+
" [" + reference->form_id.As_String() + " - " + reference->Any_Name() + "]";
110+
skylib::Virtual::Debug_t::Trace(note, 2, none<V::Callback_i*>());
111+
} else {
112+
skylib::Virtual::Debug_t::Trace("SkyPal: no duplicates found.", 0, none<V::Callback_i*>());
113+
}
114+
}
115+
}
116+
//
117+
88118
/* Getters */
89119

90120
Vector_t<Reference_t*> References_t::All()
91121
{
92-
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Loaded_References());
122+
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::All());
93123
}
94124

95125
Vector_t<Reference_t*> References_t::Grid()
96126
{
97-
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Loaded_Grid_References());
127+
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Grid());
98128
}
99129

100130
/* Counters */
@@ -367,6 +397,10 @@ namespace doticu_skypal {
367397
Filter::Keywords_t<Reference_t*>(state).OR<Vector_t<some<Keyword_t*>>&>(some_keywords);
368398
}
369399

400+
//temp
401+
Test_For_Dupes(*state.Results());
402+
//
403+
370404
return *state.Results();
371405
}
372406

0 commit comments

Comments
 (0)