← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1818073-worker into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1818073-worker into lp:widelands.

Commit message:
Reinstate mining behavior from r8823.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1818073 in widelands: "changes to worker.cc erroneously reverted"
  https://bugs.launchpad.net/widelands/+bug/1818073

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1818073-worker/+merge/363851
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1818073-worker into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/worker.cc	2019-03-01 12:23:04 +0000
@@ -138,15 +138,15 @@
 		totalchance += 8 * amount;
 
 		// Add penalty for fields that are running out
-		if (amount == 0)
-			// we already know it's completely empty, so punish is less
-			totalchance += 1;
-		else if (amount <= 2)
+		// Except for totally depleted fields or wrong ressource fields
+		// if we already know there is no ressource (left) we won't mine there
+		if (amount != 0 && amount <= 2) {
 			totalchance += 6;
-		else if (amount <= 4)
+		} else if (amount <= 4) {
 			totalchance += 4;
-		else if (amount <= 6)
+		} else if (amount <= 6) {
 			totalchance += 2;
+		}
 	} while (mr.advance(*map));
 
 	if (totalres == 0) {


Follow ups