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

Remove globals from fov_diamond and fov_restrictive algorithms #48

Merged
merged 2 commits into from Apr 4, 2020

Conversation

taiyu-len
Copy link
Contributor

For issue #47.
makes diamond raycasting fov, and restrictive fov algorithms reentrant.

for diamond fov, adds a fov_t struct to store all relevant state; the globals, and pointer to the map.
also simplified 2 for loops (the expandPerimiter, and set fov loops).

for restrictive fov, adds 2 double* parameters to the compute_quadrant function, instead of reusing the globals.
also made the compute_quadrant a static function as its not exposed in the headers or used elsewhere.

- place globals and map* into a fov_t object, and modify local functions
  to use it.
- clean up 2 for loops to make them simpler.
- pass in angle arrays as parameters, instead of reusing global.
- make compute_quadrant a static function as its only used locally
- simplify fov clearing loop.
@HexDecimal HexDecimal self-requested a review April 4, 2020 01:33
@HexDecimal HexDecimal merged commit 3fd3fd1 into libtcod:develop Apr 4, 2020
@HexDecimal
Copy link
Collaborator

This looks good. Thanks for the extra refactoring and for making this pull request!

@taiyu-len taiyu-len deleted the reentrant_fov branch April 4, 2020 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants