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

Fixed bug where ScriptTrigger areas wouldn't save their name #1622

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

Semphriss
Copy link
Member

Note: Adding the key name to the ObjectSettings on line 75 of src/trigger/scripttrigger.cpp (old version) wasn't enough, I had to refactor the code a bit (made it cleaner too)

Note: Adding the key name to the ObjectSettings on line 75 of src/trigger/scripttrigger.cpp (old version) wasn't enough, I had to refactor the code a bit (made it cleaner too)
if (reader.get("height", height))
m_col.m_bbox.set_height(height);

reader.get("x", m_col.m_bbox.get_left());
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused about this. the get_left() and get_top() methods are marked const. However, they're passed by reference to the reader.get() method which might attempt to save a value, which should fail. Can you please test this?

Copy link
Member Author

Choose a reason for hiding this comment

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

@tobbi There is another place in the code that uses the exact same trick, the author called it a "temporary hack" (which I (or anyone) should fix someday). Two overloads for that function, of which one is a non-const reference.
image

Copy link
Member

Choose a reason for hiding this comment

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

Very interesting. OKay, I'm gonna merge this.

@tobbi tobbi merged commit 72bfcae into SuperTux:master Dec 28, 2020
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