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

feat: add import-export functions for regions #9

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

Conversation

chozandrias76
Copy link
Contributor

No description provided.

.gitignore Outdated Show resolved Hide resolved
/.vscode
er-save-editor.exe
fixtures/*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignores test files

.gitignore Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated
@@ -94,6 +97,25 @@ impl App {
}
}

fn save_regions(&mut self, path: PathBuf) {
Copy link
Owner

Choose a reason for hiding this comment

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

Is this using anything in main or can it be moved to the regions vm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the view model specific functionality into that scope. Keeping the rest here as it deals with writing.

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved

if is_invadeable_region {
let region = ID_TO_REGION.lock().unwrap()[key];
regions_vm.regions.get_mut(&region).expect("").0 = true;
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe you can use unwrap() instead of expect("") if no error message is needed.

Aslo maybe split it into two lines to give the .0 a self descriptive name

let (activated, _,_,_) = regions_vm.regions.get_mut(&region).unwrap();
*activated = true;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I should reserve this refactor until later, so we can focus on functionality in this PR.

@chozandrias76
Copy link
Contributor Author

@ClayAmore I discovered a bug in my original implementation where I wasn't correctly using the provided enabled_ids when they are present. I corrected this and DRYed things up here: ab4f562 (#9)

@chozandrias76 chozandrias76 marked this pull request as ready for review April 4, 2024 23:46
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