Skip to content

Commit

Permalink
fix (#31)
Browse files Browse the repository at this point in the history
* fixed: minor fix for item counting
  • Loading branch information
mlthelama authored Mar 28, 2023
2 parents 03212db + 1c240d8 commit 535589b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
17 changes: 5 additions & 12 deletions src/hook/player_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ namespace hook {
RE::TESObjectREFR* a_from_refr) {
add_object_to_container_(a_this, a_object, a_extra_list, a_count, a_from_refr);

if (a_object->GetPlayable()) {
if (a_object->IsInventoryObject()) {
processing::set_setting_data::set_new_item_count_if_needed(a_object, a_count);
}
if (a_object->IsInventoryObject()) {
processing::set_setting_data::set_new_item_count_if_needed(a_object, a_count);
}
}

Expand All @@ -34,10 +32,7 @@ namespace hook {
bool a_play_sound) {
pick_up_object_(a_this, a_object, a_count, a_arg3, a_play_sound);

if (a_object->GetPlayable()) {
//if (const auto obj = a_object->GetBaseObject(); obj->IsInventoryObject()) {
//processing::set_setting_data::set_new_item_count_if_needed(obj, static_cast<int32_t>(a_count));
//}
if (a_object->GetBaseObject()->IsInventoryObject()) {
processing::set_setting_data::set_new_item_count_if_needed(a_object->GetBaseObject(),
static_cast<int32_t>(a_count));
}
Expand All @@ -51,10 +46,8 @@ namespace hook {
RE::TESObjectREFR* a_move_to_ref,
const RE::NiPoint3* a_drop_loc,
const RE::NiPoint3* a_rotate) {
if (a_item->GetPlayable()) {
if (a_item->IsInventoryObject()) {
processing::set_setting_data::set_new_item_count_if_needed(a_item, -a_count);
}
if (a_item->IsInventoryObject()) {
processing::set_setting_data::set_new_item_count_if_needed(a_item, -a_count);
}

return remove_item_(a_this, a_item, a_count, a_reason, a_extra_list, a_move_to_ref, a_drop_loc, a_rotate);
Expand Down
4 changes: 2 additions & 2 deletions src/processing/set_setting_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace processing {
logger::trace("done executing. return."sv);
}

void set_setting_data::set_new_item_count_if_needed(const RE::TESBoundObject* a_object, const int32_t a_count) {
set_new_item_count(const_cast<RE::TESBoundObject*>(a_object), a_count);
void set_setting_data::set_new_item_count_if_needed(RE::TESBoundObject* a_object, int32_t a_count) {
set_new_item_count(a_object, a_count);
}

void set_setting_data::set_single_slot(const uint32_t a_page,
Expand Down
2 changes: 1 addition & 1 deletion src/processing/set_setting_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace processing {
using slot_type = handle::slot_setting::slot_type;

static void read_and_set_data();
static void set_new_item_count_if_needed(const RE::TESBoundObject* a_object, int32_t a_count);
static void set_new_item_count_if_needed(RE::TESBoundObject* a_object, int32_t a_count);
static void set_single_slot(uint32_t a_page, position_type a_position, const std::vector<data_helper*>& a_data);
static void set_queue_slot(position_type a_pos, const std::vector<data_helper*>& a_data);
static void get_actives_and_equip();
Expand Down

0 comments on commit 535589b

Please sign in to comment.