Merge lp:~widelands-dev/widelands/bug-1818494-no-negative-zoom into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 9055
Proposed branch: lp:~widelands-dev/widelands/bug-1818494-no-negative-zoom
Merge into: lp:widelands
Diff against target: 18 lines (+4/-2)
1 file modified
src/wui/mapview.cc (+4/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1818494-no-negative-zoom
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+366250@code.launchpad.net

Commit message

Safeguards in draw_terrain to prevent negative zoom.

Description of the change

This is our last remaining known crash, so I'd like this for Build 20. If we can get it in by the weekend, we'll still do the Release Candidate on Monday.

The branch has already been tested and only needs a code review.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4727. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/521578152.
Appveyor build 4512. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1818494_no_negative_zoom-4512.

9039. By GunChleoc

Merged trunk.

9040. By GunChleoc

Merged trunk.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4744. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/522405788.
Appveyor build 4529. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1818494_no_negative_zoom-4529.

Revision history for this message
GunChleoc (gunchleoc) wrote :

This has been tested, so let's have it before it will delay the release.

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/mapview.cc'
2--- src/wui/mapview.cc 2019-03-31 15:37:35 +0000
3+++ src/wui/mapview.cc 2019-04-20 05:46:31 +0000
4@@ -352,10 +352,12 @@
5 }
6
7 // Linearly interpolate between the next and the last.
8- const float t = (now - plan[0].t) / static_cast<float>(plan[1].t - plan[0].t);
9+ // Using std::max as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494
10+ const float t = (std::max(1U, now - plan[0].t)) / static_cast<float>(std::max(1U, plan[1].t - plan[0].t));
11 const View new_view = {
12 mix(t, plan[0].view.viewpoint, plan[1].view.viewpoint),
13- mix(t, plan[0].view.zoom, plan[1].view.zoom),
14+ // Using math::clamp as a workaround for https://bugs.launchpad.net/widelands/+bug/1818494
15+ math::clamp(mix(t, plan[0].view.zoom, plan[1].view.zoom), 1.f / kMaxZoom, kMaxZoom)
16 };
17 set_view(new_view, Transition::Jump);
18 break;

Subscribers

People subscribed via source and target branches

to status/vote changes: