diff --git a/src/handle_action.cpp b/src/handle_action.cpp index 68e9919cb3fb0..1a29ae68bb51c 100644 --- a/src/handle_action.cpp +++ b/src/handle_action.cpp @@ -382,7 +382,7 @@ input_context game::get_player_input( std::string &action ) return ctxt; } -static void rcdrive( int dx, int dy ) +inline static void rcdrive( const point &d ) { player &u = g->u; map &m = g->m; @@ -412,7 +412,7 @@ static void rcdrive( int dx, int dy ) } item *rc_car = rc_pair->second; - tripoint dest( cx + dx, cy + dy, cz ); + tripoint dest( cx + d.x, cy + d.y, cz ); if( m.impassable( dest ) || !m.can_put_items_ter_furn( dest ) || m.has_furn( dest ) ) { sounds::sound( dest, 7, sounds::sound_t::combat, @@ -431,12 +431,7 @@ static void rcdrive( int dx, int dy ) } } -inline static void rcdrive( point d ) -{ - return rcdrive( d.x, d.y ); -} - -static void pldrive( int x, int y, int z = 0 ) +static void pldrive( const tripoint &p ) { if( !g->check_safe_mode_allowed() ) { return; @@ -479,33 +474,33 @@ static void pldrive( int x, int y, int z = 0 ) return; } } - if( z != 0 && !u.has_trait( trait_PROF_HELI_PILOT ) ) { + if( p.z != 0 && !u.has_trait( trait_PROF_HELI_PILOT ) ) { u.add_msg_if_player( m_info, _( "You have no idea how to make the vehicle fly." ) ); return; } - if( z != 0 && !g->m.has_zlevels() ) { + if( p.z != 0 && !g->m.has_zlevels() ) { u.add_msg_if_player( m_info, _( "This vehicle doesn't look very airworthy." ) ); return; } - if( z == -1 ) { + if( p.z == -1 ) { if( veh->check_heli_descend( u ) ) { u.add_msg_if_player( m_info, _( "You steer the vehicle into a descent." ) ); } else { return; } - } else if( z == 1 ) { + } else if( p.z == 1 ) { if( veh->check_heli_ascend( u ) ) { u.add_msg_if_player( m_info, _( "You steer the vehicle into an ascent." ) ); } else { return; } } - veh->pldrive( point( x, y ), z ); + veh->pldrive( p.xy(), p.z ); } inline static void pldrive( point d ) { - return pldrive( d.x, d.y ); + return pldrive( tripoint( d, 0 ) ); } static void open() @@ -1817,7 +1812,7 @@ bool game::handle_action() if( !u.in_vehicle ) { vertical_move( -1, false ); } else if( veh_ctrl && vp->vehicle().is_rotorcraft() ) { - pldrive( 0, 0, -1 ); + pldrive( tripoint_below ); } break; @@ -1832,7 +1827,7 @@ bool game::handle_action() if( !u.in_vehicle ) { vertical_move( 1, false ); } else if( veh_ctrl && vp->vehicle().is_rotorcraft() ) { - pldrive( 0, 0, 1 ); + pldrive( tripoint_above ); } break; diff --git a/src/iuse_software_sokoban.cpp b/src/iuse_software_sokoban.cpp index 41e32921647c6..c07d25ab1d56a 100644 --- a/src/iuse_software_sokoban.cpp +++ b/src/iuse_software_sokoban.cpp @@ -100,26 +100,26 @@ void sokoban_game::parse_level( std::istream &fin ) } } -int sokoban_game::get_wall_connection( const int iY, const int iX ) +int sokoban_game::get_wall_connection( const point &i ) { bool bTop = false; bool bRight = false; bool bBottom = false; bool bLeft = false; - if( mLevel[iY - 1][iX] == "#" ) { + if( mLevel[i.y - 1][i.x] == "#" ) { bTop = true; } - if( mLevel[iY][iX + 1] == "#" ) { + if( mLevel[i.y][i.x + 1] == "#" ) { bRight = true; } - if( mLevel[iY + 1][iX] == "#" ) { + if( mLevel[i.y + 1][i.x] == "#" ) { bBottom = true; } - if( mLevel[iY][iX - 1] == "#" ) { + if( mLevel[i.y][i.x - 1] == "#" ) { bLeft = true; } @@ -184,7 +184,7 @@ void sokoban_game::draw_level( const catacurses::window &w_sokoban ) if( sTile == "#" ) { mvwputch( w_sokoban, point( iOffsetX + iterX->first, iOffsetY + elem.first ), - c_white, get_wall_connection( elem.first, iterX->first ) ); + c_white, get_wall_connection( point( iterX->first, elem.first ) ) ); } else { nc_color cCol = c_white; diff --git a/src/iuse_software_sokoban.h b/src/iuse_software_sokoban.h index b711d91fa27c9..2b94e1a8be674 100644 --- a/src/iuse_software_sokoban.h +++ b/src/iuse_software_sokoban.h @@ -9,6 +9,8 @@ #include #include +struct point; + namespace catacurses { class window; @@ -50,7 +52,7 @@ class sokoban_game void parse_level( std::istream &fin ); bool check_win(); - int get_wall_connection( int iY, int iX ); + int get_wall_connection( const point & ); void draw_level( const catacurses::window &w_sokoban ); void clear_level( const catacurses::window &w_sokoban ); void print_score( const catacurses::window &w_sokoban, int iScore, int iMoves ); diff --git a/src/map_field.cpp b/src/map_field.cpp index a29d3381279c7..036462b55ddeb 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -384,7 +384,7 @@ If you need to insert a new field behavior per unit time add a case statement in bool map::process_fields_in_submap( submap *const current_submap, const tripoint &submap ) { - scent_block sblk( submap.x, submap.y, submap.z, g->scent ); + scent_block sblk( submap, g->scent ); // This should be true only when the field changes transparency // More correctly: not just when the field is opaque, but when it changes state diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 8a482590b20ad..1e1f0c82fb257 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -100,9 +100,8 @@ static const trait_id trait_NPC_STATIC_NPC( "NPC_STATIC_NPC" ); #define MON_RADIUS 3 -void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ); -void set_science_room( map *m, int x1, int y1, bool faces_right, const time_point &when ); -void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata &dat ); +static void science_room( map *m, const point &p1, const point &p2, int z, int rotate ); +static void build_mine_room( room_type type, const point &p1, const point &p2, mapgendata &dat ); // (x,y,z) are absolute coordinates of a submap // x%2 and y%2 must be 0! @@ -821,8 +820,8 @@ class jmapgen_alternativly : public jmapgen_piece chosen->get().apply( dat, x, y ); } } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; @@ -953,8 +952,8 @@ class jmapgen_sign : public jmapgen_piece replace_name_tags( signtext ); return signtext; } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1028,8 +1027,8 @@ class jmapgen_vending_machine : public jmapgen_piece dat.m.furn_set( point( rx, ry ), f_null ); dat.m.place_vending( point( rx, ry ), item_group_id, reinforced ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1054,8 +1053,8 @@ class jmapgen_toilet : public jmapgen_piece dat.m.place_toilet( point( rx, ry ), charges ); } } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1092,8 +1091,8 @@ class jmapgen_gaspump : public jmapgen_piece dat.m.place_gas_pump( point( rx, ry ), charges ); } } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; @@ -1370,8 +1369,8 @@ class jmapgen_vehicle : public jmapgen_piece } dat.m.add_vehicle( type, point( x.get(), y.get() ), random_entry( rotation ), fuel, status ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1436,8 +1435,8 @@ class jmapgen_trap : public jmapgen_piece const tripoint actual_loc = tripoint( x.get(), y.get(), dat.m.get_abs_sub().z ); dat.m.trap_set( actual_loc, id ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1453,8 +1452,8 @@ class jmapgen_furniture : public jmapgen_piece void apply( mapgendata &dat, const jmapgen_int &x, const jmapgen_int &y ) const override { dat.m.furn_set( point( x.get(), y.get() ), id ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1478,8 +1477,8 @@ class jmapgen_terrain : public jmapgen_piece } } } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1576,8 +1575,8 @@ class jmapgen_computer : public jmapgen_piece cpu->set_access_denied_msg( access_denied.translated() ); } } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; @@ -1679,8 +1678,8 @@ class jmapgen_sealed_item : public jmapgen_piece } dat.m.furn_set( point( x.get(), y.get() ), furniture ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { - return dat.m.veh_at( tripoint( x, y, dat.zlevel() ) ).has_value(); + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { + return dat.m.veh_at( tripoint( p, dat.zlevel() ) ).has_value(); } }; /** @@ -1837,7 +1836,7 @@ class jmapgen_nested : public jmapgen_piece ( *ptr )->nest( dat, point( x.get(), y.get() ) ); } - bool has_vehicle_collision( mapgendata &dat, int x, int y ) const override { + bool has_vehicle_collision( mapgendata &dat, const point &p ) const override { const weighted_int_list &selected_entries = neighbors.test( dat ) ? entries : else_entries; if( selected_entries.empty() ) { @@ -1853,7 +1852,7 @@ class jmapgen_nested : public jmapgen_piece return false; } for( const auto &nest : iter->second ) { - if( nest.obj->has_vehicle_collision( dat, { x, y } ) ) { + if( nest.obj->has_vehicle_collision( dat, p ) ) { return true; } } @@ -2817,7 +2816,7 @@ bool jmapgen_objects::has_vehicle_collision( mapgendata &dat, const point &offse auto where = obj.first; where.offset( -offset ); const auto &what = *obj.second; - if( what.has_vehicle_collision( dat, where.x.get(), where.y.get() ) ) { + if( what.has_vehicle_collision( dat, point( where.x.get(), where.y.get() ) ) ) { return true; } } @@ -2923,7 +2922,7 @@ void map::draw_office_tower( mapgendata &dat ) if( terrain_type == "office_tower_1_entrance" ) { dat.fill_groundcover(); - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "ss%|....+...|...|EEED...\n" "ss%|----|...|...|EEx|...\n" "ss%Vcdc^|...|-+-|---|...\n" @@ -2976,7 +2975,7 @@ void map::draw_office_tower( mapgendata &dat ) ( dat.north() == "office_tower_1" && dat.east() == "office_tower_1_entrance" ) || ( dat.west() == "office_tower_1" && dat.north() == "office_tower_1_entrance" ) || ( dat.south() == "office_tower_1" && dat.west() == "office_tower_1_entrance" ) ) { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, " ssssssssssssssssssssssss\n" "ssssssssssssssssssssssss\n" "ss \n" @@ -3040,7 +3039,7 @@ void map::draw_office_tower( mapgendata &dat ) ( dat.north() == "office_tower_1_entrance" && dat.east() == "office_tower_1" ) || ( dat.west() == "office_tower_1" && dat.south() == "office_tower_1_entrance" ) || ( dat.south() == "office_tower_1" && dat.east() == "office_tower_1_entrance" ) ) { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "...DEEE|...|..|-----|%ss\n" "...|EEE|...|..|^...lV%ss\n" "...|---|-+-|......hdV%ss\n" @@ -3089,7 +3088,7 @@ void map::draw_office_tower( mapgendata &dat ) rotate( 3 ); } } else { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "ssssssssssssssssssssssss\n" "ssssssssssssssssssssssss\n" " ss\n" @@ -3143,7 +3142,7 @@ void map::draw_office_tower( mapgendata &dat ) } } else if( terrain_type == "office_tower_b_entrance" ) { dat.fill_groundcover(); - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "sss|........|...|EEED___\n" "sss|........|...|EEx|___\n" "sss|........|-+-|---|HHG\n" @@ -3189,7 +3188,7 @@ void map::draw_office_tower( mapgendata &dat ) ( dat.north() == "office_tower_b" && dat.east() == "office_tower_b_entrance" ) || ( dat.west() == "office_tower_b" && dat.north() == "office_tower_b_entrance" ) || ( dat.south() == "office_tower_b" && dat.west() == "office_tower_b_entrance" ) ) { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "ssssssssssssssssssssssss\n" "ssssssssssssssssssssssss\n" "sss|--------------------\n" @@ -3276,7 +3275,7 @@ void map::draw_office_tower( mapgendata &dat ) ( dat.north() == "office_tower_b_entrance" && dat.east() == "office_tower_b" ) || ( dat.west() == "office_tower_b" && dat.south() == "office_tower_b_entrance" ) || ( dat.south() == "office_tower_b" && dat.east() == "office_tower_b_entrance" ) ) { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "___DEEE|...|...,,...|sss\n" "___|EEE|...|..,,,,..|sss\n" "GHH|---|-+-|...,,...|sss\n" @@ -3355,7 +3354,7 @@ void map::draw_office_tower( mapgendata &dat ) } } } else { - mapf::formatted_set_simple( this, 0, 0, + mapf::formatted_set_simple( this, point_zero, "ssssssssssssssssssssssss\n" "ssssssssssssssssssssssss\n" "--------------------|sss\n" @@ -3522,8 +3521,8 @@ void map::draw_lab( mapgendata &dat ) ter_set( point( SEEX + 1, SEEY - 1 ), t_door_metal_c ); ter_set( point( SEEX - 1, SEEY * 2 - 3 ), t_stairs_down ); ter_set( point( SEEX, SEEY * 2 - 3 ), t_stairs_down ); - science_room( this, 2, 2, SEEX - 3, SEEY * 2 - 3, dat.zlevel(), 1 ); - science_room( this, SEEX + 2, 2, SEEX * 2 - 3, SEEY * 2 - 3, dat.zlevel(), 3 ); + science_room( this, point( 2, 2 ), point( SEEX - 3, SEEY * 2 - 3 ), dat.zlevel(), 1 ); + science_room( this, point( SEEX + 2, 2 ), point( SEEX * 2 - 3, SEEY * 2 - 3 ), dat.zlevel(), 3 ); place_spawns( GROUP_TURRET, 1, point( SEEX, 5 ), point( SEEX, 5 ), 1, true ); @@ -3691,40 +3690,40 @@ void map::draw_lab( mapgendata &dat ) // Top left if( one_in( 2 ) ) { ter_set( point( SEEX - 2, int( SEEY / 2 ) ), t_door_glass_frosted_c ); - science_room( this, lw, tw, SEEX - 3, SEEY - 3, dat.zlevel(), 1 ); + science_room( this, point( lw, tw ), point( SEEX - 3, SEEY - 3 ), dat.zlevel(), 1 ); } else { ter_set( point( SEEX / 2, SEEY - 2 ), t_door_glass_frosted_c ); - science_room( this, lw, tw, SEEX - 3, SEEY - 3, dat.zlevel(), 2 ); + science_room( this, point( lw, tw ), point( SEEX - 3, SEEY - 3 ), dat.zlevel(), 2 ); } // Top right if( one_in( 2 ) ) { ter_set( point( SEEX + 1, int( SEEY / 2 ) ), t_door_glass_frosted_c ); - science_room( this, SEEX + 2, tw, EAST_EDGE - rw, SEEY - 3, + science_room( this, point( SEEX + 2, tw ), point( EAST_EDGE - rw, SEEY - 3 ), dat.zlevel(), 3 ); } else { ter_set( point( SEEX + int( SEEX / 2 ), SEEY - 2 ), t_door_glass_frosted_c ); - science_room( this, SEEX + 2, tw, EAST_EDGE - rw, SEEY - 3, + science_room( this, point( SEEX + 2, tw ), point( EAST_EDGE - rw, SEEY - 3 ), dat.zlevel(), 2 ); } // Bottom left if( one_in( 2 ) ) { ter_set( point( SEEX / 2, SEEY + 1 ), t_door_glass_frosted_c ); - science_room( this, lw, SEEY + 2, SEEX - 3, SOUTH_EDGE - bw, + science_room( this, point( lw, SEEY + 2 ), point( SEEX - 3, SOUTH_EDGE - bw ), dat.zlevel(), 0 ); } else { ter_set( point( SEEX - 2, SEEY + int( SEEY / 2 ) ), t_door_glass_frosted_c ); - science_room( this, lw, SEEY + 2, SEEX - 3, SOUTH_EDGE - bw, + science_room( this, point( lw, SEEY + 2 ), point( SEEX - 3, SOUTH_EDGE - bw ), dat.zlevel(), 1 ); } // Bottom right if( one_in( 2 ) ) { ter_set( point( SEEX + int( SEEX / 2 ), SEEY + 1 ), t_door_glass_frosted_c ); - science_room( this, SEEX + 2, SEEY + 2, EAST_EDGE - rw, - SOUTH_EDGE - bw, dat.zlevel(), 0 ); + science_room( this, point( SEEX + 2, SEEY + 2 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), + dat.zlevel(), 0 ); } else { ter_set( point( SEEX + 1, SEEY + int( SEEY / 2 ) ), t_door_glass_frosted_c ); - science_room( this, SEEX + 2, SEEY + 2, EAST_EDGE - rw, - SOUTH_EDGE - bw, dat.zlevel(), 3 ); + science_room( this, point( SEEX + 2, SEEY + 2 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), + dat.zlevel(), 3 ); } if( rw == 1 ) { ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); @@ -3807,20 +3806,20 @@ void map::draw_lab( mapgendata &dat ) ter_set( point( SEEX + int( SEEX / 2 ), SEEY + 3 ), t_door_glass_frosted_c ); ter_set( point( SEEX - 4, SEEY + int( SEEY / 2 ) ), t_door_glass_frosted_c ); ter_set( point( SEEX + 3, SEEY + int( SEEY / 2 ) ), t_door_glass_frosted_c ); - science_room( this, lw, tw, SEEX - 5, SEEY - 5, dat.zlevel(), + science_room( this, point( lw, tw ), point( SEEX - 5, SEEY - 5 ), dat.zlevel(), rng( 1, 2 ) ); - science_room( this, SEEX - 3, tw, SEEX + 2, SEEY - 5, dat.zlevel(), 2 ); - science_room( this, SEEX + 4, tw, EAST_EDGE - rw, SEEY - 5, + science_room( this, point( SEEX - 3, tw ), point( SEEX + 2, SEEY - 5 ), dat.zlevel(), 2 ); + science_room( this, point( SEEX + 4, tw ), point( EAST_EDGE - rw, SEEY - 5 ), dat.zlevel(), rng( 2, 3 ) ); - science_room( this, lw, SEEY - 3, SEEX - 5, SEEY + 2, dat.zlevel(), 1 ); - science_room( this, SEEX + 4, SEEY - 3, EAST_EDGE - rw, SEEY + 2, + science_room( this, point( lw, SEEY - 3 ), point( SEEX - 5, SEEY + 2 ), dat.zlevel(), 1 ); + science_room( this, point( SEEX + 4, SEEY - 3 ), point( EAST_EDGE - rw, SEEY + 2 ), dat.zlevel(), 3 ); - science_room( this, lw, SEEY + 4, SEEX - 5, SOUTH_EDGE - bw, + science_room( this, point( lw, SEEY + 4 ), point( SEEX - 5, SOUTH_EDGE - bw ), dat.zlevel(), rng( 0, 1 ) ); - science_room( this, SEEX - 3, SEEY + 4, SEEX + 2, SOUTH_EDGE - bw, + science_room( this, point( SEEX - 3, SEEY + 4 ), point( SEEX + 2, SOUTH_EDGE - bw ), dat.zlevel(), 0 ); - science_room( this, SEEX + 4, SEEX + 4, EAST_EDGE - rw, - SOUTH_EDGE - bw, dat.zlevel(), 3 * rng( 0, 1 ) ); + science_room( this, point( SEEX + 4, SEEX + 4 ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), + dat.zlevel(), 3 * rng( 0, 1 ) ); if( rw == 1 ) { ter_set( point( EAST_EDGE, SEEY - 1 ), t_door_metal_c ); ter_set( point( EAST_EDGE, SEEY ), t_door_metal_c ); @@ -3848,7 +3847,7 @@ void map::draw_lab( mapgendata &dat ) } } } - science_room( this, lw, tw, EAST_EDGE - rw, SOUTH_EDGE - bw, + science_room( this, point( lw, tw ), point( EAST_EDGE - rw, SOUTH_EDGE - bw ), dat.zlevel(), rng( 0, 3 ) ); if( rw == 1 ) { @@ -4704,7 +4703,7 @@ void map::draw_mine( mapgendata &dat ) int x2 = x1 + rng( 4, 9 ); int y2 = y1 + rng( 4, 9 ); if( build_shaft ) { - build_mine_room( room_mine_shaft, x1, y1, x2, y2, dat ); + build_mine_room( room_mine_shaft, point( x1, y1 ), point( x2, y2 ), dat ); build_shaft = false; } else { bool okay = true; @@ -4715,7 +4714,7 @@ void map::draw_mine( mapgendata &dat ) } if( okay ) { room_type type = static_cast( rng( room_mine_office, room_mine_housing ) ); - build_mine_room( type, x1, y1, x2, y2, dat ); + build_mine_room( type, point( x1, y1 ), point( x2, y2 ), dat ); tries = 0; } else { tries++; @@ -6373,17 +6372,17 @@ bool connects_to( const oter_id &there, int dir ) } } -void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) +void science_room( map *m, const point &p1, const point &p2, int z, int rotate ) { - int height = y2 - y1; - int width = x2 - x1; + int height = p2.y - p1.y; + int width = p2.x - p1.x; if( rotate % 2 == 1 ) { // Swap width & height if we're a lateral room int tmp = height; height = width; width = tmp; } - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { + for( int i = p1.x; i <= p2.x; i++ ) { + for( int j = p1.y; j <= p2.y; j++ ) { m->ter_set( point( i, j ), t_thconc_floor ); } } @@ -6418,21 +6417,21 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) } } - int trapx = rng( x1 + 1, x2 - 1 ); - int trapy = rng( y1 + 1, y2 - 1 ); + int trapx = rng( p1.x + 1, p2.x - 1 ); + int trapy = rng( p1.y + 1, p2.y - 1 ); switch( random_entry( valid_rooms ) ) { case room_closet: - m->place_items( "cleaning", 80, point( x1, y1 ), point( x2, y2 ), false, + m->place_items( "cleaning", 80, p1, p2, false, calendar::start_of_cataclysm ); break; case room_lobby: if( rotate % 2 == 0 ) { // Vertical - int desk = y1 + rng( static_cast( height / 2 ) - static_cast( height / 4 ), - static_cast( height / 2 ) + 1 ); - for( int x = x1 + static_cast( width / 4 ); x < x2 - static_cast( width / 4 ); x++ ) { + int desk = p1.y + rng( static_cast( height / 2 ) - static_cast( height / 4 ), + static_cast( height / 2 ) + 1 ); + for( int x = p1.x + static_cast( width / 4 ); x < p2.x - static_cast( width / 4 ); x++ ) { m->furn_set( point( x, desk ), f_counter ); } - computer *tmpcomp = m->add_computer( tripoint( x2 - static_cast( width / 4 ), desk, z ), + computer *tmpcomp = m->add_computer( tripoint( p2.x - static_cast( width / 4 ), desk, z ), _( "Log Console" ), 3 ); tmpcomp->add_option( _( "View Research Logs" ), COMPACT_RESEARCH, 0 ); tmpcomp->add_option( _( "Download Map Data" ), COMPACT_MAPS, 0 ); @@ -6440,15 +6439,15 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) tmpcomp->add_failure( COMPFAIL_ALARM ); tmpcomp->add_failure( COMPFAIL_DAMAGE ); m->place_spawns( GROUP_TURRET, 1, - point( static_cast( ( x1 + x2 ) / 2 ), desk ), - point( static_cast( ( x1 + x2 ) / 2 ), desk ), 1, true ); + point( static_cast( ( p1.x + p2.x ) / 2 ), desk ), + point( static_cast( ( p1.x + p2.x ) / 2 ), desk ), 1, true ); } else { - int desk = x1 + rng( static_cast( height / 2 ) - static_cast( height / 4 ), - static_cast( height / 2 ) + 1 ); - for( int y = y1 + static_cast( width / 4 ); y < y2 - static_cast( width / 4 ); y++ ) { + int desk = p1.x + rng( static_cast( height / 2 ) - static_cast( height / 4 ), + static_cast( height / 2 ) + 1 ); + for( int y = p1.y + static_cast( width / 4 ); y < p2.y - static_cast( width / 4 ); y++ ) { m->furn_set( point( desk, y ), f_counter ); } - computer *tmpcomp = m->add_computer( tripoint( desk, y2 - static_cast( width / 4 ), z ), + computer *tmpcomp = m->add_computer( tripoint( desk, p2.y - static_cast( width / 4 ), z ), _( "Log Console" ), 3 ); tmpcomp->add_option( _( "View Research Logs" ), COMPACT_RESEARCH, 0 ); tmpcomp->add_option( _( "Download Map Data" ), COMPACT_MAPS, 0 ); @@ -6456,37 +6455,37 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) tmpcomp->add_failure( COMPFAIL_ALARM ); tmpcomp->add_failure( COMPFAIL_DAMAGE ); m->place_spawns( GROUP_TURRET, 1, - point( desk, static_cast( ( y1 + y2 ) / 2 ) ), - point( desk, static_cast( ( y1 + y2 ) / 2 ) ), 1, true ); + point( desk, static_cast( ( p1.y + p2.y ) / 2 ) ), + point( desk, static_cast( ( p1.y + p2.y ) / 2 ) ), 1, true ); } break; case room_chemistry: if( rotate % 2 == 0 ) { // Vertical - for( int x = x1; x <= x2; x++ ) { + for( int x = p1.x; x <= p2.x; x++ ) { if( x % 3 == 0 ) { - for( int y = y1 + 1; y <= y2 - 1; y++ ) { + for( int y = p1.y + 1; y <= p2.y - 1; y++ ) { m->furn_set( point( x, y ), f_counter ); } if( one_in( 3 ) ) { - m->place_items( "mut_lab", 35, point( x, y1 + 1 ), point( x, y2 - 1 ), false, + m->place_items( "mut_lab", 35, point( x, p1.y + 1 ), point( x, p2.y - 1 ), false, calendar::start_of_cataclysm ); } else { - m->place_items( "chem_lab", 70, point( x, y1 + 1 ), point( x, y2 - 1 ), false, + m->place_items( "chem_lab", 70, point( x, p1.y + 1 ), point( x, p2.y - 1 ), false, calendar::start_of_cataclysm ); } } } } else { - for( int y = y1; y <= y2; y++ ) { + for( int y = p1.y; y <= p2.y; y++ ) { if( y % 3 == 0 ) { - for( int x = x1 + 1; x <= x2 - 1; x++ ) { + for( int x = p1.x + 1; x <= p2.x - 1; x++ ) { m->furn_set( point( x, y ), f_counter ); } if( one_in( 3 ) ) { - m->place_items( "mut_lab", 35, point( x1 + 1, y ), point( x2 - 1, y ), false, + m->place_items( "mut_lab", 35, point( p1.x + 1, y ), point( p2.x - 1, y ), false, calendar::start_of_cataclysm ); } else { - m->place_items( "chem_lab", 70, point( x1 + 1, y ), point( x2 - 1, y ), false, + m->place_items( "chem_lab", 70, point( p1.x + 1, y ), point( p2.x - 1, y ), false, calendar::start_of_cataclysm ); } } @@ -6494,46 +6493,53 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) } break; case room_teleport: - m->furn_set( point( ( x1 + x2 ) / 2, static_cast( ( y1 + y2 ) / 2 ) ), f_counter ); - m->furn_set( point( static_cast( ( x1 + x2 ) / 2 ) + 1, static_cast( ( y1 + y2 ) / 2 ) ), + m->furn_set( point( ( p1.x + p2.x ) / 2, static_cast( ( p1.y + p2.y ) / 2 ) ), f_counter ); + m->furn_set( point( static_cast( ( p1.x + p2.x ) / 2 ) + 1, + static_cast( ( p1.y + p2.y ) / 2 ) ), f_counter ); - m->furn_set( point( ( x1 + x2 ) / 2, static_cast( ( y1 + y2 ) / 2 ) + 1 ), + m->furn_set( point( ( p1.x + p2.x ) / 2, static_cast( ( p1.y + p2.y ) / 2 ) + 1 ), f_counter ); - m->furn_set( point( static_cast( ( x1 + x2 ) / 2 ) + 1, - static_cast( ( y1 + y2 ) / 2 ) + 1 ), + m->furn_set( point( static_cast( ( p1.x + p2.x ) / 2 ) + 1, + static_cast( ( p1.y + p2.y ) / 2 ) + 1 ), f_counter ); mtrap_set( m, point( trapx, trapy ), tr_telepad ); - m->place_items( "teleport", 70, point( ( x1 + x2 ) / 2, static_cast( ( y1 + y2 ) / 2 ) ), - point( static_cast( ( x1 + x2 ) / 2 ) + 1, static_cast( ( y1 + y2 ) / 2 ) + 1 ), false, + m->place_items( "teleport", 70, point( ( p1.x + p2.x ) / 2, + static_cast( ( p1.y + p2.y ) / 2 ) ), + point( static_cast( ( p1.x + p2.x ) / 2 ) + 1, static_cast( ( p1.y + p2.y ) / 2 ) + 1 ), + false, calendar::start_of_cataclysm ); break; case room_goo: do { mtrap_set( m, point( trapx, trapy ), tr_goo ); - trapx = rng( x1 + 1, x2 - 1 ); - trapy = rng( y1 + 1, y2 - 1 ); + trapx = rng( p1.x + 1, p2.x - 1 ); + trapy = rng( p1.y + 1, p2.y - 1 ); } while( !one_in( 5 ) ); if( rotate == 0 ) { - mremove_trap( m, point( x1, y2 ) ); - m->furn_set( point( x1, y2 ), f_fridge ); - m->place_items( "goo", 60, point( x1, y2 ), point( x1, y2 ), false, calendar::start_of_cataclysm ); + mremove_trap( m, point( p1.x, p2.y ) ); + m->furn_set( point( p1.x, p2.y ), f_fridge ); + m->place_items( "goo", 60, point( p1.x, p2.y ), point( p1.x, p2.y ), false, + calendar::start_of_cataclysm ); } else if( rotate == 1 ) { - mremove_trap( m, point( x1, y1 ) ); - m->furn_set( point( x1, y1 ), f_fridge ); - m->place_items( "goo", 60, point( x1, y1 ), point( x1, y1 ), false, calendar::start_of_cataclysm ); + mremove_trap( m, p1 ); + m->furn_set( p1, f_fridge ); + m->place_items( "goo", 60, p1, p1, false, + calendar::start_of_cataclysm ); } else if( rotate == 2 ) { - mremove_trap( m, point( x2, y1 ) ); - m->furn_set( point( x2, y1 ), f_fridge ); - m->place_items( "goo", 60, point( x2, y1 ), point( x2, y1 ), false, calendar::start_of_cataclysm ); + mremove_trap( m, point( p2.x, p1.y ) ); + m->furn_set( point( p2.x, p1.y ), f_fridge ); + m->place_items( "goo", 60, point( p2.x, p1.y ), point( p2.x, p1.y ), false, + calendar::start_of_cataclysm ); } else { - mremove_trap( m, point( x2, y2 ) ); - m->furn_set( point( x2, y2 ), f_fridge ); - m->place_items( "goo", 60, point( x2, y2 ), point( x2, y2 ), false, calendar::start_of_cataclysm ); + mremove_trap( m, p2 ); + m->furn_set( p2, f_fridge ); + m->place_items( "goo", 60, p2, p2, false, + calendar::start_of_cataclysm ); } break; case room_cloning: - for( int x = x1 + 1; x <= x2 - 1; x++ ) { - for( int y = y1 + 1; y <= y2 - 1; y++ ) { + for( int x = p1.x + 1; x <= p2.x - 1; x++ ) { + for( int y = p1.y + 1; y <= p2.y - 1; y++ ) { if( x % 3 == 0 && y % 3 == 0 ) { m->ter_set( point( x, y ), t_vat ); m->place_items( "cloning_vat", 20, point( x, y ), point( x, y ), false, @@ -6544,44 +6550,44 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) break; case room_vivisect: if( rotate == 0 ) { - for( int x = x1; x <= x2; x++ ) { - m->furn_set( point( x, y2 - 1 ), f_counter ); + for( int x = p1.x; x <= p2.x; x++ ) { + m->furn_set( point( x, p2.y - 1 ), f_counter ); } - m->place_items( "dissection", 80, point( x1, y2 - 1 ), point( x2, y2 - 1 ), false, + m->place_items( "dissection", 80, point( p1.x, p2.y - 1 ), p2 + point_north, false, calendar::start_of_cataclysm ); } else if( rotate == 1 ) { - for( int y = y1; y <= y2; y++ ) { - m->furn_set( point( x1 + 1, y ), f_counter ); + for( int y = p1.y; y <= p2.y; y++ ) { + m->furn_set( point( p1.x + 1, y ), f_counter ); } - m->place_items( "dissection", 80, point( x1 + 1, y1 ), point( x1 + 1, y2 ), false, + m->place_items( "dissection", 80, p1 + point_east, point( p1.x + 1, p2.y ), false, calendar::start_of_cataclysm ); } else if( rotate == 2 ) { - for( int x = x1; x <= x2; x++ ) { - m->furn_set( point( x, y1 + 1 ), f_counter ); + for( int x = p1.x; x <= p2.x; x++ ) { + m->furn_set( point( x, p1.y + 1 ), f_counter ); } - m->place_items( "dissection", 80, point( x1, y1 + 1 ), point( x2, y1 + 1 ), false, + m->place_items( "dissection", 80, p1 + point_south, point( p2.x, p1.y + 1 ), false, calendar::start_of_cataclysm ); } else if( rotate == 3 ) { - for( int y = y1; y <= y2; y++ ) { - m->furn_set( point( x2 - 1, y ), f_counter ); + for( int y = p1.y; y <= p2.y; y++ ) { + m->furn_set( point( p2.x - 1, y ), f_counter ); } - m->place_items( "dissection", 80, point( x2 - 1, y1 ), point( x2 - 1, y2 ), false, + m->place_items( "dissection", 80, point( p2.x - 1, p1.y ), p2 + point_west, false, calendar::start_of_cataclysm ); } - mtrap_set( m, point( ( x1 + x2 ) / 2, static_cast( ( y1 + y2 ) / 2 ) ), + mtrap_set( m, point( ( p1.x + p2.x ) / 2, static_cast( ( p1.y + p2.y ) / 2 ) ), tr_dissector ); m->place_spawns( GROUP_LAB_CYBORG, 10, - point( static_cast( ( ( x1 + x2 ) / 2 ) + 1 ), - static_cast( ( ( y1 + y2 ) / 2 ) + 1 ) ), - point( static_cast( ( ( x1 + x2 ) / 2 ) + 1 ), - static_cast( ( ( y1 + y2 ) / 2 ) + 1 ) ), 1, true ); + point( static_cast( ( ( p1.x + p2.x ) / 2 ) + 1 ), + static_cast( ( ( p1.y + p2.y ) / 2 ) + 1 ) ), + point( static_cast( ( ( p1.x + p2.x ) / 2 ) + 1 ), + static_cast( ( ( p1.y + p2.y ) / 2 ) + 1 ) ), 1, true ); break; case room_bionics: if( rotate % 2 == 0 ) { - int biox = x1 + 2; - int bioy = static_cast( ( y1 + y2 ) / 2 ); - mapf::formatted_set_simple( m, biox - 1, bioy - 1, + int biox = p1.x + 2; + int bioy = static_cast( ( p1.y + p2.y ) / 2 ); + mapf::formatted_set_simple( m, point( biox - 1, bioy - 1 ), "---\n" "|c|\n" "-=-\n", @@ -6599,8 +6605,8 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) tmpcomp->set_access_denied_msg( _( "ERROR! Access denied! Unauthorized access will be met with lethal force!" ) ); - biox = x2 - 2; - mapf::formatted_set_simple( m, biox - 1, bioy - 1, + biox = p2.x - 2; + mapf::formatted_set_simple( m, point( biox - 1, bioy - 1 ), "-=-\n" "|c|\n" "---\n", @@ -6618,9 +6624,9 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) tmpcomp2->set_access_denied_msg( _( "ERROR! Access denied! Unauthorized access will be met with lethal force!" ) ); } else { - int bioy = y1 + 2; - int biox = static_cast( ( x1 + x2 ) / 2 ); - mapf::formatted_set_simple( m, biox - 1, bioy - 1, + int bioy = p1.y + 2; + int biox = static_cast( ( p1.x + p2.x ) / 2 ); + mapf::formatted_set_simple( m, point( biox - 1, bioy - 1 ), "|-|\n" "|c=\n" "|-|\n", @@ -6638,8 +6644,8 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) tmpcomp->set_access_denied_msg( _( "ERROR! Access denied! Unauthorized access will be met with lethal force!" ) ); - bioy = y2 - 2; - mapf::formatted_set_simple( m, biox - 1, bioy - 1, + bioy = p2.y - 2; + mapf::formatted_set_simple( m, point( biox - 1, bioy - 1 ), "|-|\n" "=c|\n" "|-|\n", @@ -6659,70 +6665,74 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) break; case room_dorm: if( rotate % 2 == 0 ) { - for( int y = y1 + 1; y <= y2 - 1; y += 3 ) { - m->furn_set( point( x1, y ), f_bed ); - m->place_items( "bed", 60, point( x1, y ), point( x1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x1 + 1, y ), f_bed ); - m->place_items( "bed", 60, point( x1 + 1, y ), point( x1 + 1, y ), false, + for( int y = p1.y + 1; y <= p2.y - 1; y += 3 ) { + m->furn_set( point( p1.x, y ), f_bed ); + m->place_items( "bed", 60, point( p1.x, y ), point( p1.x, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x2, y ), f_bed ); - m->place_items( "bed", 60, point( x2, y ), point( x2, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x2 - 1, y ), f_bed ); - m->place_items( "bed", 60, point( x2 - 1, y ), point( x2 - 1, y ), false, + m->furn_set( point( p1.x + 1, y ), f_bed ); + m->place_items( "bed", 60, point( p1.x + 1, y ), point( p1.x + 1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x1, y + 1 ), f_dresser ); - m->furn_set( point( x2, y + 1 ), f_dresser ); - m->place_items( "dresser", 70, point( x1, y + 1 ), point( x1, y + 1 ), false, + m->furn_set( point( p2.x, y ), f_bed ); + m->place_items( "bed", 60, point( p2.x, y ), point( p2.x, y ), false, calendar::start_of_cataclysm ); - m->place_items( "dresser", 70, point( x2, y + 1 ), point( x2, y + 1 ), false, + m->furn_set( point( p2.x - 1, y ), f_bed ); + m->place_items( "bed", 60, point( p2.x - 1, y ), point( p2.x - 1, y ), false, + calendar::start_of_cataclysm ); + m->furn_set( point( p1.x, y + 1 ), f_dresser ); + m->furn_set( point( p2.x, y + 1 ), f_dresser ); + m->place_items( "dresser", 70, point( p1.x, y + 1 ), point( p1.x, y + 1 ), false, + calendar::start_of_cataclysm ); + m->place_items( "dresser", 70, point( p2.x, y + 1 ), point( p2.x, y + 1 ), false, calendar::start_of_cataclysm ); } } else if( rotate % 2 == 1 ) { - for( int x = x1 + 1; x <= x2 - 1; x += 3 ) { - m->furn_set( point( x, y1 ), f_bed ); - m->place_items( "bed", 60, point( x, y1 ), point( x, y1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, y1 + 1 ), f_bed ); - m->place_items( "bed", 60, point( x, y1 + 1 ), point( x, y1 + 1 ), false, + for( int x = p1.x + 1; x <= p2.x - 1; x += 3 ) { + m->furn_set( point( x, p1.y ), f_bed ); + m->place_items( "bed", 60, point( x, p1.y ), point( x, p1.y ), false, + calendar::start_of_cataclysm ); + m->furn_set( point( x, p1.y + 1 ), f_bed ); + m->place_items( "bed", 60, point( x, p1.y + 1 ), point( x, p1.y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, y2 ), f_bed ); - m->place_items( "bed", 60, point( x, y2 ), point( x, y2 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, y2 - 1 ), f_bed ); - m->place_items( "bed", 60, point( x, y2 - 1 ), point( x, y2 - 1 ), false, + m->furn_set( point( x, p2.y ), f_bed ); + m->place_items( "bed", 60, point( x, p2.y ), point( x, p2.y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x + 1, y1 ), f_dresser ); - m->furn_set( point( x + 1, y2 ), f_dresser ); - m->place_items( "dresser", 70, point( x + 1, y1 ), point( x + 1, y1 ), false, + m->furn_set( point( x, p2.y - 1 ), f_bed ); + m->place_items( "bed", 60, point( x, p2.y - 1 ), point( x, p2.y - 1 ), false, calendar::start_of_cataclysm ); - m->place_items( "dresser", 70, point( x + 1, y2 ), point( x + 1, y2 ), false, + m->furn_set( point( x + 1, p1.y ), f_dresser ); + m->furn_set( point( x + 1, p2.y ), f_dresser ); + m->place_items( "dresser", 70, point( x + 1, p1.y ), point( x + 1, p1.y ), false, + calendar::start_of_cataclysm ); + m->place_items( "dresser", 70, point( x + 1, p2.y ), point( x + 1, p2.y ), false, calendar::start_of_cataclysm ); } } - m->place_items( "lab_dorm", 84, point( x1, y1 ), point( x2, y2 ), false, + m->place_items( "lab_dorm", 84, p1, p2, false, calendar::start_of_cataclysm ); break; case room_split: if( rotate % 2 == 0 ) { - int w1 = static_cast( ( x1 + x2 ) / 2 ) - 2; - int w2 = static_cast( ( x1 + x2 ) / 2 ) + 2; - for( int y = y1; y <= y2; y++ ) { + int w1 = static_cast( ( p1.x + p2.x ) / 2 ) - 2; + int w2 = static_cast( ( p1.x + p2.x ) / 2 ) + 2; + for( int y = p1.y; y <= p2.y; y++ ) { m->ter_set( point( w1, y ), t_concrete_wall ); m->ter_set( point( w2, y ), t_concrete_wall ); } - m->ter_set( point( w1, static_cast( ( y1 + y2 ) / 2 ) ), t_door_glass_frosted_c ); - m->ter_set( point( w2, static_cast( ( y1 + y2 ) / 2 ) ), t_door_glass_frosted_c ); - science_room( m, x1, y1, w1 - 1, y2, z, 1 ); - science_room( m, w2 + 1, y1, x2, y2, z, 3 ); + m->ter_set( point( w1, static_cast( ( p1.y + p2.y ) / 2 ) ), t_door_glass_frosted_c ); + m->ter_set( point( w2, static_cast( ( p1.y + p2.y ) / 2 ) ), t_door_glass_frosted_c ); + science_room( m, p1, point( w1 - 1, p2.y ), z, 1 ); + science_room( m, point( w2 + 1, p1.y ), p2, z, 3 ); } else { - int w1 = static_cast( ( y1 + y2 ) / 2 ) - 2; - int w2 = static_cast( ( y1 + y2 ) / 2 ) + 2; - for( int x = x1; x <= x2; x++ ) { + int w1 = static_cast( ( p1.y + p2.y ) / 2 ) - 2; + int w2 = static_cast( ( p1.y + p2.y ) / 2 ) + 2; + for( int x = p1.x; x <= p2.x; x++ ) { m->ter_set( point( x, w1 ), t_concrete_wall ); m->ter_set( point( x, w2 ), t_concrete_wall ); } - m->ter_set( point( ( x1 + x2 ) / 2, w1 ), t_door_glass_frosted_c ); - m->ter_set( point( ( x1 + x2 ) / 2, w2 ), t_door_glass_frosted_c ); - science_room( m, x1, y1, x2, w1 - 1, z, 2 ); - science_room( m, x1, w2 + 1, x2, y2, z, 0 ); + m->ter_set( point( ( p1.x + p2.x ) / 2, w1 ), t_door_glass_frosted_c ); + m->ter_set( point( ( p1.x + p2.x ) / 2, w2 ), t_door_glass_frosted_c ); + science_room( m, p1, point( p2.x, w1 - 1 ), z, 2 ); + science_room( m, point( p1.x, w2 + 1 ), p2, z, 0 ); } break; default: @@ -6730,141 +6740,21 @@ void science_room( map *m, int x1, int y1, int x2, int y2, int z, int rotate ) } } -void set_science_room( map *m, int x1, int y1, bool faces_right, const time_point &when ) -{ - // TODO: More types! - int type = rng( 0, 4 ); - int x2 = x1 + 7; - int y2 = y1 + 4; - switch( type ) { - case 0: - // Empty! - return; - case 1: - // Chemistry. - // #######. - // #....... - // #....... - // #....... - // #######. - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - if( ( i == x1 || j == y1 || j == y2 ) && i != x1 ) { - m->set( point( i, j ), t_floor, f_counter ); - } - } - } - m->place_items( "chem_lab", 85, point( x1 + 1, y1 ), point( x2 - 1, y1 ), false, - calendar::start_of_cataclysm ); - m->place_items( "chem_lab", 85, point( x1 + 1, y2 ), point( x2 - 1, y2 ), false, - calendar::start_of_cataclysm ); - m->place_items( "chem_lab", 85, point( x1, y1 + 1 ), point( x1, y2 - 1 ), false, - calendar::start_of_cataclysm ); - break; - - case 2: - // Hydroponics. - // #....... - // #.~~~~~. - // #....... - // #.~~~~~. - // #....... - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - if( i == x1 ) { - m->set( point( i, j ), t_floor, f_counter ); - } else if( i > x1 + 1 && i < x2 && ( j == y1 + 1 || j == y2 - 1 ) ) { - m->ter_set( point( i, j ), t_water_sh ); - } - } - } - m->place_items( "chem_lab", 80, point( x1, y1 ), point( x1, y2 ), false, when - 50_turns ); - m->place_items( "hydro", 92, point( x1 + 1, y1 + 1 ), point( x2 - 1, y1 + 1 ), false, when ); - m->place_items( "hydro", 92, point( x1 + 1, y2 - 1 ), point( x2 - 1, y2 - 1 ), false, when ); - break; - - case 3: - // Electronics. - // #######. - // #....... - // #....... - // #....... - // #######. - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - if( ( i == x1 || j == y1 || j == y2 ) && i != x1 ) { - m->set( point( i, j ), t_floor, f_counter ); - } - } - } - m->place_items( "electronics", 85, point( x1 + 1, y1 ), point( x2 - 1, y1 ), false, - when - 50_turns ); - m->place_items( "electronics", 85, point( x1 + 1, y2 ), point( x2 - 1, y2 ), false, - when - 50_turns ); - m->place_items( "electronics", 85, point( x1, y1 + 1 ), point( x1, y2 - 1 ), false, - when - 50_turns ); - break; - - case 4: - // Monster research. - // .|.####. - // -|...... - // .|...... - // -|...... - // .|.####. - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - if( i == x1 + 1 ) { - m->ter_set( point( i, j ), t_wall_glass ); - } else if( i == x1 && ( j == y1 + 1 || j == y2 - 1 ) ) { - m->ter_set( point( i, j ), t_wall_glass ); - } else if( ( j == y1 || j == y2 ) && i >= x1 + 3 && i <= x2 - 1 ) { - m->set( point( i, j ), t_floor, f_counter ); - } - } - } - // TODO: Place a monster in the sealed areas. - m->place_items( "monparts", 70, point( x1 + 3, y1 ), point( 2 - 1, y1 ), false, when - 100_turns ); - m->place_items( "monparts", 70, point( x1 + 3, y2 ), point( 2 - 1, y2 ), false, when - 100_turns ); - break; - } - - if( !faces_right ) { // Flip it. - ter_id rotated[SEEX * 2][SEEY * 2]; - std::vector itrot[SEEX * 2][SEEY * 2]; - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - rotated[i][j] = m->ter( point( i, j ) ); - auto items = m->i_at( point( i, j ) ); - itrot[i][j].reserve( items.size() ); - std::copy( items.begin(), items.end(), std::back_inserter( itrot[i][j] ) ); - m->i_clear( point( i, j ) ); - } - } - for( int i = x1; i <= x2; i++ ) { - for( int j = y1; j <= y2; j++ ) { - m->ter_set( point( i, j ), rotated[x2 - ( i - x1 )][j] ); - m->spawn_items( point( i, j ), itrot[x2 - ( i - x1 )][j] ); - } - } - } -} - -void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata &dat ) +void build_mine_room( room_type type, const point &p1, const point &p2, mapgendata &dat ) { map *const m = &dat.m; std::vector possibilities; - int midx = static_cast( ( x1 + x2 ) / 2 ), midy = static_cast( ( y1 + y2 ) / 2 ); - if( x2 < SEEX ) { + int midx = static_cast( ( p1.x + p2.x ) / 2 ), midy = static_cast( ( p1.y + p2.y ) / 2 ); + if( p2.x < SEEX ) { possibilities.push_back( direction::EAST ); } - if( x1 > SEEX + 1 ) { + if( p1.x > SEEX + 1 ) { possibilities.push_back( direction::WEST ); } - if( y1 > SEEY + 1 ) { + if( p1.y > SEEY + 1 ) { possibilities.push_back( direction::NORTH ); } - if( y2 < SEEY ) { + if( p2.y < SEEY ) { possibilities.push_back( direction::SOUTH ); } @@ -6886,36 +6776,36 @@ void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata switch( door_side ) { case direction::NORTH: door_point.x = midx; - door_point.y = y1; + door_point.y = p1.y; break; case direction::EAST: - door_point.x = x2; + door_point.x = p2.x; door_point.y = midy; break; case direction::SOUTH: door_point.x = midx; - door_point.y = y2; + door_point.y = p2.y; break; case direction::WEST: - door_point.x = x1; + door_point.x = p1.x; door_point.y = midy; break; default: break; } - square( m, t_floor, point( x1, y1 ), point( x2, y2 ) ); - line( m, t_wall, point( x1, y1 ), point( x2, y1 ) ); - line( m, t_wall, point( x1, y2 ), point( x2, y2 ) ); - line( m, t_wall, point( x1, y1 + 1 ), point( x1, y2 - 1 ) ); - line( m, t_wall, point( x2, y1 + 1 ), point( x2, y2 - 1 ) ); + square( m, t_floor, p1, p2 ); + line( m, t_wall, p1, point( p2.x, p1.y ) ); + line( m, t_wall, point( p1.x, p2.y ), p2 ); + line( m, t_wall, p1 + point_south, point( p1.x, p2.y - 1 ) ); + line( m, t_wall, point( p2.x, p1.y + 1 ), p2 + point_north ); // Main build switch! switch( type ) { case room_mine_shaft: { - m->ter_set( point( x1 + 1, y1 + 1 ), t_console ); - line( m, t_wall, point( x2 - 2, y1 + 2 ), point( x2 - 1, y1 + 2 ) ); - m->ter_set( point( x2 - 2, y1 + 1 ), t_elevator ); - m->ter_set( point( x2 - 1, y1 + 1 ), t_elevator_control_off ); - computer *tmpcomp = m->add_computer( tripoint( x1 + 1, y1 + 1, m->get_abs_sub().z ), + m->ter_set( p1 + point_south_east, t_console ); + line( m, t_wall, point( p2.x - 2, p1.y + 2 ), point( p2.x - 1, p1.y + 2 ) ); + m->ter_set( point( p2.x - 2, p1.y + 1 ), t_elevator ); + m->ter_set( point( p2.x - 1, p1.y + 1 ), t_elevator_control_off ); + computer *tmpcomp = m->add_computer( p1 + tripoint( 1, 1, m->get_abs_sub().z ), _( "NEPowerOS" ), 2 ); tmpcomp->add_option( _( "Divert power to elevator" ), COMPACT_ELEVATOR_ON, 0 ); tmpcomp->add_failure( COMPFAIL_ALARM ); @@ -6923,30 +6813,30 @@ void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata break; case room_mine_office: - line_furn( m, f_counter, point( midx, y1 + 2 ), point( midx, y2 - 2 ) ); - line( m, t_window, point( midx - 1, y1 ), point( midx + 1, y1 ) ); - line( m, t_window, point( midx - 1, y2 ), point( midx + 1, y2 ) ); - line( m, t_window, point( x1, midy - 1 ), point( x1, midy + 1 ) ); - line( m, t_window, point( x2, midy - 1 ), point( x2, midy + 1 ) ); - m->place_items( "office", 80, point( x1 + 1, y1 + 1 ), point( x2 - 1, y2 - 1 ), false, + line_furn( m, f_counter, point( midx, p1.y + 2 ), point( midx, p2.y - 2 ) ); + line( m, t_window, point( midx - 1, p1.y ), point( midx + 1, p1.y ) ); + line( m, t_window, point( midx - 1, p2.y ), point( midx + 1, p2.y ) ); + line( m, t_window, point( p1.x, midy - 1 ), point( p1.x, midy + 1 ) ); + line( m, t_window, point( p2.x, midy - 1 ), point( p2.x, midy + 1 ) ); + m->place_items( "office", 80, p1 + point_south_east, p2 + point_north_west, false, calendar::start_of_cataclysm ); break; case room_mine_storage: - m->place_items( "mine_storage", 85, point( x1 + 2, y1 + 2 ), point( x2 - 2, y2 - 2 ), false, + m->place_items( "mine_storage", 85, p1 + point( 2, 2 ), p2 + point( -2, -2 ), false, calendar::start_of_cataclysm ); break; case room_mine_fuel: { int spacing = rng( 2, 4 ); if( door_side == direction::NORTH || door_side == direction::SOUTH ) { - int y = ( door_side == direction::NORTH ? y1 + 2 : y2 - 2 ); - for( int x = x1 + 1; x <= x2 - 1; x += spacing ) { + int y = ( door_side == direction::NORTH ? p1.y + 2 : p2.y - 2 ); + for( int x = p1.x + 1; x <= p2.x - 1; x += spacing ) { m->place_gas_pump( point( x, y ), rng( 10000, 50000 ) ); } } else { - int x = ( door_side == direction::EAST ? x2 - 2 : x1 + 2 ); - for( int y = y1 + 1; y <= y2 - 1; y += spacing ) { + int x = ( door_side == direction::EAST ? p2.x - 2 : p1.x + 2 ); + for( int y = p1.y + 1; y <= p2.y - 1; y += spacing ) { m->place_gas_pump( point( x, y ), rng( 10000, 50000 ) ); } } @@ -6955,53 +6845,53 @@ void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata case room_mine_housing: if( door_side == direction::NORTH || door_side == direction::SOUTH ) { - for( int y = y1 + 2; y <= y2 - 2; y += 2 ) { - m->ter_set( point( x1, y ), t_window ); - m->furn_set( point( x1 + 1, y ), f_bed ); - m->place_items( "bed", 60, point( x1 + 1, y ), point( x1 + 1, y ), false, + for( int y = p1.y + 2; y <= p2.y - 2; y += 2 ) { + m->ter_set( point( p1.x, y ), t_window ); + m->furn_set( point( p1.x + 1, y ), f_bed ); + m->place_items( "bed", 60, point( p1.x + 1, y ), point( p1.x + 1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x1 + 2, y ), f_bed ); - m->place_items( "bed", 60, point( x1 + 2, y ), point( x1 + 2, y ), false, + m->furn_set( point( p1.x + 2, y ), f_bed ); + m->place_items( "bed", 60, point( p1.x + 2, y ), point( p1.x + 2, y ), false, calendar::start_of_cataclysm ); - m->ter_set( point( x2, y ), t_window ); - m->furn_set( point( x2 - 1, y ), f_bed ); - m->place_items( "bed", 60, point( x2 - 1, y ), point( x2 - 1, y ), false, + m->ter_set( point( p2.x, y ), t_window ); + m->furn_set( point( p2.x - 1, y ), f_bed ); + m->place_items( "bed", 60, point( p2.x - 1, y ), point( p2.x - 1, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x2 - 2, y ), f_bed ); - m->place_items( "bed", 60, point( x2 - 2, y ), point( x2 - 2, y ), false, + m->furn_set( point( p2.x - 2, y ), f_bed ); + m->place_items( "bed", 60, point( p2.x - 2, y ), point( p2.x - 2, y ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x1 + 1, y + 1 ), f_dresser ); - m->place_items( "dresser", 78, point( x1 + 1, y + 1 ), point( x1 + 1, y + 1 ), false, + m->furn_set( point( p1.x + 1, y + 1 ), f_dresser ); + m->place_items( "dresser", 78, point( p1.x + 1, y + 1 ), point( p1.x + 1, y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x2 - 1, y + 1 ), f_dresser ); - m->place_items( "dresser", 78, point( x2 - 1, y + 1 ), point( x2 - 1, y + 1 ), false, + m->furn_set( point( p2.x - 1, y + 1 ), f_dresser ); + m->place_items( "dresser", 78, point( p2.x - 1, y + 1 ), point( p2.x - 1, y + 1 ), false, calendar::start_of_cataclysm ); } } else { - for( int x = x1 + 2; x <= x2 - 2; x += 2 ) { - m->ter_set( point( x, y1 ), t_window ); - m->furn_set( point( x, y1 + 1 ), f_bed ); - m->place_items( "bed", 60, point( x, y1 + 1 ), point( x, y1 + 1 ), false, + for( int x = p1.x + 2; x <= p2.x - 2; x += 2 ) { + m->ter_set( point( x, p1.y ), t_window ); + m->furn_set( point( x, p1.y + 1 ), f_bed ); + m->place_items( "bed", 60, point( x, p1.y + 1 ), point( x, p1.y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, y1 + 2 ), f_bed ); - m->place_items( "bed", 60, point( x, y1 + 2 ), point( x, y1 + 2 ), false, + m->furn_set( point( x, p1.y + 2 ), f_bed ); + m->place_items( "bed", 60, point( x, p1.y + 2 ), point( x, p1.y + 2 ), false, calendar::start_of_cataclysm ); - m->ter_set( point( x, y2 ), t_window ); - m->furn_set( point( x, y2 - 1 ), f_bed ); - m->place_items( "bed", 60, point( x, y2 - 1 ), point( x, y2 - 1 ), false, + m->ter_set( point( x, p2.y ), t_window ); + m->furn_set( point( x, p2.y - 1 ), f_bed ); + m->place_items( "bed", 60, point( x, p2.y - 1 ), point( x, p2.y - 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x, y2 - 2 ), f_bed ); - m->place_items( "bed", 60, point( x, y2 - 2 ), point( x, y2 - 2 ), false, + m->furn_set( point( x, p2.y - 2 ), f_bed ); + m->place_items( "bed", 60, point( x, p2.y - 2 ), point( x, p2.y - 2 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x + 1, y1 + 1 ), f_dresser ); - m->place_items( "dresser", 78, point( x + 1, y1 + 1 ), point( x + 1, y1 + 1 ), false, + m->furn_set( point( x + 1, p1.y + 1 ), f_dresser ); + m->place_items( "dresser", 78, point( x + 1, p1.y + 1 ), point( x + 1, p1.y + 1 ), false, calendar::start_of_cataclysm ); - m->furn_set( point( x + 1, y2 - 1 ), f_dresser ); - m->place_items( "dresser", 78, point( x + 1, y2 - 1 ), point( x + 1, y2 - 1 ), false, + m->furn_set( point( x + 1, p2.y - 1 ), f_dresser ); + m->place_items( "dresser", 78, point( x + 1, p2.y - 1 ), point( x + 1, p2.y - 1 ), false, calendar::start_of_cataclysm ); } } - m->place_items( "bedroom", 65, point( x1 + 1, y1 + 1 ), point( x2 - 1, y2 - 1 ), false, + m->place_items( "bedroom", 65, p1 + point_south_east, p2 + point_north_west, false, calendar::start_of_cataclysm ); break; default: @@ -7012,16 +6902,16 @@ void build_mine_room( room_type type, int x1, int y1, int x2, int y2, mapgendata if( type == room_mine_fuel ) { // Fuel stations are open on one side switch( door_side ) { case direction::NORTH: - line( m, t_floor, point( x1, y1 ), point( x2, y1 ) ); + line( m, t_floor, p1, point( p2.x, p1.y ) ); break; case direction::EAST: - line( m, t_floor, point( x2, y1 + 1 ), point( x2, y2 - 1 ) ); + line( m, t_floor, point( p2.x, p1.y + 1 ), p2 + point_north ); break; case direction::SOUTH: - line( m, t_floor, point( x1, y2 ), point( x2, y2 ) ); + line( m, t_floor, point( p1.x, p2.y ), p2 ); break; case direction::WEST: - line( m, t_floor, point( x1, y1 + 1 ), point( x1, y2 - 1 ) ); + line( m, t_floor, p1 + point_south, point( p1.x, p2.y - 1 ) ); break; default: break; diff --git a/src/mapgen.h b/src/mapgen.h index 6f21a34486f6a..4bf70a5ba397f 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -158,8 +158,7 @@ class jmapgen_piece virtual void apply( mapgendata &dat, const jmapgen_int &x, const jmapgen_int &y ) const = 0; virtual ~jmapgen_piece() = default; jmapgen_int repeat; - virtual bool has_vehicle_collision( mapgendata &/*dat*/, int /*offset_x*/, - int /*offset_y*/ ) const { + virtual bool has_vehicle_collision( mapgendata &/*dat*/, const point &/*offset*/ ) const { return false; } }; diff --git a/src/mapgen_functions.cpp b/src/mapgen_functions.cpp index b46ddb62d4c50..c35b2a144e897 100644 --- a/src/mapgen_functions.cpp +++ b/src/mapgen_functions.cpp @@ -1044,7 +1044,7 @@ void mapgen_subway( mapgendata &dat ) switch( num_dirs ) { case 4: // 4-way intersection - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "..^/D^^/D^....^D/^^D/^..\n" ".^/DX^/DX......XD/^XD/^.\n" "^/D^X/D^X......X^D/X^D/^\n" @@ -1086,7 +1086,7 @@ void mapgen_subway( mapgendata &dat ) break; case 3: // tee - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "..^/D^^/D^...^/D^^/D^...\n" ".^/D^^/D^...^/D^^/D^....\n" "^/D^^/D^...^/D^^/D^.....\n" @@ -1133,7 +1133,7 @@ void mapgen_subway( mapgendata &dat ) case 2: // straight or diagonal if( diag ) { // diagonal subway get drawn differently from all other types - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "...^DD^^DD^...^DD^^DD^..\n" "....^DD^^DD^...^DD^^DD^.\n" ".....^DD^^DD^...^DD^^DD^\n" @@ -1169,7 +1169,7 @@ void mapgen_subway( mapgendata &dat ) f_null, f_null ) ); } else { // normal subway drawing - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "...^X^^^X^....^X^^^X^...\n" "...-x---x-....-x---x-...\n" "...^X^^^X^....^X^^^X^...\n" @@ -1212,7 +1212,7 @@ void mapgen_subway( mapgendata &dat ) break; case 1: // dead end - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "...^X^^^X^..../D^^/D^...\n" "...-x---x-.../DX^/DX^...\n" "...^X^^^X^../D^X/D^X^...\n" @@ -1534,7 +1534,7 @@ void mapgen_railroad( mapgendata &dat ) switch( num_dirs ) { case 4: // 4-way intersection - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, ".DD^^DD^........^DD^^DD.\n" "DD^^DD^..........^DD^^DD\n" "D^^DD^............^DD^^D\n" @@ -1570,7 +1570,7 @@ void mapgen_railroad( mapgendata &dat ) break; case 3: // tee - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, ".DD^^DD^........^DD^^DD.\n" "DD^^DD^..........^DD^^DD\n" "D^^DD^............^DD^^D\n" @@ -1616,7 +1616,7 @@ void mapgen_railroad( mapgendata &dat ) // straight or diagonal if( diag ) { // diagonal railroads get drawn differently from all other types - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, ".^DD^^DD^.......^DD^^DD^\n" "..^DD^^DD^.......^DD^^DD\n" "...^DD^^DD^.......^DD^^D\n" @@ -1650,7 +1650,7 @@ void mapgen_railroad( mapgendata &dat ) f_null, f_null ) ); } else { // normal railroads drawing - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, ".^X^^^X^........^X^^^X^.\n" ".-x---x-........-x---x-.\n" ".^X^^^X^........^X^^^X^.\n" @@ -1691,7 +1691,7 @@ void mapgen_railroad( mapgendata &dat ) break; case 1: // dead end - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, ".^X^^^X^........^X^^^X^.\n" ".-x---x-........-x---x-.\n" ".^X^^^X^........^X^^^X^.\n" @@ -1739,7 +1739,7 @@ void mapgen_railroad( mapgendata &dat ) void mapgen_railroad_bridge( mapgendata &dat ) { map *const m = &dat.m; - mapf::formatted_set_simple( m, 0, 0, + mapf::formatted_set_simple( m, point_zero, "r^X^^^X^________^X^^^X^r\n" "r-x---x-________-x---x-r\n" "r^X^^^X^________^X^^^X^r\n" diff --git a/src/mapgenformat.cpp b/src/mapgenformat.cpp index cad7165d88960..2c7526af18456 100644 --- a/src/mapgenformat.cpp +++ b/src/mapgenformat.cpp @@ -11,16 +11,16 @@ namespace mapf { -void formatted_set_simple( map *m, const int startx, const int starty, const char *cstr, +void formatted_set_simple( map *m, const point &start, const char *cstr, const format_effect &ter_b, const format_effect &furn_b ) { const char *p = cstr; - int x = startx; - int y = starty; + int x = start.x; + int y = start.y; while( *p != 0 ) { if( *p == '\n' ) { y++; - x = startx; + x = start.x; } else { const ter_id ter = ter_b.translate( *p ); const furn_id furn = furn_b.translate( *p ); diff --git a/src/mapgenformat.h b/src/mapgenformat.h index ebdf3cc34e554..b2e7ad3c85eec 100644 --- a/src/mapgenformat.h +++ b/src/mapgenformat.h @@ -11,6 +11,7 @@ #include "type_id.h" class map; +struct point; namespace mapf { @@ -26,9 +27,9 @@ class format_effect; * one tile on the map. It will be looked up in \p ter_b and \p furn_b to get the terrain/ * furniture to place there (if that lookup returns a null id, nothing is set on the map). * A newline character continues on the next line (resets `x` to \p startx and increments `y`). - * @param startx,starty Coordinates in the map where to start drawing \p cstr. + * @param start Coordinates in the map where to start drawing \p cstr. */ -void formatted_set_simple( map *m, int startx, int starty, const char *cstr, +void formatted_set_simple( map *m, const point &start, const char *cstr, const format_effect &ter_b, const format_effect &furn_b ); template diff --git a/src/npc.cpp b/src/npc.cpp index 87cfee1178328..f49840f2a61ae 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -2347,19 +2347,17 @@ std::string npc::opinion_text() const return ret; } -static void maybe_shift( cata::optional &pos, int dx, int dy ) +static void maybe_shift( cata::optional &pos, const point &d ) { if( pos ) { - pos->x += dx; - pos->y += dy; + *pos += d; } } -static void maybe_shift( tripoint &pos, int dx, int dy ) +static void maybe_shift( tripoint &pos, const point &d ) { if( pos != tripoint_min ) { - pos.x += dx; - pos.y += dy; + pos += d; } } @@ -2369,9 +2367,9 @@ void npc::shift( const point &s ) setpos( pos() - shift ); - maybe_shift( wanted_item_pos, -shift.x, -shift.y ); - maybe_shift( last_player_seen_pos, -shift.x, -shift.y ); - maybe_shift( pulp_location, -shift.x, -shift.y ); + maybe_shift( wanted_item_pos, point( -shift.x, -shift.y ) ); + maybe_shift( last_player_seen_pos, point( -shift.x, -shift.y ) ); + maybe_shift( pulp_location, point( -shift.x, -shift.y ) ); path.clear(); } diff --git a/src/pathfinding.cpp b/src/pathfinding.cpp index b43a763d07ef2..ff61ce6270318 100644 --- a/src/pathfinding.cpp +++ b/src/pathfinding.cpp @@ -57,8 +57,8 @@ struct path_data_layer { struct pathfinder { point min; point max; - pathfinder( int _minx, int _miny, int _maxx, int _maxy ) : - min( _minx, _miny ), max( _maxx, _maxy ) { + pathfinder( const point &_min, const point &_max ) : + min( _min ), max( _max ) { } std::priority_queue< std::pair, std::vector< std::pair >, pair_greater_cmp_first > @@ -238,7 +238,7 @@ std::vector map::route( const tripoint &f, const tripoint &t, clip_to_bounds( minx, miny, minz ); clip_to_bounds( maxx, maxy, maxz ); - pathfinder pf( minx, miny, maxx, maxy ); + pathfinder pf( point( minx, miny ), point( maxx, maxy ) ); // Make NPCs not want to path through player // But don't make player pathing stop working for( const auto &p : pre_closed ) { diff --git a/src/scent_block.h b/src/scent_block.h index 09ee1d662f49e..f416dd8a6db03 100644 --- a/src/scent_block.h +++ b/src/scent_block.h @@ -5,6 +5,7 @@ #include #include +#include "coordinate_conversions.h" #include "point.h" #include "scent_map.h" @@ -28,8 +29,11 @@ struct scent_block { scent_map &scents; int modification_count; - scent_block( int subx, int suby, int subz, scent_map &scents ) - : origin( subx * SEEX - 1, suby * SEEY - 1, subz ), scents( scents ), modification_count( 0 ) { + scent_block( const tripoint &sub, scent_map &scents ) + // NOLINTNEXTLINE(cata-use-named-point-constants) + : origin( sm_to_ms_copy( sub ) + point( -1, -1 ) ) + , scents( scents ) + , modification_count( 0 ) { for( int x = 0; x < SEEX + 2; ++x ) { for( int y = 0; y < SEEY + 2; ++y ) { assignment[x][y] = { NONE, 0 }; diff --git a/src/sdl_wrappers.cpp b/src/sdl_wrappers.cpp index e34d76594b78d..71e0d98754f83 100644 --- a/src/sdl_wrappers.cpp +++ b/src/sdl_wrappers.cpp @@ -8,6 +8,7 @@ #include #include "debug.h" +#include "point.h" #if defined(TILES) # if defined(_MSC_VER) && defined(USE_VCPKG) @@ -90,6 +91,7 @@ void SetRenderDrawColor( const SDL_Renderer_Ptr &renderer, const Uint8 r, const "SDL_SetRenderDrawColor failed" ); } +void RenderDrawPoint( const SDL_Renderer_Ptr &renderer, const point &p ); void RenderDrawPoint( const SDL_Renderer_Ptr &renderer, int x, int y ) { printErrorIf( SDL_RenderDrawPoint( renderer.get(), x, y ) != 0, "SDL_RenderDrawPoint failed" ); diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index 10d3942450bd8..f7c6383f43952 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -114,9 +114,9 @@ class Font * Draw character t at (x,y) on the screen, * using (curses) color. */ - virtual void OutputChar( const std::string &ch, int x, int y, + virtual void OutputChar( const std::string &ch, const point &, unsigned char color, float opacity = 1.0f ) = 0; - virtual void draw_ascii_lines( unsigned char line_id, int drawx, int drawy, int FG ) const; + virtual void draw_ascii_lines( unsigned char line_id, const point &draw, int FG ) const; bool draw_window( const catacurses::window &w ); bool draw_window( const catacurses::window &w, int offsetx, int offsety ); @@ -139,7 +139,7 @@ class CachedTTFFont : public Font ~CachedTTFFont() override = default; bool isGlyphProvided( const std::string &ch ) const override; - void OutputChar( const std::string &ch, int x, int y, + void OutputChar( const std::string &ch, const point &, unsigned char color, float opacity = 1.0f ) override; protected: SDL_Texture_Ptr create_glyph( const std::string &ch, int color ); @@ -178,11 +178,11 @@ class BitmapFont : public Font ~BitmapFont() override = default; bool isGlyphProvided( const std::string &ch ) const override; - void OutputChar( const std::string &ch, int x, int y, + void OutputChar( const std::string &ch, const point &, unsigned char color, float opacity = 1.0f ) override; - void OutputChar( int t, int x, int y, + void OutputChar( int t, const point &, unsigned char color, float opacity = 1.0f ); - void draw_ascii_lines( unsigned char line_id, int drawx, int drawy, int FG ) const override; + void draw_ascii_lines( unsigned char line_id, const point &draw, int FG ) const override; protected: std::array::COLOR_NAMES_COUNT> ascii; int tilewidth; @@ -196,7 +196,7 @@ class FontFallbackList : public Font ~FontFallbackList() override = default; bool isGlyphProvided( const std::string &ch ) const override; - void OutputChar( const std::string &ch, int x, int y, + void OutputChar( const std::string &ch, const point &, unsigned char color, float opacity = 1.0f ) override; protected: std::vector> fonts; @@ -599,38 +599,38 @@ inline void FillRectDIB( const SDL_Rect &rect, const unsigned char color, } //The following 3 methods use mem functions for fast drawing -inline void VertLineDIB( int x, int y, int y2, int thickness, unsigned char color ) +inline void VertLineDIB( const point &p, int y2, int thickness, unsigned char color ) { SDL_Rect rect; - rect.x = x; - rect.y = y; + rect.x = p.x; + rect.y = p.y; rect.w = thickness; - rect.h = y2 - y; + rect.h = y2 - p.y; FillRectDIB( rect, color ); } -inline void HorzLineDIB( int x, int y, int x2, int thickness, unsigned char color ) +inline void HorzLineDIB( const point &p, int x2, int thickness, unsigned char color ) { SDL_Rect rect; - rect.x = x; - rect.y = y; - rect.w = x2 - x; + rect.x = p.x; + rect.y = p.y; + rect.w = x2 - p.x; rect.h = thickness; FillRectDIB( rect, color ); } -inline void FillRectDIB( int x, int y, int width, int height, unsigned char color ) +inline void FillRectDIB( const point &p, int width, int height, unsigned char color ) { SDL_Rect rect; - rect.x = x; - rect.y = y; + rect.x = p.x; + rect.y = p.y; rect.w = width; rect.h = height; FillRectDIB( rect, color ); } -inline void fill_rect_xywh_color( const int x, const int y, const int width, const int height, +inline void fill_rect_xywh_color( const point &p, int width, int height, const SDL_Color &color ) { - const SDL_Rect rect = { x, y, width, height }; + const SDL_Rect rect = { p.x, p.y, width, height }; FillRectDIB_SDLColor( rect, color ); } @@ -690,7 +690,7 @@ bool CachedTTFFont::isGlyphProvided( const std::string &ch ) const return TTF_GlyphIsProvided( font.get(), UTF8_getch( ch ) ); } -void CachedTTFFont::OutputChar( const std::string &ch, const int x, const int y, +void CachedTTFFont::OutputChar( const std::string &ch, const point &p, const unsigned char color, const float opacity ) { key_t key {ch, static_cast( color & 0xf )}; @@ -709,7 +709,7 @@ void CachedTTFFont::OutputChar( const std::string &ch, const int x, const int y, // Nothing we can do here )-: return; } - SDL_Rect rect {x, y, value.width, fontheight}; + SDL_Rect rect {p.x, p.y, value.width, fontheight}; if( opacity != 1.0f ) { SDL_SetTextureAlphaMod( value.texture.get(), opacity * 255.0f ); } @@ -740,14 +740,14 @@ bool BitmapFont::isGlyphProvided( const std::string &ch ) const } } -void BitmapFont::OutputChar( const std::string &ch, const int x, const int y, +void BitmapFont::OutputChar( const std::string &ch, const point &p, const unsigned char color, const float opacity ) { const int t = UTF8_getch( ch ); - BitmapFont::OutputChar( t, x, y, color, opacity ); + BitmapFont::OutputChar( t, p, color, opacity ); } -void BitmapFont::OutputChar( const int t, const int x, const int y, +void BitmapFont::OutputChar( const int t, const point &p, const unsigned char color, const float opacity ) { if( t <= 256 ) { @@ -757,8 +757,8 @@ void BitmapFont::OutputChar( const int t, const int x, const int y, src.w = fontwidth; src.h = fontheight; SDL_Rect rect; - rect.x = x; - rect.y = y; + rect.x = p.x; + rect.y = p.y; rect.w = fontwidth; rect.h = fontheight; if( opacity != 1.0f ) { @@ -807,7 +807,7 @@ void BitmapFont::OutputChar( const int t, const int x, const int y, default: return; } - draw_ascii_lines( uc, x, y, color ); + draw_ascii_lines( uc, p, color ); } } @@ -933,61 +933,73 @@ void set_displaybuffer_rendertarget() // line_id is one of the LINE_*_C constants // FG is a curses color -void Font::draw_ascii_lines( unsigned char line_id, int drawx, int drawy, int FG ) const +void Font::draw_ascii_lines( unsigned char line_id, const point &draw, int FG ) const { switch( line_id ) { // box bottom/top side (horizontal line) case LINE_OXOX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + fontwidth, 1, FG ); break; // box left/right side (vertical line) case LINE_XOXO_C: - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + fontheight, 2, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + fontheight, 2, FG ); break; // box top left case LINE_OXXO_C: - HorzLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawy + fontheight, 2, FG ); + HorzLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.x + fontwidth, + 1, + FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.y + fontheight, + 2, + FG ); break; // box top right case LINE_OOXX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + ( fontwidth / 2 ), 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawy + fontheight, 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + ( fontwidth / 2 ), 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.y + fontheight, + 2, + FG ); break; // box bottom right case LINE_XOOX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + ( fontwidth / 2 ), 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + ( fontheight / 2 ) + 1, 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + ( fontwidth / 2 ), 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + ( fontheight / 2 ) + 1, 2, FG ); break; // box bottom left case LINE_XXOO_C: - HorzLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + ( fontheight / 2 ) + 1, 2, FG ); + HorzLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.x + fontwidth, + 1, + FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + ( fontheight / 2 ) + 1, 2, FG ); break; // box bottom north T (left, right, up) case LINE_XXOX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + ( fontheight / 2 ), 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + fontwidth, 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + ( fontheight / 2 ), 2, FG ); break; // box bottom east T (up, right, down) case LINE_XXXO_C: - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + fontheight, 2, FG ); - HorzLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + fontheight, 2, FG ); + HorzLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.x + fontwidth, + 1, + FG ); break; // box bottom south T (left, right, down) case LINE_OXXX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy + ( fontheight / 2 ), drawy + fontheight, 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + fontwidth, 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), ( fontheight / 2 ) ), draw.y + fontheight, + 2, + FG ); break; // box X (left down up right) case LINE_XXXX_C: - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + fontwidth, 1, FG ); - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + fontheight, 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + fontwidth, 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + fontheight, 2, FG ); break; // box bottom east T (left, down, up) case LINE_XOXX_C: - VertLineDIB( drawx + ( fontwidth / 2 ), drawy, drawy + fontheight, 2, FG ); - HorzLineDIB( drawx, drawy + ( fontheight / 2 ), drawx + ( fontwidth / 2 ), 1, FG ); + VertLineDIB( draw + point( ( fontwidth / 2 ), 0 ), draw.y + fontheight, 2, FG ); + HorzLineDIB( draw + point( 0, ( fontheight / 2 ) ), draw.x + ( fontwidth / 2 ), 1, FG ); break; default: break; @@ -1086,7 +1098,7 @@ void cata_cursesport::handle_additional_window_clear( WINDOW *win ) void clear_window_area( const catacurses::window &win_ ) { cata_cursesport::WINDOW *const win = win_.get(); - FillRectDIB( win->pos.x * fontwidth, win->pos.y * fontheight, + FillRectDIB( point( win->pos.x * fontwidth, win->pos.y * fontheight ), win->width * fontwidth, win->height * fontheight, catacurses::black ); } @@ -1121,7 +1133,7 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w ) GetRenderDrawBlendMode( renderer, blend_mode ); // save the current blend mode SetRenderDrawBlendMode( renderer, color_blocks.first ); // set the new blend mode for( const auto &e : color_blocks.second ) { - fill_rect_xywh_color( e.first.x, e.first.y, tilecontext->get_tile_width(), + fill_rect_xywh_color( e.first, tilecontext->get_tile_width(), tilecontext->get_tile_height(), e.second ); } SetRenderDrawBlendMode( renderer, blend_mode ); // set the old blend mode @@ -1173,7 +1185,7 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w ) // TODO: draw with outline / BG color for better readability const uint32_t ch = text.at( i ); - map_font->OutputChar( utf32_to_utf8( ch ), x, y, ft.color ); + map_font->OutputChar( utf32_to_utf8( ch ), point( x, y ), ft.color ); width += mk_wcwidth( ch ); } @@ -1197,14 +1209,14 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w ) map_font->fontheight, 0 ); //Gap between terrain and lower window edge if( partial_height > 0 ) { - FillRectDIB( win->pos.x * map_font->fontwidth, - ( win->pos.y + TERRAIN_WINDOW_HEIGHT ) * map_font->fontheight, + FillRectDIB( point( win->pos.x * map_font->fontwidth, + ( win->pos.y + TERRAIN_WINDOW_HEIGHT ) * map_font->fontheight ), TERRAIN_WINDOW_WIDTH * map_font->fontwidth + partial_width, partial_height, catacurses::black ); } //Gap between terrain and sidebar if( partial_width > 0 ) { - FillRectDIB( ( win->pos.x + TERRAIN_WINDOW_WIDTH ) * map_font->fontwidth, - win->pos.y * map_font->fontheight, + FillRectDIB( point( ( win->pos.x + TERRAIN_WINDOW_WIDTH ) * map_font->fontwidth, + win->pos.y * map_font->fontheight ), partial_width, TERRAIN_WINDOW_HEIGHT * map_font->fontheight + partial_height, catacurses::black ); @@ -1228,7 +1240,7 @@ void cata_cursesport::curses_drawwindow( const catacurses::window &w ) int offsety = win->pos.y * font->fontheight; int wwidth = win->width * font->fontwidth; int wheight = win->height * font->fontheight; - FillRectDIB( offsetx, offsety, wwidth, wheight, catacurses::black ); + FillRectDIB( point( offsetx, offsety ), wwidth, wheight, catacurses::black ); update = true; } else if( g && w == g->w_pixel_minimap && g->pixel_minimap_option ) { // ensure the space the minimap covers is "dirtied". @@ -1365,7 +1377,7 @@ bool Font::draw_window( const catacurses::window &w, const int offsetx, const in // Spaces are used a lot, so this does help noticeably if( cell.ch == space_string ) { - FillRectDIB( drawx, drawy, fontwidth, fontheight, cell.BG ); + FillRectDIB( point( drawx, drawy ), fontwidth, fontheight, cell.BG ); continue; } const int codepoint = UTF8_getch( cell.ch ); @@ -1419,11 +1431,11 @@ bool Font::draw_window( const catacurses::window &w, const int offsetx, const in use_draw_ascii_lines_routine = false; break; } - FillRectDIB( drawx, drawy, fontwidth * cw, fontheight, BG ); + FillRectDIB( point( drawx, drawy ), fontwidth * cw, fontheight, BG ); if( use_draw_ascii_lines_routine ) { - draw_ascii_lines( uc, drawx, drawy, FG ); + draw_ascii_lines( uc, point( drawx, drawy ), FG ); } else { - OutputChar( cell.ch, drawx, drawy, FG ); + OutputChar( cell.ch, point( drawx, drawy ), FG ); } } } @@ -2293,13 +2305,13 @@ void draw_quick_shortcuts() text_scale; } text_y = ( WindowHeight - ( height + font->fontheight * text_scale ) * 0.5f ) / text_scale; - font->OutputChar( text, text_x + 1, text_y + 1, 0, + font->OutputChar( text, point( text_x + 1, text_y + 1 ), 0, get_option( "ANDROID_SHORTCUT_OPACITY_SHADOW" ) * 0.01f ); - font->OutputChar( text, text_x, text_y, get_option( "ANDROID_SHORTCUT_COLOR" ), + font->OutputChar( text, point( text_x, text_y ), get_option( "ANDROID_SHORTCUT_COLOR" ), get_option( "ANDROID_SHORTCUT_OPACITY_FG" ) * 0.01f ); if( hovered ) { // draw a second button hovering above the first one - font->OutputChar( text, text_x, text_y - ( height * 1.2f / text_scale ), + font->OutputChar( text, point( text_x, text_y - ( height * 1.2f / text_scale ) ), get_option( "ANDROID_SHORTCUT_COLOR" ) ); if( show_hint ) { // draw hint text @@ -3860,53 +3872,53 @@ BitmapFont::BitmapFont( const int w, const int h, const std::string &typeface_pa } } -void BitmapFont::draw_ascii_lines( unsigned char line_id, int drawx, int drawy, int FG ) const +void BitmapFont::draw_ascii_lines( unsigned char line_id, const point &draw, int FG ) const { BitmapFont *t = const_cast( this ); switch( line_id ) { // box bottom/top side (horizontal line) case LINE_OXOX_C: - t->OutputChar( 0xcd, drawx, drawy, FG ); + t->OutputChar( 0xcd, draw, FG ); break; // box left/right side (vertical line) case LINE_XOXO_C: - t->OutputChar( 0xba, drawx, drawy, FG ); + t->OutputChar( 0xba, draw, FG ); break; // box top left case LINE_OXXO_C: - t->OutputChar( 0xc9, drawx, drawy, FG ); + t->OutputChar( 0xc9, draw, FG ); break; // box top right case LINE_OOXX_C: - t->OutputChar( 0xbb, drawx, drawy, FG ); + t->OutputChar( 0xbb, draw, FG ); break; // box bottom right case LINE_XOOX_C: - t->OutputChar( 0xbc, drawx, drawy, FG ); + t->OutputChar( 0xbc, draw, FG ); break; // box bottom left case LINE_XXOO_C: - t->OutputChar( 0xc8, drawx, drawy, FG ); + t->OutputChar( 0xc8, draw, FG ); break; // box bottom north T (left, right, up) case LINE_XXOX_C: - t->OutputChar( 0xca, drawx, drawy, FG ); + t->OutputChar( 0xca, draw, FG ); break; // box bottom east T (up, right, down) case LINE_XXXO_C: - t->OutputChar( 0xcc, drawx, drawy, FG ); + t->OutputChar( 0xcc, draw, FG ); break; // box bottom south T (left, right, down) case LINE_OXXX_C: - t->OutputChar( 0xcb, drawx, drawy, FG ); + t->OutputChar( 0xcb, draw, FG ); break; // box X (left down up right) case LINE_XXXX_C: - t->OutputChar( 0xce, drawx, drawy, FG ); + t->OutputChar( 0xce, draw, FG ); break; // box bottom east T (left, down, up) case LINE_XOXX_C: - t->OutputChar( 0xb9, drawx, drawy, FG ); + t->OutputChar( 0xb9, draw, FG ); break; default: break; @@ -3979,7 +3991,7 @@ bool FontFallbackList::isGlyphProvided( const std::string & ) const return true; } -void FontFallbackList::OutputChar( const std::string &ch, const int x, const int y, +void FontFallbackList::OutputChar( const std::string &ch, const point &p, const unsigned char color, const float opacity ) { auto cached = glyph_font.find( ch ); @@ -3990,7 +4002,7 @@ void FontFallbackList::OutputChar( const std::string &ch, const int x, const int } } } - ( *cached->second )->OutputChar( ch, x, y, color, opacity ); + ( *cached->second )->OutputChar( ch, p, color, opacity ); } static int map_font_width()