← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/skipped_statistics into lp:widelands


Toni Förster has proposed merging lp:~widelands-dev/widelands/skipped_statistics into lp:widelands with lp:~widelands-dev/widelands/bug-1786613-10s-return-skipped as a prerequisite.

Commit message:
skipping a work program decreases productivity accordingly

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:

I mentioned this in the forum: http://wl.widelands.org/forum/topic/4323/

This branch requires that we use the return=no_stats instead of return=skipped for suppressing the calculation of productivity stats. Which is the prerequisite branch for this one.

The current implementation just stalls the productivity. E.g. 40+ if this was the last updated value. 

This change basically decrease the productivity for a building, and subsequently the global productivity, if the economy doesn't need the wares the building produces.

Furthermore a building that creates more than on ware will only reach 100% productivity if it produces all wares. The barbarian's metal-workshop for instance produces 10 wares in total. It would only reach 100% is it produces all 10. If 5 wares would not be needed anymore the productivity would decrease to 50% and stays there as long as only 5 wares a produced. This would be displayed as "50% =". If the building the would start producing a sixth ware the productivity the would climb up to 60%. And so on..

There are still other parts that needs to be fixed though. Since productivity values that are not divisible by 5 or 10 are not displayed correctly. E.g. the barbarians big inn productivity would jump between 30% and 35% since 33% cant be displayed.
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/skipped_statistics into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/production_program.h'
--- src/logic/map_objects/tribes/production_program.h	2018-08-22 06:58:39 +0000
+++ src/logic/map_objects/tribes/production_program.h	2018-08-22 06:58:40 +0000
@@ -127,9 +127,10 @@
 	/// Parameter semantics:
 	///    return_value:
 	///       If return_value is Failed or Completed, the productionsite's
-	///       statistics is updated accordingly. If return_value is Skipped or
-	///       None, the statistics are not affected. But Skipped adds a 10s delay
-	///       before the program is executed again.
+	///       statistics is updated accordingly. If return_value is None, the
+	///       statistics are not affected. Skipped adds a 10s delay before
+	///       the program is executed again and updates the statistics
+	///       of the productionsite accordingly.
 	///    condition:
 	///       A boolean condition that can be evaluated to true or false.
 	///    condition_part:

=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc	2018-08-22 06:58:39 +0000
+++ src/logic/map_objects/tribes/productionsite.cc	2018-08-22 06:58:40 +0000
@@ -938,6 +938,9 @@
 	case Skipped:
 		skipped_programs_[program_name] = game.get_gametime();
+		statistics_.erase(statistics_.begin(), statistics_.begin() + 1);
+		statistics_.push_back(false);
+		calc_statistics();
 		crude_percent_ = crude_percent_ * 98 / 100;
 	case None:

Follow ups