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

Function args hide global variable r_dlightframecount #1093

Closed
BraXi opened this issue Mar 23, 2024 · 3 comments
Closed

Function args hide global variable r_dlightframecount #1093

BraXi opened this issue Mar 23, 2024 · 3 comments
Labels

Comments

@BraXi
Copy link
Contributor

BraXi commented Mar 23, 2024

Some functions hide global variable r_dlightframecount by using argument with the same name

void GL3_MarkSurfaceLights(dlight_t *light, int bit, mnode_t *node, int r_dlightframecount)
void R_MarkSurfaceLights(dlight_t *light, int bit, mnode_t *node, int r_dlightframecount)
void R_MarkLights (dlight_t *light, int bit, mnode_t *node, int r_dlightframecount, marksurfacelights_t mark_surface_lights);
@0lvin
Copy link
Contributor

0lvin commented Mar 23, 2024

Yes, it's bad code style. Shared code does not use global variables and receive all such values as parameter.Better to rename parameter name to something else, are you prefer to create pull request to yquake repository, or I will create pull request with fix and mark you as author of fix?

I will create fix for remaster in any case.

@BraXi
Copy link
Contributor Author

BraXi commented Mar 23, 2024

The change is trival and since you offer to PR yourself its okay

0lvin pushed a commit to 0lvin/yquake2 that referenced this issue Mar 23, 2024
Renders has global variable with such name that used as parameters
for R_MarkLights shared function.

Fixes:
 * yquake2/yquake2remaster#17
 * yquake2#1093
0lvin pushed a commit to yquake2/yquake2remaster that referenced this issue Mar 23, 2024
Renders has global variable with such name that used as parameters
for R_MarkLights shared function.

Fixes:
 * #17
 * yquake2/yquake2#1093
@Yamagi Yamagi added the bug label Apr 6, 2024
@Yamagi
Copy link
Member

Yamagi commented Apr 6, 2024

Fixed by merging #1094.

@Yamagi Yamagi closed this as completed Apr 6, 2024
Yamagi pushed a commit that referenced this issue Apr 7, 2024
Renders has global variable with such name that used as parameters
for R_MarkLights shared function.

Fixes:
 * yquake2/yquake2remaster#17
 * #1093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants