Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass point by value #2461

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/active_item_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ std::vector<item_reference> active_item_cache::get_special( special_item_type ty
return matching_items;
}

void active_item_cache::subtract_locations( const point &delta )
void active_item_cache::subtract_locations( point delta )
{
for( std::pair<const int, std::list<item_reference>> &pair : active_items ) {
for( item_reference &ir : pair.second ) {
Expand All @@ -114,7 +114,7 @@ void active_item_cache::subtract_locations( const point &delta )
}
}

void active_item_cache::rotate_locations( int turns, const point &dim )
void active_item_cache::rotate_locations( int turns, point dim )
{
for( std::pair<const int, std::list<item_reference>> &pair : active_items ) {
for( item_reference &ir : pair.second ) {
Expand Down
4 changes: 2 additions & 2 deletions src/active_item_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class active_item_cache
*/
std::vector<item_reference> get_special( special_item_type type );
/** Subtract delta from every item_reference's location */
void subtract_locations( const point &delta );
void rotate_locations( int turns, const point &dim );
void subtract_locations( point delta );
void rotate_locations( int turns, point dim );
};

#endif // CATA_SRC_ACTIVE_ITEM_CACHE_H
2 changes: 1 addition & 1 deletion src/advanced_inv_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int advanced_inv_area::get_item_count() const
}
}

advanced_inv_area::advanced_inv_area( aim_location id, const point &h, tripoint off,
advanced_inv_area::advanced_inv_area( aim_location id, point h, tripoint off,
const std::string &name, const std::string &shortname,
std::string minimapname, std::string actionname,
aim_location relative_location ) :
Expand Down
2 changes: 1 addition & 1 deletion src/advanced_inv_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class advanced_inv_area

advanced_inv_area( aim_location id ) : id( id ), relative_location( id ) {}
advanced_inv_area(
aim_location id, const point &hscreen, tripoint off, const std::string &name,
aim_location id, point hscreen, tripoint off, const std::string &name,
const std::string &shortname, std::string minimapname, std::string actionname,
aim_location relative_location );

Expand Down
4 changes: 2 additions & 2 deletions src/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,15 +939,15 @@ void game::draw_item_override( const tripoint &, const itype_id &, const mtype_i
#if defined(TILES)
void game::draw_vpart_override(
const tripoint &p, const vpart_id &id, const int part_mod, const units::angle veh_dir,
const bool hilite, const point &mount )
const bool hilite, point mount )
{
if( use_tiles ) {
tilecontext->init_draw_vpart_override( p, id, part_mod, veh_dir, hilite, mount );
}
}
#else
void game::draw_vpart_override( const tripoint &, const vpart_id &, const int,
const units::angle, const bool, const point & )
const units::angle, const bool, point )
{
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/avatar_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bool eat_here( avatar &you );
// Standard movement; handles attacks, traps, &c. Returns false if auto move
// should be canceled
bool move( avatar &you, map &m, const tripoint &d );
inline bool move( avatar &you, map &m, const point &d )
inline bool move( avatar &you, map &m, point d )
{
return move( you, m, tripoint( d, 0 ) );
}
Expand Down
12 changes: 6 additions & 6 deletions src/basecamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void basecamp::add_expansion( const std::string &terrain, const tripoint_abs_omt
}

void basecamp::add_expansion( const std::string &bldg, const tripoint_abs_omt &new_pos,
const point &dir )
point dir )
{
expansion_data e;
e.type = base_camps::faction_decode( bldg );
Expand Down Expand Up @@ -233,7 +233,7 @@ std::string basecamp::om_upgrade_description( const std::string &bldg, bool trun

// upgrade levels
// legacy next upgrade
std::string basecamp::next_upgrade( const point &dir, const int offset ) const
std::string basecamp::next_upgrade( point dir, const int offset ) const
{
const auto &e = expansions.find( dir );
if( e == expansions.end() ) {
Expand Down Expand Up @@ -296,7 +296,7 @@ bool basecamp::has_water()
has_provides( "faction_base_blacksmith_11" );
}

std::vector<basecamp_upgrade> basecamp::available_upgrades( const point &dir )
std::vector<basecamp_upgrade> basecamp::available_upgrades( point dir )
{
std::vector<basecamp_upgrade> ret_data;
auto e = expansions.find( dir );
Expand Down Expand Up @@ -358,7 +358,7 @@ std::vector<basecamp_upgrade> basecamp::available_upgrades( const point &dir )
}

// recipes and craft support functions
std::map<recipe_id, translation> basecamp::recipe_deck( const point &dir ) const
std::map<recipe_id, translation> basecamp::recipe_deck( point dir ) const
{
std::map<recipe_id, translation> recipes;
const auto &e = expansions.find( dir );
Expand Down Expand Up @@ -428,7 +428,7 @@ void basecamp::update_provides( const std::string &bldg, expansion_data &e_data
}
}

void basecamp::update_in_progress( const std::string &bldg, const point &dir )
void basecamp::update_in_progress( const std::string &bldg, point dir )
{
if( !recipe_id( bldg ).is_valid() ) {
return;
Expand Down Expand Up @@ -675,7 +675,7 @@ void basecamp::form_crafting_inventory()
}

// display names
std::string basecamp::expansion_tab( const point &dir ) const
std::string basecamp::expansion_tab( point dir ) const
{
if( dir == base_camps::base_dir ) {
return _( "Base Missions" );
Expand Down
28 changes: 14 additions & 14 deletions src/basecamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,23 @@ class basecamp
void abandon_camp();
void add_expansion( const std::string &terrain, const tripoint_abs_omt &new_pos );
void add_expansion( const std::string &bldg, const tripoint_abs_omt &new_pos,
const point &dir );
point dir );
void define_camp( const tripoint_abs_omt &p, const std::string &camp_type = "default" );

std::string expansion_tab( const point &dir ) const;
std::string expansion_tab( point dir ) const;
// upgrade levels
bool has_provides( const std::string &req, const expansion_data &e_data, int level = 0 ) const;
bool has_provides( const std::string &req, const cata::optional<point> &dir = cata::nullopt,
int level = 0 ) const;
void update_resources( const std::string &bldg );
void update_provides( const std::string &bldg, expansion_data &e_data );
void update_in_progress( const std::string &bldg, const point &dir );
void update_in_progress( const std::string &bldg, point dir );

bool can_expand();
/// Returns the name of the building the current building @ref dir upgrades into,
/// "null" if there isn't one
std::string next_upgrade( const point &dir, int offset = 1 ) const;
std::vector<basecamp_upgrade> available_upgrades( const point &dir );
std::string next_upgrade( point dir, int offset = 1 ) const;
std::vector<basecamp_upgrade> available_upgrades( point dir );

// camp utility functions
int recruit_evaluation() const;
Expand All @@ -201,7 +201,7 @@ class basecamp

// recipes, gathering, and craft support functions
// from a direction
std::map<recipe_id, translation> recipe_deck( const point &dir ) const;
std::map<recipe_id, translation> recipe_deck( point dir ) const;
// from a building
std::map<recipe_id, translation> recipe_deck( const std::string &bldg ) const;
int recipe_batch_max( const recipe &making ) const;
Expand Down Expand Up @@ -238,7 +238,7 @@ class basecamp
void place_results( item result );

// mission description functions
void add_available_recipes( mission_data &mission_key, const point &dir,
void add_available_recipes( mission_data &mission_key, point dir,
const std::map<recipe_id, translation> &craft_recipes );

std::string recruit_description( int npc_count );
Expand All @@ -255,7 +255,7 @@ class basecamp

// main mission description collection
void get_available_missions( mission_data &mission_key );
void get_available_missions_by_dir( mission_data &mission_key, const point &dir );
void get_available_missions_by_dir( mission_data &mission_key, point dir );
// available companion list manipulation
void reset_camp_workers();
comp_list get_mission_workers( const std::string &mission_id, bool contains = false );
Expand All @@ -272,12 +272,12 @@ class basecamp
bool must_feed, const std::string &desc, bool group,
const std::vector<item *> &equipment,
const std::map<skill_id, int> &required_skills = {} );
void start_upgrade( const std::string &bldg, const point &dir, const std::string &key );
void start_upgrade( const std::string &bldg, point dir, const std::string &key );
std::string om_upgrade_description( const std::string &bldg, bool trunc = false ) const;
void start_menial_labor();
void worker_assignment_ui();
void job_assignment_ui();
void start_crafting( const std::string &cur_id, const point &cur_dir,
void start_crafting( const std::string &cur_id, point cur_dir,
const std::string &type, const std::string &miss_id );

/// Called when a companion is sent to cut logs
Expand All @@ -289,8 +289,8 @@ class basecamp
void start_fortifications( std::string &bldg_exp );
void start_combat_mission( const std::string &miss );
/// Called when a companion starts a chop shop @ref task mission
bool start_garage_chop( const point &dir, const tripoint_abs_omt &omt_tgt );
void start_farm_op( const point &dir, const tripoint_abs_omt &omt_tgt, farm_ops op );
bool start_garage_chop( point dir, const tripoint_abs_omt &omt_tgt );
void start_farm_op( point dir, const tripoint_abs_omt &omt_tgt, farm_ops op );
///Display items listed in @ref equipment to let the player pick what to give the departing
///NPC, loops until quit or empty.
std::vector<item *> give_equipment( std::vector<item *> equipment, const std::string &msg );
Expand All @@ -311,9 +311,9 @@ class basecamp

/// Called to close upgrade missions, @ref miss is the name of the mission id
/// and @ref dir is the direction of the location to be upgraded
bool upgrade_return( const point &dir, const std::string &miss );
bool upgrade_return( point dir, const std::string &miss );
/// As above, but with an explicit blueprint recipe to upgrade
bool upgrade_return( const point &dir, const std::string &miss, const std::string &bldg );
bool upgrade_return( point dir, const std::string &miss, const std::string &bldg );

/// Choose which expansion you should start, called when a survey mission is completed
bool survey_return();
Expand Down
2 changes: 1 addition & 1 deletion src/bionics_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static void draw_description( const catacurses::window &win, const bionic &bio )
wnoutrefresh( win );
}

static void draw_connectors( const catacurses::window &win, const point &start,
static void draw_connectors( const catacurses::window &win, point start,
int last_x, const bionic_id &bio_id, const std::map<bodypart_str_id, size_t> &bp_to_pos )
{
const int LIST_START_Y = 7;
Expand Down
26 changes: 13 additions & 13 deletions src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ static bool is_contained( const SDL_Rect &smaller, const SDL_Rect &larger )
smaller.y + smaller.h <= larger.y + larger.h;
}

bool tileset_loader::copy_surface_to_texture( const SDL_Surface_Ptr &surf, const point &offset,
bool tileset_loader::copy_surface_to_texture( const SDL_Surface_Ptr &surf, point offset,
std::vector<texture> &target )
{
assert( surf );
Expand Down Expand Up @@ -476,7 +476,7 @@ bool tileset_loader::copy_surface_to_texture( const SDL_Surface_Ptr &surf, const
}

bool tileset_loader::create_textures_from_tile_atlas( const SDL_Surface_Ptr &tile_atlas,
const point &offset )
point offset )
{
assert( tile_atlas );

Expand Down Expand Up @@ -1123,7 +1123,7 @@ static int divide_round_down( int a, int b )
}
}

void cata_tiles::draw( const point &dest, const tripoint &center, int width, int height,
void cata_tiles::draw( point dest, const tripoint &center, int width, int height,
std::multimap<point, formatted_text> &overlay_strings,
color_block_overlay_container &color_blocks )
{
Expand Down Expand Up @@ -1751,7 +1751,7 @@ bool cata_tiles::terrain_requires_animation() const
return idle_animations.enabled() && idle_animations.present();
}

void cata_tiles::draw_minimap( const point &dest, const tripoint &center, int width, int height )
void cata_tiles::draw_minimap( point dest, const tripoint &center, int width, int height )
{
minimap->draw( SDL_Rect{ dest.x, dest.y, width, height }, center );
}
Expand Down Expand Up @@ -2190,7 +2190,7 @@ bool cata_tiles::draw_from_id_string( const std::string &id, TILE_CATEGORY categ
if( vp_overridden ) {
const vpart_id &vp_id = std::get<0>( vp_override->second );
if( vp_id ) {
const point &mount = std::get<4>( vp_override->second );
point mount = std::get<4>( vp_override->second );
seed = simple_point_hash( mount );
}
} else {
Expand Down Expand Up @@ -2316,7 +2316,7 @@ bool cata_tiles::draw_from_id_string( const std::string &id, TILE_CATEGORY categ

bool cata_tiles::draw_sprite_at(
const tile_type &tile, const weighted_int_list<std::vector<int>> &svlist,
const point &p, unsigned int loc_rand, bool rota_fg, int rota, lit_level ll,
point p, unsigned int loc_rand, bool rota_fg, int rota, lit_level ll,
bool apply_night_vision_goggles, int overlay_count )
{
int nullint = 0;
Expand All @@ -2326,7 +2326,7 @@ bool cata_tiles::draw_sprite_at(

bool cata_tiles::draw_sprite_at(
const tile_type &tile, const weighted_int_list<std::vector<int>> &svlist,
const point &p, unsigned int loc_rand, bool rota_fg, int rota, lit_level ll,
point p, unsigned int loc_rand, bool rota_fg, int rota, lit_level ll,
bool apply_night_vision_goggles, int &height_3d, int overlay_count )
{
auto picked = svlist.pick( loc_rand );
Expand Down Expand Up @@ -2460,7 +2460,7 @@ bool cata_tiles::draw_sprite_at(
}

bool cata_tiles::draw_tile_at(
const tile_type &tile, const point &p, unsigned int loc_rand, int rota,
const tile_type &tile, point p, unsigned int loc_rand, int rota,
lit_level ll, bool apply_night_vision_goggles, int &height_3d, int overlay_count )
{
draw_sprite_at( tile, tile.bg, p, loc_rand, /*fg:*/ false, rota, ll,
Expand Down Expand Up @@ -2556,7 +2556,7 @@ bool cata_tiles::draw_terrain( const tripoint &p, const lit_level ll, int &heigh
const bool overridden = override != terrain_override.end();
bool neighborhood_overridden = overridden;
if( !neighborhood_overridden ) {
for( const point &dir : neighborhood ) {
for( point dir : neighborhood ) {
if( terrain_override.find( p + dir ) != terrain_override.end() ) {
neighborhood_overridden = true;
break;
Expand Down Expand Up @@ -2728,7 +2728,7 @@ bool cata_tiles::draw_furniture( const tripoint &p, const lit_level ll, int &hei
const bool overridden = override != furniture_override.end();
bool neighborhood_overridden = overridden;
if( !neighborhood_overridden ) {
for( const point &dir : neighborhood ) {
for( point dir : neighborhood ) {
if( furniture_override.find( p + dir ) != furniture_override.end() ) {
neighborhood_overridden = true;
break;
Expand Down Expand Up @@ -2802,7 +2802,7 @@ bool cata_tiles::draw_trap( const tripoint &p, const lit_level ll, int &height_3
const bool overridden = override != trap_override.end();
bool neighborhood_overridden = overridden;
if( !neighborhood_overridden ) {
for( const point &dir : neighborhood ) {
for( point dir : neighborhood ) {
if( trap_override.find( p + dir ) != trap_override.end() ) {
neighborhood_overridden = true;
break;
Expand Down Expand Up @@ -3347,7 +3347,7 @@ void cata_tiles::init_draw_item_override( const tripoint &p, const itype_id &id,
item_override.emplace( p, std::make_tuple( id, mid, hilite ) );
}
void cata_tiles::init_draw_vpart_override( const tripoint &p, const vpart_id &id,
const int part_mod, const units::angle veh_dir, const bool hilite, const point &mount )
const int part_mod, const units::angle veh_dir, const bool hilite, point mount )
{
vpart_override.emplace( p, std::make_tuple( id, part_mod, veh_dir, hilite, mount ) );
}
Expand Down Expand Up @@ -3889,7 +3889,7 @@ void cata_tiles::do_tile_loading_report( std::function<void( std::string )> out
tile_loading_report<field_type>( field_type::count(), C_FIELD, out, "" );
}

point cata_tiles::player_to_screen( const point &p ) const
point cata_tiles::player_to_screen( point p ) const
{
point screen;
if( tile_iso ) {
Expand Down
Loading