Code review comment for lp:~widelands-dev/widelands/bug-1818073-worker

Revision history for this message
Toni Förster (stonerl) wrote :

We want it to be 0 right? I just reverted to how it was in r8823.

Yours did set it to 4 as hessenfarmer said, 4 ways to fix it:

(1)

if (amount != 0 && amount <= 2) {
    totalchance += 6;
} else if (amount != 0 && amount <= 4) {
    totalchance += 4;
} else if (amount != 0 && amount <= 6) {
    totalchance += 2;
}

(2)

if (amount == 0) {
    totalchance = totalchance;
} else if (amount <= 2) {
    totalchance += 6;
} else if (amount != 0 && amount <= 4) {
    totalchance += 4;
} else if (amount != 0 && amount <= 6) {
    totalchance += 2;
}

(3)
if (amount == 0) {
    totalchance = 0;
} else if (amount <= 2) {
    totalchance += 6;
} else if (amount != 0 && amount <= 4) {
    totalchance += 4;
} else if (amount != 0 && amount <= 6) {
    totalchance += 2;
}

(4)

if (amount == 0) {
    // don't do nothing
} else if (amount <= 2) {
    totalchance += 6;
} else if (amount != 0 && amount <= 4) {
    totalchance += 4;
} else if (amount != 0 && amount <= 6) {
    totalchance += 2;
}

« Back to merge proposal