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

Simplify generic multiple activity handler #34102

Merged
merged 2 commits into from
Oct 18, 2019

Conversation

ipcyborg
Copy link
Contributor

@ipcyborg ipcyborg commented Sep 19, 2019

Summary

SUMMARY: Infrastructure "Simplify generic multiple activity handler"

Purpose of change

Function generic_multi_activity_handler is quite big and hard to understand.
It is required to simplify it but keep the structure intact as much as possible.
This PR is created as a result of closing PR #33864.

Describe the solution

Simplify generic multiple activity by splitting to chunks and creating specific sub-functions:

  • generic_multi_activity_locations: determine all locations for this generic activity
  • generic_multi_activity_check_requirement: check if this activity can not be done immediately because it has some requirements
  • generic_multi_activity_do: do activity at this location

The main handler and sub-functions should be easier to maintain now.

Some other minor changes:

  • Const reference in function parameters and loops.
  • Less use of auto when appropriate.

Describe alternatives you've considered

Use stages as described in PR #33864 (this approach was rejected after a discussion).

Additional context

None

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Sep 20, 2019
Const reference in function parameters.
Less use of `auto` when appropriate.
@ipcyborg ipcyborg force-pushed the generic-activity-check branch from 01e9a2a to 2db0bfd Compare October 17, 2019 13:28
@ghost
Copy link

ghost commented Oct 18, 2019

Ill test this in a bit, the code changes look good, the structural changes I'll have to test.

@ghost
Copy link

ghost commented Oct 18, 2019

Yeah it works fine.

@ghost ghost assigned ghost and unassigned ghost Oct 18, 2019
@ghost ghost self-requested a review October 18, 2019 11:06
@ZhilkinSerg ZhilkinSerg merged commit e31b762 into CleverRaven:master Oct 18, 2019
@ipcyborg ipcyborg deleted the generic-activity-check branch October 18, 2019 12:08
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants