New revision. We check whether the program is "work" or end with "work". This 
would work with the marble mines as well. Now if a program shall not calculate 
stats, only append _work at the end.

Here is the aforementioned marble-mine:

      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _"working",
         actions = {
            "call=mine_granite",
            "call=mine_marble",
            "return=skipped"
         }

This would become:

      work = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _"working",
         actions = {
            "call=mine_marble_work",
            "call=mine_granite_work",
         }

Still the others need to be changed. But it is unified. Being "work" or ending 
with "_work" would result in no stats be calculated for this program.


>Furthermore I really doubt that the desired effect is worth the pain of 
>changing all programs of all productionsite buildings.

It's worth it, IMHO. The use of unconditional "return=skipped" also "overloads" 
the skipped_programs stack. Usually when a program completes successfully it 
gets removed from the skipped_programs stack, but with the unconditional ones 
it never will.

Take the the marble-mine for example:

work, mine_granite and mine_marble have a return=skipped. So each marble mine 
adds 3 programs to the stack the will never be removed.

Every single crystal-mine will add 4 programs to the stack that will not 
removed. And the list goes on for all others that use this method of avoiding 
stats being calculated. So in a singleplayer with just one tribe. You would end 
up with some hundred programs cloaking the stack for no good reason. 

Also it makes the use of conditional return=skipped useless. Here of the 
crystal-mine:

         descname = _"mining diamonds",
         actions = {
            "return=skipped unless economy needs diamond",
            "sleep=40000",
            "consume=smoked_fish,smoked_meat:2 atlanteans_bread:2",
            "call=a_mine_produce_diamond",
            "call=a_mine_produce_granite",
            "call=a_mine_produce_diamond",
            "return=skipped"
         }

The only thing it does is not calling the sub-programs. But the way it is 
intended to work is: Skip the program, because we don't need the ware. Next 
time we need the ware the program gets executed and returns a completed. This 
then removes it from the stack. But since it ends with "return=skipped" it 
always stays in the stack.

I know that it might be some tedious labor, but productions-sites that already 
have sub-programs just need the return=skipped removed and a _work appended to 
the sub_program if stats are not needed. The others need the sub-program added, 
but I would willingly do this. 

Now that I spend some time looking into this, I'm 100% sure, unconditional 
skips are the wrong way. Since they do more harm (+10s; and the increasing 
stack) and skips were never intended for this usage.

-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1786613-10s-return-skipped/+merge/353449
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/mines-worldsavior.

_______________________________________________
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

Reply via email to