-
Notifications
You must be signed in to change notification settings - Fork 37
Add warning for triggers using Building Exists incorrectly #303
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Rami Pasanen <[email protected]>
| if (map.Structures.Exists(structure => | ||
| structure.ObjectType.Index == buildingIndex && | ||
| structure.Owner == house)) | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the contribution guideline (Contributing.md):
Braceless code block bodies should be made only when both code block head and body are single line.
There are two ways to fix this. This is my preferred way (we don't live in the 90s with 800x600 resolution anymore, there's no problem having lines be a bit longer):
| if (map.Structures.Exists(structure => | |
| structure.ObjectType.Index == buildingIndex && | |
| structure.Owner == house)) | |
| continue; | |
| if (map.Structures.Exists(structure => structure.ObjectType.Index == buildingIndex && structure.Owner == house)) | |
| continue; |
This is the alternative:
| if (map.Structures.Exists(structure => | |
| structure.ObjectType.Index == buildingIndex && | |
| structure.Owner == house)) | |
| continue; | |
| if (map.Structures.Exists(structure => | |
| structure.ObjectType.Index == buildingIndex && | |
| structure.Owner == house)) | |
| { | |
| continue; | |
| } |
| { | ||
| issueList.Add(string.Format(Translate(map, "CheckForIssues.BuildingExists.InvalidBuildingType", | ||
| "No building type index {0} exists as was specified in trigger '{1}'"), | ||
| buildingIndex, trigger.Name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indentation.
| buildingIndex, trigger.Name)); | |
| buildingIndex, trigger.Name)); |
| })) | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the contribution guideline (Contributing.md):
Braceless code block bodies should be made only when both code block head and body are single line.
| })) | |
| continue; | |
| })) | |
| { | |
| continue; | |
| } |
Adds a new warning when saving maps that should help mappers in case they use the Building Exists event incorrectly. Only applies to SP maps.
When saving the map, if the map is likely to be a SP map, checks all triggers and sees if they have the Building Exists event. Any trigger that have this event is checked for the following:
Added English translations keys.