Skip to content

Commit

Permalink
ci: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 28, 2023
1 parent eb32a69 commit 478f3bb
Show file tree
Hide file tree
Showing 15 changed files with 431 additions and 863 deletions.
3 changes: 1 addition & 2 deletions include/Maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class Maps : public Singleton<Maps>
// fmt helpers
inline auto format_as(const DistrType& type)
{
switch (type)
{
switch (type) {
case DistrType::Add:
return "ADD";
case DistrType::Remove:
Expand Down
24 changes: 8 additions & 16 deletions include/PCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,52 +203,44 @@ class EventSingleton : public RE::BSTEventSink<TEvent>
const std::regex p{ "struct |RE::|SKSE::| * __ptr64" };
const auto name{ std::regex_replace(dirty_name, p, "") };

if constexpr (std::is_base_of_v<TEventSource, RE::BSInputDeviceManager>)
{
if constexpr (std::is_base_of_v<TEventSource, RE::BSInputDeviceManager>) {
const auto manager{ RE::BSInputDeviceManager::GetSingleton() };
manager->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_base_of_v<TEventSource, RE::UI>)
{
else if constexpr (std::is_base_of_v<TEventSource, RE::UI>) {
const auto ui{ RE::UI::GetSingleton() };
ui->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_same_v<TEvent, SKSE::ActionEvent>)
{
else if constexpr (std::is_same_v<TEvent, SKSE::ActionEvent>) {
SKSE::GetActionEventSource()->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_same_v<TEvent, SKSE::CameraEvent>)
{
else if constexpr (std::is_same_v<TEvent, SKSE::CameraEvent>) {
SKSE::GetCameraEventSource()->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_same_v<TEvent, SKSE::CrosshairRefEvent>)
{
else if constexpr (std::is_same_v<TEvent, SKSE::CrosshairRefEvent>) {
SKSE::GetCrosshairRefEventSource()->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_same_v<TEvent, SKSE::ModCallbackEvent>)
{
else if constexpr (std::is_same_v<TEvent, SKSE::ModCallbackEvent>) {
SKSE::GetModCallbackEventSource()->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_same_v<TEvent, SKSE::NiNodeUpdateEvent>)
{
else if constexpr (std::is_same_v<TEvent, SKSE::NiNodeUpdateEvent>) {
SKSE::GetNiNodeUpdateEventSource()->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
return;
}
else if constexpr (std::is_base_of_v<TEventSource, RE::ScriptEventSourceHolder>)
{
else if constexpr (std::is_base_of_v<TEventSource, RE::ScriptEventSourceHolder>) {
const auto holder{ RE::ScriptEventSourceHolder::GetSingleton() };
holder->AddEventSink(GetSingleton());
logger::info("Registered {} handler", name);
Expand Down
51 changes: 17 additions & 34 deletions include/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Utility : public Singleton<Utility>

static FormIDAndPluginName GetFormIDAndPluginName(const std::string_view identifier)
{
if (const auto tilde{ std::strchr(identifier.data(), '~') })
{
if (const auto tilde{ std::strchr(identifier.data(), '~') }) {
const auto tilde_pos{ static_cast<int>(tilde - identifier.data()) };
return { Maps::ToUnsignedInt(identifier.substr(0, tilde_pos)), identifier.substr(tilde_pos + 1).data() };
}
Expand All @@ -20,17 +19,14 @@ class Utility : public Singleton<Utility>

static RE::TESBoundObject* GetBoundObject(const std::string_view identifier)
{
if (IsEditorID(identifier))
{
if (IsEditorID(identifier)) {
if (const auto obj{ RE::TESForm::LookupByEditorID<RE::TESBoundObject>(identifier) })
return obj;
}
else
{
else {
const auto handler{ RE::TESDataHandler::GetSingleton() };
const auto [form_id, plugin_name]{ GetFormIDAndPluginName(identifier) };
if (const auto obj{ handler->LookupForm(form_id, plugin_name) })
{
if (const auto obj{ handler->LookupForm(form_id, plugin_name) }) {
if (const auto bound_obj{ obj->As<RE::TESBoundObject>() })
return bound_obj;
}
Expand All @@ -42,17 +38,14 @@ class Utility : public Singleton<Utility>

static RE::TESLevItem* GetLevItem(const std::string_view identifier)
{
if (IsEditorID(identifier))
{
if (IsEditorID(identifier)) {
if (const auto obj{ RE::TESForm::LookupByEditorID<RE::TESLevItem>(identifier) })
return obj;
}
else
{
else {
const auto handler{ RE::TESDataHandler::GetSingleton() };
const auto [form_id, plugin_name]{ GetFormIDAndPluginName(identifier) };
if (const auto obj{ handler->LookupForm(form_id, plugin_name) })
{
if (const auto obj{ handler->LookupForm(form_id, plugin_name) }) {
if (const auto lev_item{ obj->As<RE::TESLevItem>() })
return lev_item;
}
Expand All @@ -64,20 +57,16 @@ class Utility : public Singleton<Utility>

static Container GetContainer(const std::string_view to_identifier)
{
if (IsEditorID(to_identifier))
{
if (const auto form{ RE::TESForm::LookupByEditorID(to_identifier) })
{
if (IsEditorID(to_identifier)) {
if (const auto form{ RE::TESForm::LookupByEditorID(to_identifier) }) {
if (const auto cont{ form->As<RE::TESContainer>() })
return { cont, form->GetFormID(), form->GetFormType(), form->GetName() };
}
}
else
{
else {
const auto handler{ RE::TESDataHandler::GetSingleton() };
const auto [form_id, plugin_name]{ GetFormIDAndPluginName(to_identifier) };
if (const auto form{ handler->LookupForm(form_id, plugin_name) })
{
if (const auto form{ handler->LookupForm(form_id, plugin_name) }) {
if (const auto cont{ form->As<RE::TESContainer>() })
return { cont, form->GetFormID(), form->GetFormType(), form->GetName() };
}
Expand All @@ -90,12 +79,9 @@ class Utility : public Singleton<Utility>
public:
static DistrObject BuildDistrObject(const DistrToken& distr_token) noexcept
{
if (const auto leveled_list{ GetLevItem(distr_token.identifier) })
{
if (const auto cont{ GetContainer(distr_token.to_identifier) }; cont.container)
{
if (distr_token.type <=> DistrType::Replace == 0 || distr_token.type <=> DistrType::ReplaceAll == 0)
{
if (const auto leveled_list{ GetLevItem(distr_token.identifier) }) {
if (const auto cont{ GetContainer(distr_token.to_identifier) }; cont.container) {
if (distr_token.type <=> DistrType::Replace == 0 || distr_token.type <=> DistrType::ReplaceAll == 0) {
if (const auto replace_with_list{ GetLevItem(distr_token.rhs.value()) })
return { distr_token.type, nullptr, leveled_list, distr_token.filename, nullptr, replace_with_list, distr_token.count, distr_token.rhs_count, cont };

Expand All @@ -105,12 +91,9 @@ class Utility : public Singleton<Utility>
return { distr_token.type, nullptr, leveled_list, distr_token.filename, nullptr, nullptr, distr_token.count, std::nullopt, cont };
}
}
else if (const auto bound_obj{ GetBoundObject(distr_token.identifier) })
{
if (const auto cont{ GetContainer(distr_token.to_identifier) }; cont.container)
{
if (distr_token.type <=> DistrType::Replace == 0 || distr_token.type <=> DistrType::ReplaceAll == 0)
{
else if (const auto bound_obj{ GetBoundObject(distr_token.identifier) }) {
if (const auto cont{ GetContainer(distr_token.to_identifier) }; cont.container) {
if (distr_token.type <=> DistrType::Replace == 0 || distr_token.type <=> DistrType::ReplaceAll == 0) {
if (const auto replace_with_list{ GetLevItem(distr_token.rhs.value()) })
return { distr_token.type, bound_obj, nullptr, distr_token.filename, nullptr, replace_with_list, distr_token.count, distr_token.rhs_count, cont };

Expand Down
Loading

0 comments on commit 478f3bb

Please sign in to comment.