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

fix: elevators for aftershock reactors and hospitals #3167

Merged
merged 3 commits into from
Sep 17, 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
2 changes: 1 addition & 1 deletion data/json/mapgen/hospital.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
";": "t_door_locked",
"x": "t_wall_glass",
"4": "t_sidewalk",
"5": "t_elevator_control_off"
"5": "t_elevator_control"
},
"place_vehicles": [ { "vehicle": "helicopters", "x": 10, "y": 56, "chance": 80, "rotation": 270 } ]
}
Expand Down
16 changes: 8 additions & 8 deletions data/mods/Aftershock/maps/mapgen/municipal_microreactor.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
"#########-% -##########",
"#########-% -##########",
"######-----55-----------",
"######-**%% ****2**2 ",
"######-** M 2 2 ",
"######- M ---- ",
"######-*** ** ****-``- ",
"######-*** ** ****-``- ",
"######-**%% ****2***2 ",
"######-** M 2 2 ",
"######- M ----- ",
"######-*** ** ****-```- ",
"######-*** ** ****-```- ",
"######------------------",
"########################"
],
Expand Down Expand Up @@ -224,9 +224,9 @@
"####- ^ 6-G55--l b l-#",
"####--2----- 2 l-#",
"####- -(22(-------#",
"####- d YYY 2eE-##",
"####- hd 2ee-##",
"####------------------##",
"####- d YYY 2eeE-#",
"####- hd 2eee-#",
"####-------------------#",
"########################"
],
"set": [
Expand Down
9 changes: 3 additions & 6 deletions src/iexamine_elevator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ auto choose_floor( const tripoint &examp, const tripoint_abs_omt &this_omt,
choice.title = _( "Please select destination floor" );
for( int z = OVERMAP_HEIGHT; z >= -OVERMAP_DEPTH; z-- ) {
const tripoint_abs_omt that_omt{ this_omt.xy(), z };
const int delta = get_rot_delta( this_omt, that_omt );
const int turns = get_rot_turns( this_omt, that_omt );
const tripoint zp =
rotate_point_sm( { examp.xy(), z }, sm_orig, delta );
rotate_point_sm( { examp.xy(), z }, sm_orig, turns );

if( here.ter( zp )->examine != &iexamine::elevator ) {
continue;
Expand Down Expand Up @@ -201,9 +201,6 @@ auto move_vehicles( const elevator_vehicles &vehs, const tripoint &sm_orig, int

} // namespace

/**
* If underground, move 2 levels up else move 2 levels down. Stable movement between levels 0 and -2.
*/
void iexamine::elevator( player &p, const tripoint &examp )
{
map &here = get_map();
Expand All @@ -223,7 +220,7 @@ void iexamine::elevator( player &p, const tripoint &examp )
}

const tripoint_abs_omt that_omt{ this_omt.xy(), movez };
const int turns = get_rot_delta( this_omt, that_omt );
const int turns = get_rot_turns( this_omt, that_omt );

const auto elevator_dest = elevator::dest( elevator_here, sm_orig, turns, movez );
const auto vehicles_dest = elevator::vehicles_on( elevator_dest );
Expand Down
3 changes: 2 additions & 1 deletion src/point_rotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
case 1:
return { dim.y - p.y - 1, p.x };
case 2:
return { dim.x - p.x - 1, dim.y - p.y - 1 };

Check warning on line 12 in src/point_rotate.cpp

View workflow job for this annotation

GitHub Actions / build

Construction of 'point' can be simplified using overloaded arithmetic operators. [cata-use-point-arithmetic]
case 3:
return { p.y, dim.x - p.x - 1 };
default:
Expand All @@ -30,7 +30,8 @@
return tripoint{ rd + orig.xy() };
}

auto get_rot_delta( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int
/** @return The difference in rotation between two overmap terrain points. */
auto get_rot_turns( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int
{
const auto this_dir = overmap_buffer.ter( there )->get_dir();
const auto that_dir = overmap_buffer.ter( here )->get_dir();
Expand Down
2 changes: 1 addition & 1 deletion src/point_rotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ auto rotate( const tripoint &p, point dim, int turns ) -> tripoint;
/** works like rotate but for submaps. */
auto rotate_point_sm( const tripoint &p, const tripoint &orig, int turns ) -> tripoint;

auto get_rot_delta( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int;
auto get_rot_turns( const tripoint_abs_omt &here, const tripoint_abs_omt &there ) -> int;

#endif // CATA_SRC_POINT_ROTATE_H
Loading