Merge lp:~widelands-dev/widelands/bug-1603763 into lp:widelands

Proposed by TiborB
Status: Merged
Merged at revision: 8034
Proposed branch: lp:~widelands-dev/widelands/bug-1603763
Merge into: lp:widelands
Diff against target: 12 lines (+1/-1)
1 file modified
src/logic/map.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1603763
Reviewer Review Type Date Requested Status
SirVer Approve
kaputtnik (community) testing Approve
Review via email: mp+300278@code.launchpad.net

Description of the change

I think this can be investigated bit more deeply, but this fix is good as well, and safe....

The bottom line is that recalc_default_resources now make sure that calculated resource is not INVALID_RESOURCE - then it calls clear_resources() instead of setting this value as a resource. Only kNoResource is allowed in such situation.

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

For investigation the second attached scenario contains a map where a crash happen with current trunk when the debug window is used on position 0/0.

This branch is fine.

review: Approve (testing)
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1190. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/145398847.
Appveyor build 1029. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1603763-1029.

Revision history for this message
SirVer (sirver) wrote :

I agree this is an improvement. One nit though: I think INVALID_INDEX == -1, but I cannot check. If that is the case, the first condition in the OR can be removed.

Otherwise lgtm.

review: Approve
Revision history for this message
bunnybot (widelandsofficial) wrote :

Bunnybot encountered an error while working on this merge proposal:

<urlopen error timed out>

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 1190. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/145398847.
Appveyor build 1029. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1603763-1029.

Revision history for this message
TiborB (tiborb95) wrote :

I see appveyor failed, "Memory exhausted"??

@SirVer:
INVALID_INDEX == 255 and kNoResource == 254

Revision history for this message
SirVer (sirver) wrote :

thanks for the explanation. I guess appveyor went out of memory when trying to link - nothing can be done about this. Travis is happy. Let's get this in.

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map.cc'
2--- src/logic/map.cc 2016-05-07 18:54:04 +0000
3+++ src/logic/map.cc 2016-07-17 19:45:29 +0000
4@@ -249,7 +249,7 @@
5 }
6 amount /= 6;
7
8- if (res == -1 || !amount) {
9+ if (res == -1 || res == INVALID_INDEX || res == Widelands::kNoResource || !amount) {
10 clear_resources(f);
11 } else {
12 initialize_resources(f, res, amount);

Subscribers

People subscribed via source and target branches

to status/vote changes: