Skip to content

Commit

Permalink
COMPLY WITH STYLE GUIDE OR ELSE! INFRACTION.
Browse files Browse the repository at this point in the history
Sometimes I just like to read code and clean it up, you know?
  • Loading branch information
ceejbot committed Dec 14, 2023
1 parent 425efce commit 38a26c3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ releases
SoulsyHUD_v*
/vcpkg_installed
**/unused
compile_flags.txt
4 changes: 2 additions & 2 deletions src/controller/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! Functions of note: `handle_key_event()`, `handle_item_equipped()`, and
//! `timer_expired()`.
//!
//! I apologies for what a mess this is. It grew organically and the feature
//! I apologize for what a mess this is. It grew organically and the feature
//! set is itself complex.
use std::collections::HashMap;
Expand Down Expand Up @@ -43,7 +43,7 @@ pub fn get() -> std::sync::MutexGuard<'static, Controller> {
pub struct Controller {
/// Our currently-active cycles.
pub cycles: CycleData,
/// the hud item cache
/// The hud item cache.
pub cache: ItemCache,
/// The items the HUD should show right now.
visible: HashMap<HudElement, HudItem>,
Expand Down
34 changes: 17 additions & 17 deletions src/game/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ namespace game

// ---------- potions

void consumePotion(const RE::TESForm* potion_form, RE::PlayerCharacter*& player)
void consumePotion(const RE::TESForm* potionForm, RE::PlayerCharacter*& thePlayer)
{
logger::trace("consumePotion called; form_id={}; potion='{}';"sv,
util::string_util::int_to_hex(potion_form->formID),
potion_form->GetName());
util::string_util::int_to_hex(potionForm->formID),
potionForm->GetName());

RE::TESBoundObject* obj = nullptr;
RE::ExtraDataList* extra = nullptr;
auto remaining = boundObjectForForm(potion_form, player, obj, extra);
auto remaining = boundObjectForForm(potionForm, thePlayer, obj, extra);

if (!obj || remaining == 0)
{
Expand All @@ -165,19 +165,19 @@ namespace game
return;
}

auto* alchemy_item = obj->As<RE::AlchemyItem>();
if (alchemy_item->IsPoison())
auto* alchemyItem = obj->As<RE::AlchemyItem>();
if (alchemyItem->IsPoison())
{
poison_weapon(player, alchemy_item, extra, remaining);
poisonWeapon(thePlayer, alchemyItem, extra, remaining);
return;
}

auto* task = SKSE::GetTaskInterface();
if (!task) { return; }
task->AddTask([=]() { RE::ActorEquipManager::GetSingleton()->EquipObject(player, alchemy_item, extra); });
task->AddTask([=]() { RE::ActorEquipManager::GetSingleton()->EquipObject(thePlayer, alchemyItem); });
}

void poison_weapon(RE::PlayerCharacter*& player,
void poisonWeapon(RE::PlayerCharacter*& player,
RE::AlchemyItem*& poison,
RE::ExtraDataList* extra,
uint32_t remaining)
Expand Down Expand Up @@ -208,16 +208,16 @@ namespace game

// ---------- sounds

void playSound(RE::BGSSoundDescriptor* a_sound_descriptor, RE::PlayerCharacter*& a_player)
void playSound(RE::BGSSoundDescriptor* soundDescriptor, RE::PlayerCharacter*& thePlayer)
{
auto* audio_manager = RE::BSAudioManager::GetSingleton();
if (audio_manager && a_sound_descriptor)
auto* audio = RE::BSAudioManager::GetSingleton();
if (audio && soundDescriptor)
{
RE::BSSoundHandle sound_handle;
audio_manager->BuildSoundDataFromDescriptor(sound_handle, a_sound_descriptor);
sound_handle.SetObjectToFollow(a_player->Get3D());
sound_handle.SetVolume(1.0);
sound_handle.Play();
RE::BSSoundHandle soundHandle;
audio->BuildSoundDataFromDescriptor(soundHandle, soundDescriptor);
soundHandle.SetObjectToFollow(thePlayer->Get3D());
soundHandle.SetVolume(1.0);
soundHandle.Play();
// logger::trace("played sound"sv);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace game

void consumePotion(const RE::TESForm* a_form, RE::PlayerCharacter*& a_player);
void consumeBestOption(RE::ActorValue a_actor_value);
void poison_weapon(RE::PlayerCharacter*& a_player,
void poisonWeapon(RE::PlayerCharacter*& a_player,
RE::AlchemyItem*& a_poison,
RE::ExtraDataList* extra,
uint32_t remaining);
Expand Down

0 comments on commit 38a26c3

Please sign in to comment.