← Back to team overview

widelands-dev team mailing list archive

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

 

TiborB has proposed merging lp:~widelands-dev/widelands/bug-1525395 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1525395 in widelands: "atlantean mines failing to extract all resources"
  https://bugs.launchpad.net/widelands/+bug/1525395

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1525395/+merge/282377

This fixes the corner case when digged_percentage=100 but there were still inmined resources.
I redesigned the formula so that the rounding is done in other direction - if there are some resources left the percent can not be 100.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1525395 into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc	2016-01-08 21:00:39 +0000
+++ src/logic/map_objects/tribes/production_program.cc	2016-01-12 21:32:53 +0000
@@ -1280,7 +1280,7 @@
 	//  how much is digged
 	int32_t digged_percentage = 100;
 	if (totalstart)
-		digged_percentage = 100 - totalres * 100 / totalstart;
+		digged_percentage = (totalstart - totalres) * 100 / totalstart;
 	if (!totalres)
 		digged_percentage = 100;
 


Follow ups