diff options
Diffstat (limited to 'hotfix-02_fix-Prevents-reloading-from-deleting-containers-4104.patch')
-rw-r--r-- | hotfix-02_fix-Prevents-reloading-from-deleting-containers-4104.patch | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/hotfix-02_fix-Prevents-reloading-from-deleting-containers-4104.patch b/hotfix-02_fix-Prevents-reloading-from-deleting-containers-4104.patch deleted file mode 100644 index 5414c95..0000000 --- a/hotfix-02_fix-Prevents-reloading-from-deleting-containers-4104.patch +++ /dev/null @@ -1,63 +0,0 @@ -From db0b41135105d165ead640d4d4d46d220491c873 Mon Sep 17 00:00:00 2001 -From: joveeater <joveasarus@gmail.com> -Date: Sat, 13 Jan 2024 12:21:59 +0000 -Subject: [PATCH] fix: Prevents reloading from deleting containers (#4104) - -* Prevents reloading from deleting containers - -* style(autofix.ci): automated formatting - ---------- - -Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> ---- - src/item.cpp | 24 ++++++++++-------------- - 1 file changed, 10 insertions(+), 14 deletions(-) - -diff --git a/src/item.cpp b/src/item.cpp -index 25051aeb76c..b4667994e17 100644 ---- a/src/item.cpp -+++ b/src/item.cpp -@@ -8186,9 +8186,7 @@ bool item::reload( player &u, item &loc, int qty ) - } - } - -- detached_ptr<item> to_reload = item::spawn( *ammo ); -- to_reload->charges = qty; -- ammo->charges -= qty; -+ detached_ptr<item> to_reload = ammo->split( qty ); - bool merged = false; - for( item *it : contents.all_items_top() ) { - if( it->merge_charges( std::move( to_reload ) ) ) { -@@ -8246,19 +8244,17 @@ bool item::reload( player &u, item &loc, int qty ) - ammo->charges -= qty; - charges += qty; - } -- } -- -- // we have transfered ammo from the container to the item -- // therefore, we erase the 0-charge item inside container -- // TODO: why don't we just remove 0-charge items? -- if( ammo->charges == 0 && !ammo->has_flag( flag_SPEEDLOADER ) ) { -- if( container != nullptr && !container->contents.empty() ) { -- container->remove_item( container->contents.front() ); -- u.inv_restack( ); // emptied containers do not stack with non-empty ones -- } else { -- loc.detach(); -+ // we have transfered ammo from the container to the item -+ // therefore, we erase the 0-charge item inside container -+ // TODO: why don't we just remove 0-charge items? -+ if( ammo->charges == 0 && !ammo->has_flag( flag_SPEEDLOADER ) ) { -+ ammo->detach(); -+ if( container != nullptr ) { -+ u.inv_restack(); -+ } - } - } -+ - return true; - } - --- -2.43.0 - |