MCPcopy Create free account
hub / github.com/GValiente/butano / decrease_usages

Function decrease_usages

butano/src/bn_bgs_manager.cpp:804–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804void decrease_usages(id_type id)
805{
806 auto item = static_cast<item_type*>(id);
807 --item->usages;
808
809 if(! item->usages) [[likely]]
810 {
811 static_data& data = data_ref();
812
813 if(! data.rebuild_handles && item->visible)
814 {
815 data.rebuild_handles = true;
816 }
817
818 erase(data.items_vector, item);
819 data.items_pool.destroy(*item);
820
821 if(data.bitmap_affine_bg_tiles_handle != -1)
822 {
823 bg_blocks_manager::decrease_usages(data.bitmap_affine_bg_tiles_handle);
824 data.bitmap_affine_bg_tiles_handle = -1;
825
826 sprite_tiles_manager::decrease_usages(data.bitmap_sprite_tiles_handle);
827 data.bitmap_sprite_tiles_handle = -1;
828
829 data.bitmap_palette.reset();
830 }
831 }
832}
833
834int hw_id(id_type id)
835{

Calls 3

eraseFunction · 0.50
destroyMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected