Skip to content

Commit

Permalink
this contains a temporary test to check for any duplicate keywords wh…
Browse files Browse the repository at this point in the history
…en returning from the Keyword_t filter.
  • Loading branch information
r-neal-kelly committed May 6, 2021
1 parent d882a5c commit 31e4edf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Binary file modified SKSE/Plugins/doticu_skypal.dll
Binary file not shown.
38 changes: 36 additions & 2 deletions Source/Plugins/doticu_skypal/src/references.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "doticu_skypal/main.h"
#include "doticu_skypal/references.h"

//temp
#include "doticu_skylib/virtual_debug.h"
//

namespace doticu_skypal {

String_t References_t::Class_Name()
Expand Down Expand Up @@ -85,16 +89,42 @@ namespace doticu_skypal {
#undef STATIC
}

//temp
void Test_For_Dupes(Vector_t<Reference_t*>& refs)
{
for (size_t idx = 0, end = refs.size(); idx < end; idx += 1) {
maybe<Reference_t*> reference = refs[idx];
SKYLIB_ASSERT_SOME(reference);

size_t count = 0;
for (size_t idx = 0, end = refs.size(); idx < end; idx += 1) {
if (refs[idx] == reference) {
count += 1;
}
}

if (count > 1) {
std::string note =
std::string("SkyPal: FOUND A DUPLICATE") +
" [" + reference->form_id.As_String() + " - " + reference->Any_Name() + "]";
skylib::Virtual::Debug_t::Trace(note, 2, none<V::Callback_i*>());
} else {
skylib::Virtual::Debug_t::Trace("SkyPal: no duplicates found.", 0, none<V::Callback_i*>());
}
}
}
//

/* Getters */

Vector_t<Reference_t*> References_t::All()
{
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Loaded_References());
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::All());
}

Vector_t<Reference_t*> References_t::Grid()
{
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Loaded_Grid_References());
return *reinterpret_cast<Vector_t<Reference_t*>*>(&Reference_t::Grid());
}

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

//temp
Test_For_Dupes(*state.Results());
//

return *state.Results();
}

Expand Down

0 comments on commit 31e4edf

Please sign in to comment.