diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index ced8479c030ca..b52b8aa7e7fa7 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -849,7 +849,7 @@ static activity_reason_info find_base_construction( const inventory &inv, const tripoint &loc, const cata::optional &part_con_idx, - const construction_id idx, + const construction_id &idx, std::set &used ) { const construction &build = idx.obj(); diff --git a/src/avatar_action.cpp b/src/avatar_action.cpp index 4e76f3a0e943e..c089d2b4d0af8 100644 --- a/src/avatar_action.cpp +++ b/src/avatar_action.cpp @@ -853,7 +853,7 @@ void avatar_action::fire_ranged_mutation( avatar &you, const item &fake_gun ) } void avatar_action::fire_ranged_bionic( avatar &you, const item &fake_gun, - units::energy cost_per_shot ) + const units::energy &cost_per_shot ) { you.assign_activity( aim_activity_actor::use_bionic( fake_gun, cost_per_shot ), false ); } @@ -950,7 +950,7 @@ void avatar_action::eat( avatar &you ) avatar_action::eat( you, loc, true ); } -void avatar_action::eat( avatar &you, item_location loc, bool open_consume_menu ) +void avatar_action::eat( avatar &you, const item_location &loc, bool open_consume_menu ) { if( !loc ) { you.cancel_activity(); diff --git a/src/avatar_action.h b/src/avatar_action.h index 1aac0cac95958..8610aef7cabe3 100644 --- a/src/avatar_action.h +++ b/src/avatar_action.h @@ -18,7 +18,7 @@ namespace avatar_action /** Eat food or fuel 'E' (or 'a') */ void eat( avatar &you ); -void eat( avatar &you, item_location loc, bool open_consume_menu = false ); +void eat( avatar &you, const item_location &loc, bool open_consume_menu = false ); // special rules for eating: grazing etc // returns false if no rules are needed bool eat_here( avatar &you ); @@ -55,7 +55,7 @@ void fire_wielded_weapon( avatar &you ); void fire_ranged_mutation( avatar &you, const item &fake_gun ); /** Stores fake gun specified by the bionic and starts interactive aiming */ -void fire_ranged_bionic( avatar &you, const item &fake_gun, units::energy cost_per_shot ); +void fire_ranged_bionic( avatar &you, const item &fake_gun, const units::energy &cost_per_shot ); /** * Checks if the player can manually (with their 2 hands, not via vehicle controls) diff --git a/src/bionics.cpp b/src/bionics.cpp index 659024d53d275..999f95efc93af 100644 --- a/src/bionics.cpp +++ b/src/bionics.cpp @@ -256,7 +256,7 @@ bool bionic_data::is_included( const bionic_id &id ) const return std::find( included_bionics.begin(), included_bionics.end(), id ) != included_bionics.end(); } -void bionic_data::load( const JsonObject &jsobj, const std::string ) +void bionic_data::load( const JsonObject &jsobj, const std::string & ) { mandatory( jsobj, was_loaded, "id", id ); @@ -1942,7 +1942,7 @@ void Character::consume_anesth_requirment( const itype &cbm, player &patient ) invalidate_crafting_inventory(); } -bool Character::has_installation_requirment( bionic_id bid ) +bool Character::has_installation_requirment( const bionic_id &bid ) { if( bid->installation_requirement.is_empty() ) { return false; @@ -1960,7 +1960,7 @@ bool Character::has_installation_requirment( bionic_id bid ) return true; } -void Character::consume_installation_requirment( bionic_id bid ) +void Character::consume_installation_requirment( const bionic_id &bid ) { for( const auto &e : bid->installation_requirement->get_components() ) { as_player()->consume_items( e, 1, is_crafting_component ); diff --git a/src/bionics.h b/src/bionics.h index 848025985341f..a2fcb452ab353 100644 --- a/src/bionics.h +++ b/src/bionics.h @@ -133,7 +133,7 @@ struct bionic_data { bool is_included( const bionic_id &id ) const; bool was_loaded = false; - void load( const JsonObject &obj, std::string ); + void load( const JsonObject &obj, const std::string & ); static void load_bionic( const JsonObject &jo, const std::string &src ); static const std::vector &get_all(); static void check_bionic_consistency(); diff --git a/src/character.cpp b/src/character.cpp index 4971bbb140120..51a4e79ac63b9 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -1579,7 +1579,7 @@ void Character::add_effect( const efftype_id &eff_id, const time_duration &dur, Creature::add_effect( eff_id, dur, bp, permanent, intensity, force, deferred ); } -void Character::expose_to_disease( const diseasetype_id dis_type ) +void Character::expose_to_disease( const diseasetype_id &dis_type ) { const cata::optional &healt_thresh = dis_type->health_threshold; if( healt_thresh && healt_thresh.value() < get_healthy() ) { diff --git a/src/character.h b/src/character.h index 11fea7f003926..a3addead9a5e7 100644 --- a/src/character.h +++ b/src/character.h @@ -580,7 +580,7 @@ class Character : public Creature, public visitable int intensity = 0, bool force = false, bool deferred = false ) override; /**Determine if character is susceptible to dis_type and if so apply the symptoms*/ - void expose_to_disease( diseasetype_id dis_type ); + void expose_to_disease( const diseasetype_id &dis_type ); /** * Handles end-of-turn processing. */ @@ -1054,8 +1054,8 @@ class Character : public Creature, public visitable bool has_enough_anesth( const itype &cbm ); void consume_anesth_requirment( const itype &cbm, player &patient ); /**Has the required equipement for manual installation*/ - bool has_installation_requirment( bionic_id bid ); - void consume_installation_requirment( bionic_id bid ); + bool has_installation_requirment( const bionic_id &bid ); + void consume_installation_requirment( const bionic_id &bid ); /** Handles process of introducing patient into anesthesia during Autodoc operations. Requires anesthesia kits or NOPAIN mutation */ void introduce_into_anesthesia( const time_duration &duration, player &installer, bool needs_anesthesia ); diff --git a/src/creature.cpp b/src/creature.cpp index c3ca572559fc1..1e83ad7ea51c2 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -1424,7 +1424,7 @@ anatomy_id Creature::get_anatomy() const return creature_anatomy; } -void Creature::set_anatomy( anatomy_id anat ) +void Creature::set_anatomy( const anatomy_id &anat ) { creature_anatomy = anat; } diff --git a/src/creature.h b/src/creature.h index 0d3393ba882ff..3750446236ac9 100644 --- a/src/creature.h +++ b/src/creature.h @@ -453,7 +453,7 @@ class Creature anatomy_id creature_anatomy = anatomy_id( "default_anatomy" ); anatomy_id get_anatomy() const; - void set_anatomy( anatomy_id anat ); + void set_anatomy( const anatomy_id &anat ); bodypart_id get_random_body_part( bool main = false ) const; /** diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp index 37e8393d9244d..45729ae440b52 100644 --- a/src/faction_camp.cpp +++ b/src/faction_camp.cpp @@ -436,8 +436,8 @@ time_duration companion_travel_time_calc( const std::vector &journey, int om_carry_weight_to_trips( const std::vector &itms, npc_ptr comp = nullptr ); /// Determines how many trips it takes to move @ref mass and @ref volume of items /// with @ref carry_mass and @ref carry_volume moved per trip -int om_carry_weight_to_trips( units::mass mass, units::volume volume, units::mass carry_mass, - units::volume carry_volume ); +int om_carry_weight_to_trips( const units::mass &mass, const units::volume &volume, + const units::mass &carry_mass, const units::volume &carry_volume ); /// Formats the variables into a standard looking description to be displayed in a ynquery window std::string camp_trip_description( const time_duration &total_time, const time_duration &working_time, @@ -3492,8 +3492,8 @@ time_duration companion_travel_time_calc( const std::vector &journey, return work + one_way * trips * 1_seconds; } -int om_carry_weight_to_trips( units::mass mass, units::volume volume, - units::mass carry_mass, units::volume carry_volume ) +int om_carry_weight_to_trips( const units::mass &mass, const units::volume &volume, + const units::mass &carry_mass, const units::volume &carry_volume ) { int trips_m = 1 + mass / carry_mass; int trips_v = 1 + volume / carry_volume; diff --git a/src/game.cpp b/src/game.cpp index 88626599bcd07..81d5ee923d8c9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2053,7 +2053,7 @@ void game::handle_key_blocking_activity() // call on_contents_changed() for the location's parent and all the way up the chain // used in game::inventory_item_menu() -static void handle_contents_changed( item_location acted_item ) +static void handle_contents_changed( const item_location &acted_item ) { if( acted_item.where() != item_location::type::container ) { return; diff --git a/src/game_inventory.cpp b/src/game_inventory.cpp index 2dadaa408bceb..aa3ae985d4214 100644 --- a/src/game_inventory.cpp +++ b/src/game_inventory.cpp @@ -242,7 +242,7 @@ void game_menus::inv::common( avatar &you ) } while( loop_options.count( res ) != 0 ); } -void game_menus::inv::common( item_location loc, avatar &you ) +void game_menus::inv::common( item_location &loc, avatar &you ) { // Return to inventory menu on those inputs static const std::set loop_options = { { '\0', '=', 'f' } }; @@ -1274,7 +1274,7 @@ class holster_inventory_preset: public weapon_inventory_preset const item &holster; }; -drop_locations game_menus::inv::holster( player &p, item_location holster ) +drop_locations game_menus::inv::holster( player &p, const item_location &holster ) { const std::string holster_name = holster->tname( 1, false ); const use_function *use = holster->type->get_use( "holster" ); @@ -1300,7 +1300,7 @@ drop_locations game_menus::inv::holster( player &p, item_location holster ) return insert_menu.execute(); } -void game_menus::inv::insert_items( avatar &you, item_location holster ) +void game_menus::inv::insert_items( avatar &you, item_location &holster ) { drop_locations holstered_list = game_menus::inv::holster( you, holster ); for( drop_location holstered_item : holstered_list ) { diff --git a/src/game_inventory.h b/src/game_inventory.h index 92a21238a458e..b4b75d40a33ab 100644 --- a/src/game_inventory.h +++ b/src/game_inventory.h @@ -64,7 +64,7 @@ item_location titled_filter_menu( item_location_filter filter, avatar &you, /*@{*/ void common( avatar &you ); -void common( item_location loc, avatar &you ); +void common( item_location &loc, avatar &you ); void compare( player &p, const cata::optional &offset ); void reassign_letter( player &p, item &it ); void swap_letters( player &p ); @@ -98,8 +98,8 @@ item_location use( avatar &you ); /** Item wielding/unwielding menu. */ item_location wield( avatar &you ); /** Item wielding/unwielding menu. */ -drop_locations holster( player &p, item_location holster ); -void insert_items( avatar &you, item_location holster ); +drop_locations holster( player &p, const item_location &holster ); +void insert_items( avatar &you, item_location &holster ); /** Choosing a gun to saw down it's barrel. */ item_location saw_barrel( player &p, item &tool ); /** Choose item to wear. */ diff --git a/src/handle_liquid.cpp b/src/handle_liquid.cpp index 7cceff2a2f634..1e6098638f134 100644 --- a/src/handle_liquid.cpp +++ b/src/handle_liquid.cpp @@ -76,7 +76,7 @@ static void serialize_liquid_target( player_activity &act, const vehicle &veh ) act.coords.push_back( veh.global_pos3() ); } -static void serialize_liquid_target( player_activity &act, item_location container_item ) +static void serialize_liquid_target( player_activity &act, const item_location &container_item ) { act.values.push_back( LTT_CONTAINER ); act.values.push_back( 0 ); // dummy diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index 775d06fc200a3..6bf161c977655 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -920,7 +920,7 @@ int inventory_column::reassign_custom_invlets( const player &p, int min_invlet, return cur_invlet; } -static int num_parents( item_location loc ) +static int num_parents( const item_location &loc ) { if( loc.where() != item_location::type::container ) { return 0; @@ -1267,12 +1267,12 @@ void inventory_selector::add_items( inventory_column &target_column, } } -void inventory_selector::add_contained_items( item_location container ) +void inventory_selector::add_contained_items( item_location &container ) { add_contained_items( container, own_inv_column ); } -void inventory_selector::add_contained_items( item_location container, inventory_column &column ) +void inventory_selector::add_contained_items( item_location &container, inventory_column &column ) { for( item *it : container->contents.all_items_top() ) { item_location child( container, it ); diff --git a/src/inventory_ui.h b/src/inventory_ui.h index c3acfa15b5d5e..85bacdb29c6ae 100644 --- a/src/inventory_ui.h +++ b/src/inventory_ui.h @@ -474,8 +474,8 @@ class inventory_selector inventory_selector( player &u, const inventory_selector_preset &preset = default_preset ); virtual ~inventory_selector(); /** These functions add items from map / vehicles. */ - void add_contained_items( item_location container ); - void add_contained_items( item_location container, inventory_column &column ); + void add_contained_items( item_location &container ); + void add_contained_items( item_location &container, inventory_column &column ); void add_character_items( Character &character ); void add_map_items( const tripoint &target ); void add_vehicle_items( const tripoint &target ); diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 03c6cc3e82fcd..af3788de587fd 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -2482,7 +2482,8 @@ int holster_actor::use( player &p, item &it, bool, const tripoint & ) const return 0; } // may not strictly be the correct item_location, but plumbing item_location through all iuse_actor::use won't work - game_menus::inv::insert_items( *p.as_avatar(), item_location( p, &it ) ); + item_location item_loc( p, &it ); + game_menus::inv::insert_items( *p.as_avatar(), item_loc ); } return 0; diff --git a/src/mapgen.cpp b/src/mapgen.cpp index e8dab2906e290..0225d333378d9 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -226,7 +226,7 @@ class mapgen_basic_container weighted_int_list> weights_; public: - int add( const std::shared_ptr ptr ) { + int add( const std::shared_ptr &ptr ) { assert( ptr ); mapgens_.push_back( ptr ); return mapgens_.size() - 1; @@ -334,7 +334,7 @@ class mapgen_factory return mapgens_.count( key ) != 0; } /// @see mapgen_basic_container::add - int add( const std::string &key, const std::shared_ptr ptr ) { + int add( const std::string &key, const std::shared_ptr &ptr ) { return mapgens_[key].add( ptr ); } /// @see mapgen_basic_container::generate diff --git a/src/npc.h b/src/npc.h index 64b63271cdf41..5f57dfca329ac 100644 --- a/src/npc.h +++ b/src/npc.h @@ -1162,7 +1162,8 @@ class npc : public player // Move to, or grab, our targeted item void pick_up_item(); // Drop wgt and vol, including all items with less value than min_val - void drop_items( units::mass drop_weight, units::volume drop_volume, int min_val = 0 ); + void drop_items( const units::mass &drop_weight, const units::volume &drop_volume, + int min_val = 0 ); /** Picks up items and returns a list of them. */ std::list pick_up_item_map( const tripoint &where ); std::list pick_up_item_vehicle( vehicle &veh, int part_index ); diff --git a/src/npcmove.cpp b/src/npcmove.cpp index 0fa5adbc83a6b..8e3ce03118e50 100644 --- a/src/npcmove.cpp +++ b/src/npcmove.cpp @@ -3081,7 +3081,8 @@ struct ratio_index { }; /* As of October 2019, this is buggy, do not use!! */ -void npc::drop_items( units::mass drop_weight, units::volume drop_volume, int min_val ) +void npc::drop_items( const units::mass &drop_weight, const units::volume &drop_volume, + int min_val ) { /* Remove this when someone debugs it back to functionality */ return; diff --git a/src/output.cpp b/src/output.cpp index 0fe13bc48c4a2..efe4b75915291 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -520,7 +520,7 @@ void draw_custom_border( const catacurses::window &w, const catacurses::chtype ls, const catacurses::chtype rs, const catacurses::chtype ts, const catacurses::chtype bs, const catacurses::chtype tl, const catacurses::chtype tr, const catacurses::chtype bl, const catacurses::chtype br, - const nc_color FG, const point &pos, int height, int width ) + const nc_color &FG, const point &pos, int height, int width ) { wattron( w, FG ); diff --git a/src/output.h b/src/output.h index e99885c5737dc..6fbdf1db0a4bb 100644 --- a/src/output.h +++ b/src/output.h @@ -367,7 +367,7 @@ void draw_custom_border( const catacurses::window &w, catacurses::chtype ls = 1, catacurses::chtype rs = 1, catacurses::chtype ts = 1, catacurses::chtype bs = 1, catacurses::chtype tl = 1, catacurses::chtype tr = 1, catacurses::chtype bl = 1, catacurses::chtype br = 1, - nc_color FG = BORDER_COLOR, const point &pos = point_zero, int height = 0, int width = 0 ); + const nc_color &FG = BORDER_COLOR, const point &pos = point_zero, int height = 0, int width = 0 ); void draw_border( const catacurses::window &w, nc_color border_color = BORDER_COLOR, const std::string &title = "", nc_color title_color = c_light_red ); void draw_border_below_tabs( const catacurses::window &w, nc_color border_color = BORDER_COLOR ); diff --git a/src/stomach.cpp b/src/stomach.cpp index 884a70a767ae0..a3c31c9ecbb64 100644 --- a/src/stomach.cpp +++ b/src/stomach.cpp @@ -118,7 +118,7 @@ stomach_contents::stomach_contents( units::volume max_vol, bool is_stomach ) last_ate = calendar::before_time_starts; } -static std::string ml_to_string( units::volume vol ) +static std::string ml_to_string( const units::volume &vol ) { return to_string( units::to_milliliter( vol ) ) + "_ml"; } @@ -274,7 +274,7 @@ void stomach_contents::mod_nutr( int nutr ) mod_calories( -1 * std::round( nutr * 2500.0f / ( 12 * 24 ) ) ); } -void stomach_contents::mod_water( units::volume h2o ) +void stomach_contents::mod_water( const units::volume &h2o ) { if( h2o > 0_ml ) { water += h2o; @@ -286,7 +286,7 @@ void stomach_contents::mod_quench( int quench ) mod_water( 5_ml * quench ); } -void stomach_contents::mod_contents( units::volume vol ) +void stomach_contents::mod_contents( const units::volume &vol ) { if( -vol >= contents ) { contents = 0_ml; diff --git a/src/stomach.h b/src/stomach.h index 47878018c23a8..3a95c0f835f84 100644 --- a/src/stomach.h +++ b/src/stomach.h @@ -132,12 +132,12 @@ class stomach_contents void mod_nutr( int nutr ); // changes water amount in stomach // overflow draws from player thirst - void mod_water( units::volume h2o ); + void mod_water( const units::volume &h2o ); // changes water amount in stomach converted from quench value // TODO: Move to mL values of water void mod_quench( int quench ); // adds volume to your stomach - void mod_contents( units::volume vol ); + void mod_contents( const units::volume &vol ); // how long has it been since i ate? // only really relevant for player::stomach diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index f9bc934de04a3..fd6610ecc6002 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -668,7 +668,7 @@ bool veh_interact::can_self_jack() return false; } -static void print_message_to( catacurses::window &w_msg, const nc_color col, +static void print_message_to( catacurses::window &w_msg, const nc_color &col, const std::string &msg ) { werase( w_msg );