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

Change: Use selected group as parent when creating a new group. #7224

Merged
merged 1 commit into from Feb 15, 2019

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Feb 13, 2019

No description provided.

Copy link
Contributor

@nielsmh nielsmh left a comment

Choose a reason for hiding this comment

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

Looks like it works as intended. The livery copying looks a bit strange to me (I'd expect it to inherit rather than copy) but I trust PeterN to extend his own code in the most appropriate way.

@J0anJosep
Copy link
Contributor

Great idea. I also expected to inherit liveries instead of copying them.

@PeterN
Copy link
Member Author

PeterN commented Feb 14, 2019

Inheritance is set by the in_use flag, in the case of inheritance colour1/colour2 are set to the parent. This is because when using 2cc mode, the two colours can actually inherit from different parent groups independently, but GetEngineLivery returns a Livery struct, not two colours.

When changing a parent livery, PropagateChildLivery() applies that change to all the group's children recursively.

Turns out there's some left over code in GetEngineLivery that traverses parents when it's not actually necessary. Oops.

@PeterN PeterN added the wip Work in progress. Feature branch that will require feedback during the development process label Feb 15, 2019
@PeterN
Copy link
Member Author

PeterN commented Feb 15, 2019

Okay, I think it should check the group ID exists and return an error if not, instead of silently creating a top-level group. Going to fix it :-)

EDIT: Other functions also do it this way, so for consistency I'll leave this as is and then change them all together, possibly.

@PeterN PeterN merged commit 3a4b6b4 into OpenTTD:master Feb 15, 2019
@PeterN PeterN deleted the new-group-parent branch February 15, 2019 18:47
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Feb 15, 2019
J0anJosep added a commit to J0anJosep/OpenTTD that referenced this pull request Feb 18, 2019
J0anJosep added a commit to J0anJosep/OpenTTD that referenced this pull request Feb 18, 2019
nielsmh pushed a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
nielsmh pushed a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
stormcone added a commit to stormcone/OpenTTD that referenced this pull request May 10, 2019
… correctly.

When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
stormcone added a commit to stormcone/OpenTTD that referenced this pull request May 10, 2019
…correctly.

When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
nielsmh pushed a commit that referenced this pull request May 10, 2019
When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
michicc pushed a commit to michicc/OpenTTD that referenced this pull request Jun 30, 2019
…correctly.

When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
michicc pushed a commit that referenced this pull request Jul 7, 2019
When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
douiwby pushed a commit to douiwby/OpenTTD that referenced this pull request Apr 16, 2020
douiwby pushed a commit to douiwby/OpenTTD that referenced this pull request Apr 16, 2020
douiwby pushed a commit to douiwby/OpenTTD that referenced this pull request Apr 16, 2020
…correctly.

When drag and drop a vehicle into an empty slot in the vehicle group window it tries to create the new group as the subgroup of the first group (GroupID = 0). This is failing if the dragged vehicle's type is different than the first group's vehicle type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip Work in progress. Feature branch that will require feedback during the development process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants