-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Enhance point api refactoring #33082
Enhance point api refactoring #33082
Conversation
The cata-use-point-apis check tries to convert calls to overloads to which a point can be pased instead of separate coordinates. This wasn't working when the call was to a function template specialization. Make that work.
The cata-use-point-apis check wasn't refactoring calls to functions whose arguments were 'const int'. Fix that.
src/animation.cpp
Outdated
@@ -704,7 +704,7 @@ namespace | |||
{ | |||
void draw_sct_curses( game &g ) | |||
{ | |||
const tripoint off = relative_view_pos( g.u, 0, 0, 0 ); | |||
const tripoint off = relative_view_pos( g.u, tripoint( 0, 0, 0 ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const tripoint off = relative_view_pos( g.u, tripoint( 0, 0, 0 ) ); | |
const tripoint off = relative_view_pos( g.u, tripoint_zero ); |
tests/map_test.cpp
Outdated
@@ -37,7 +37,7 @@ TEST_CASE( "map_bounds_checking" ) | |||
// inelegant solution. | |||
clear_map(); | |||
map m; | |||
m.load( 0, 0, 0, false ); | |||
m.load( tripoint( 0, 0, 0 ), false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m.load( tripoint( 0, 0, 0 ), false ); | |
m.load( tripoint_zero, false ); |
tests/map_test.cpp
Outdated
@@ -62,7 +62,7 @@ TEST_CASE( "tinymap_bounds_checking" ) | |||
// inelegant solution. | |||
clear_map(); | |||
tinymap m; | |||
m.load( 0, 0, 0, false ); | |||
m.load( tripoint( 0, 0, 0 ), false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m.load( tripoint( 0, 0, 0 ), false ); | |
m.load( tripoint_zero, false ); |
tests/test_main.cpp
Outdated
@@ -155,7 +155,7 @@ static void init_global_game_state( const std::vector<mod_id> &mods, | |||
overmap_special_batch empty_specials( { 0, 0 } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overmap_special_batch empty_specials( { 0, 0 } ); | |
overmap_special_batch empty_specials( point_zero ); |
I'm planning to automate those changes to put |
* Support porting calls to function templates The cata-use-point-apis check tries to convert calls to overloads to which a point can be pased instead of separate coordinates. This wasn't working when the call was to a function template specialization. Make that work. * Test variadic function template also * Handle const-qualified int arguments The cata-use-point-apis check wasn't refactoring calls to functions whose arguments were 'const int'. Fix that. * Apply refactoring pass using new features * Follow-on tidying up of refactored code * Add some point_zero, tripoint_zero
* Support porting calls to function templates The cata-use-point-apis check tries to convert calls to overloads to which a point can be pased instead of separate coordinates. This wasn't working when the call was to a function template specialization. Make that work. * Test variadic function template also * Handle const-qualified int arguments The cata-use-point-apis check wasn't refactoring calls to functions whose arguments were 'const int'. Fix that. * Apply refactoring pass using new features * Follow-on tidying up of refactored code * Add some point_zero, tripoint_zero
Summary
SUMMARY: None
Purpose of change
The
cata-use-point-apis
check I added in #32963 turned out to have some limitations.const int
rather thanint
.Describe the solution
Fix both those limitations.
Re-run the refactoring pass across the codebase again, capturing these new cases.
Additional context
Working gradually towards #32017.