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

Refactor closest_(tri)points_first functions #37108

Conversation

ZhilkinSerg
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

Refactor closest_(tri)points_first functions

Describe the solution

  • moved functions into point file;
  • rearranged function parameters ( radius, center -> center, radius );
  • removed duplicate code;
  • get rid of some auto and one time use variables;

Testing

Purely technical refactor. There are should be no effect on gameplay. Just make sure game and tests compile and run.

- moved into `point` file;

- rearranged function parameters;

- removed duplicate code;

- get rid of some `auto` and one time use variables;
@ZhilkinSerg ZhilkinSerg added Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Jan 16, 2020
src/point.h Outdated
* Following functions return points in a spiral pattern starting at center_x/center_y until it hits the radius. Clockwise fashion.
* Credit to Tom J Nowell; http://stackoverflow.com/a/1555236/1269969
*/
std::vector<tripoint> closest_tripoints_first( const tripoint &center, size_t radius );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be inside the #ifndef CATA_NO_STL region to avoid the clang-tidy errors you're seeing (because the clang-tidy test files include this file but don't get to use the STL, so e.g. no std::vector).

@kevingranade kevingranade merged commit fbaae72 into CleverRaven:master Jan 17, 2020
@ZhilkinSerg ZhilkinSerg deleted the refactor-point-functions-2020-01-16 branch January 17, 2020 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants