Mapper: draw room exits that go off the map#4716
Conversation
We previously set them all to be 0.0 when there is no custom lines but technically, since they are supposed to be extremes of the room and it's custom exit lines they should be initialised to the room's own coordinates. Not doing this meant that in some cases they were being used but they did not hold sensible values. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
| qreal _y = point.y(); | ||
| if (_x < min_x) { | ||
| min_x = _x; | ||
| for (auto pointInLine : pointsInLine) { |
There was a problem hiding this comment.
I know the old code did this - but when you use Qt containers their copy-on-write behaviour can trigger accidentally and make a copy list - doesn't hurt the data but hurts performance. Have to wrap the access in a qAsConst(). std:: ones don't suffer from this btw
| for (auto pointInLine : pointsInLine) { | |
| for (auto pointInLine : qAsConst(pointsInLine)) { |
There was a problem hiding this comment.
Um, pointsInLine is a const reference already and it was obtained from a QMap<QString, QList<QPointF>>::value() which is, IIRC a copy of the original data - so Qt's CoW actions cannot be triggered here AFAICT.
There was a problem hiding this comment.
IMVHO If you feel strongly enough about this then we can change this in another PR.
|
Fixed up the title to something testers can understand using the PTBs. Remember to keep them simple |
Retitled from: "BugFix: correctly evaluate room m(in|ax)(x|y) values in all cases" We previously set them all to be 0.0 when there is no custom lines but technically, since they are supposed to be extremes of the room and it's custom exit lines they should be initialised to the room's own coordinates. Not doing this meant that in some cases they were being used but they did not hold sensible values. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
We previously set them all to be 0.0 when there is no custom lines but technically, since they are supposed to be extremes of the room and it's custom exit lines they should be initialised to the room's own coordinates.
Not doing this meant that in some cases they were being used but they did not hold sensible values.
Signed-off-by: Stephen Lyons slysven@virginmedia.com