File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 5858#include " uistate.h"
5959#include " units.h"
6060#include " units_utility.h"
61+ #include " value_ptr.h"
6162#include " vehicle.h"
6263#include " vehicle_selector.h"
6364#include " vpart_position.h"
@@ -703,6 +704,18 @@ inventory_selector_preset::inventory_selector_preset()
703704 } ) );
704705}
705706
707+ bool inventory_selector_preset::is_shown ( const item_location &loc ) const
708+ {
709+ if ( loc->is_gunmod () ) {
710+ item_location parent = loc.parent_item ();
711+ const bool installed = parent && parent->is_gun ();
712+ if ( installed && !loc->type ->gunmod ->is_visible_when_installed ) {
713+ return false ;
714+ }
715+ }
716+ return true ;
717+ }
718+
706719bool inventory_selector_preset::sort_compare ( const inventory_entry &lhs,
707720 const inventory_entry &rhs ) const
708721{
Original file line number Diff line number Diff line change 2626#include " input_context.h"
2727#include " item.h"
2828#include " item_location.h"
29- #include " itype.h"
3029#include " memory_fast.h"
3130#include " pimpl.h"
3231#include " pocket_type.h"
3332#include " point.h"
3433#include " translations.h"
3534#include " units.h"
36- #include " value_ptr.h"
3735
3836class Character ;
3937class JsonObject ;
@@ -241,12 +239,8 @@ class inventory_selector_preset
241239 virtual ~inventory_selector_preset () = default ;
242240
243241 /* * Does this entry satisfy the basic preset conditions? */
244- virtual bool is_shown ( const item_location &loc ) const {
245- if ( loc->is_gunmod () && !loc->type ->gunmod ->is_visible_when_installed ) {
246- return false ;
247- }
248- return true ;
249- }
242+ virtual bool is_shown ( const item_location &loc ) const ;
243+
250244
251245 /* *
252246 * The reason why this entry cannot be selected.
You can’t perform that action at this time.
0 commit comments