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 some redundant code #171

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Remove some redundant code #171

merged 1 commit into from
Feb 23, 2024

Conversation

Salzkorn
Copy link

What is this fixing or adding?

This removes us manually setting event/locked flags on locations.

For create_location, this was never even called because id is a built-in function and thus never None, and we never change the variable locally.

For setup_final_location, we never check for location event/locked flags in the world, and any location with address is None is caught by __init__.setup_events, which calls Location.place_locked_item, which in turn sets both the event and locked flags, so us manually setting it on any location with address None is redundant.

How was this tested?

A few generations and checking spoiler logs for abnormalities.

@Salzkorn Salzkorn requested a review from Ziktofel as a code owner February 23, 2024 15:51
@@ -606,8 +606,6 @@ def setup_final_location(final_location, location_cache):
# Final location should be near the end of the cache
for i in range(len(location_cache) - 1, -1, -1):
if location_cache[i].name == final_location:
location_cache[i].locked = True
location_cache[i].event = True
Copy link

@MatthewMarinets MatthewMarinets Feb 23, 2024

Choose a reason for hiding this comment

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

I think this is still important, as these are core AP flags that let us put the victory flag somewhere? I'm not totally sure as I'm not too familiar with the core code.

Edit: Sounds like this is flagged elsewhere and core sets these flags for us.

@Ziktofel Ziktofel merged commit 852e22f into Ziktofel:sc2-next Feb 23, 2024
9 checks passed
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.

3 participants