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

roofs using queue instead of recursion #7945

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

cuberound
Copy link
Contributor

@cuberound cuberound commented Dec 29, 2024

About the pull request

dreammaker had recursion issues with big roofs, this might solve it using using queue

Explain why it's good for the game

allows for big roofs

Testing Photographs and Procedure

Screenshots & Videos

Put screenshots and videos here with an empty line between the screenshots and the <details> tags.

Changelog

🆑
code: improves initialization of masternode for structure/roof
/:cl:

@cmss13-ci cmss13-ci bot added the Code Improvement Make the code longer label Dec 29, 2024
code/game/objects/structures/roof.dm Outdated Show resolved Hide resolved
Comment on lines 164 to 166
var/list/unprocesed_nodes = list()
for(var/obj/effect/roof_node/node in location)
node.link_master(src)
unprocesed_nodes += node
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be better to just figure out all the work that needs to be performed, and have that in a list. Likely better to add using |= so you don't add duplicates; but you may want to test what performs better w/ large use cases: as in is byond faster at checking for duplicates than just enqueueing them anyways and finding out we don't need to work on them when you come across a node already set up.

code/game/objects/structures/roof.dm Outdated Show resolved Hide resolved
code/game/objects/structures/roof.dm Outdated Show resolved Hide resolved
Comment on lines 177 to 178
for(var/obj/structure/roof/roof in location)
roof.link_master(src)
unprocesed_roofs += roof
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be better to just figure out all the work that needs to be performed, and have that in a list. Likely better to add using |= so you don't add duplicates; but you may want to test what performs better w/ large use cases: as in is byond faster at checking for duplicates than just enqueueing them anyways and finding out we don't need to work on them when you come across a node already set up.

Comment on lines 100 to +108
return
master.connected_nodes += src
linked_master = master
var/list/nerby_nodes = list()
for(var/direction in CARDINAL_ALL_DIRS)
for(var/obj/effect/roof_node/node in get_step(src,direction))
node.link_master(master)
if(!node.linked_master)
nerby_nodes += node
return nerby_nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

This proc is likely moot to exist with suggested changes to connect.

code/game/objects/structures/roof.dm Outdated Show resolved Hide resolved
code/game/objects/structures/roof.dm Show resolved Hide resolved
@Drulikar Drulikar marked this pull request as draft December 30, 2024 00:55
@cuberound cuberound marked this pull request as ready for review December 30, 2024 09:31
@Drulikar Drulikar marked this pull request as draft December 31, 2024 03:04
@cmss13-ci
Copy link
Contributor

cmss13-ci bot commented Jan 23, 2025

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@cmss13-ci cmss13-ci bot added the Stale beg a maintainer to review your PR label Jan 23, 2025
@cuberound cuberound marked this pull request as ready for review February 3, 2025 23:35
@cuberound cuberound requested a review from Drulikar February 3, 2025 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Improvement Make the code longer Stale beg a maintainer to review your PR
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

3 participants