Review: Approve Got the concept. I think we should have this after you perhaps might fix the small nits from the below diff comments
Diff comments: > === modified file 'src/logic/map_objects/tribes/productionsite.cc' > --- src/logic/map_objects/tribes/productionsite.cc 2019-05-18 11:58:43 > +0000 > +++ src/logic/map_objects/tribes/productionsite.cc 2019-05-19 20:55:45 > +0000 > @@ -1032,4 +1037,17 @@ > > default_anim_ = anim; > } > + > +void ProductionSite::update_crude_statistics(uint32_t duration, const bool > produced) { > + static const uint32_t duration_cap = 90 * 1000; //This is highest > allowed program duration yes I think to cover for weird things 3 minutes might be ok. > + // just for case something went very wrong... > + static const uint32_t entire_duration = 5 * 60 *1000; > + if (duration > duration_cap) { > + duration = duration_cap; > + }; > + const uint32_t old_duration = entire_duration - duration; I would name this past_duration as this is what it is. I first thought this should be the duration of the previous cycle. > + crude_percent_ = (crude_percent_ * old_duration + produced * duration * > 10000) / entire_duration; > + assert(crude_percent_ <= 10000); //be sure we do not go above 100 % > + } > + > } // namespace Widelands -- https://code.launchpad.net/~widelands-dev/widelands/ai_productionsites_statistics/+merge/367613 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_productionsites_statistics. _______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp