Skip to content

Commit

Permalink
Second attempt to fix the sheath bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaSparrow authored and SeaSparrow committed Feb 11, 2024
1 parent ba666f5 commit 2f6dda0
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/actorEventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ namespace ActorEvents {
auto* leftBound = leftEnchanted ? leftData->object : nullptr;
auto* leftWeapon = leftBound ? leftBound->As<RE::TESObjectWEAP>() : nullptr;

//No longer has enchantments.
if (!(leftWeapon || rightWeapon)) {
AnimationEventListener::GetSingleton()->UnRegisterActor(a_actor);
this->managedActors.erase(a_actor);
return;
}

//Unchanged data.
if (actorData->first.first == leftWeapon && actorData->first.second == rightWeapon) {
return;
Expand Down Expand Up @@ -371,12 +364,6 @@ namespace ActorEvents {
auto* leftBound = leftEnchanted ? leftData->object : nullptr;
auto* leftWeapon = leftBound ? leftBound->As<RE::TESObjectWEAP>() : nullptr;

if (!(leftWeapon || rightWeapon)) {
AnimationEventListener::GetSingleton()->UnRegisterActor(a_actor);
this->managedActors.erase(a_actor);
return;
}

AnimationEventListener::GetSingleton()->RegisterActor(a_actor);
this->managedActors[a_actor] = std::pair<std::pair<RE::TESObjectWEAP*, RE::TESObjectWEAP*>, bool>
(std::pair<RE::TESObjectWEAP*, RE::TESObjectWEAP*>(leftWeapon, rightWeapon),
Expand All @@ -400,20 +387,12 @@ namespace ActorEvents {
bool leftEnchanted = leftData ? leftData->IsEnchanted() : false;
auto* leftBound = leftEnchanted ? leftData->object : nullptr;
auto* leftWeapon = leftBound ? leftBound->As<RE::TESObjectWEAP>() : nullptr;

if (!(leftWeapon || rightWeapon)) {
//Super unecessary. This should never happen.
if (this->managedActors.contains(a_actor)) {
AnimationEventListener::GetSingleton()->UnRegisterActor(a_actor);
this->managedActors.erase(a_actor);
}
return;
}

this->managedActors[a_actor] = this->managedActors[a_actor] = std::pair<std::pair<RE::TESObjectWEAP*, RE::TESObjectWEAP*>, bool>
(std::pair<RE::TESObjectWEAP*, RE::TESObjectWEAP*>(leftWeapon, rightWeapon),
a_actor->IsWeaponDrawn());
AnimationEventListener::GetSingleton()->RegisterActor(a_actor);

if (leftWeapon || rightWeapon)
EvaluateActor(a_actor, leftWeapon, rightWeapon, a_actor->IsWeaponDrawn());
}
Expand Down

0 comments on commit 2f6dda0

Please sign in to comment.