Sounds more like a priority queue is needed

Also, widelands already has a command queue. How about just making a new 
command for each action you want to perform and use this to be called back? You 
would not need to reinvent the scheduling logic. 

The class is Game::commandqueue or something along the lines. I am on my mobile 
and cannot check right now. 


> Am 03.03.2015 um 04:12 schrieb GunChleoc <[email protected]>:
> 
> Set elements are pairs of <key, value>. Just use the duetime as the key and 
> the job type as the value, and your entries will automatically be sorted by 
> duetime. Pop the next job off the front and insert a new check of the same 
> job type into the set with the new duetime and you will have everything you 
> need.
> 
> What you need to watch out for is when two jobs get sceduled at the same 
> time, because they would have the same key. To avoid this, you can use the 
> set's count() function to check and increment the duetime if needed.
> -- 
> https://code.launchpad.net/~widelands-dev/widelands/ai-scheduler/+merge/251327
> You are subscribed to branch lp:widelands.

-- 
https://code.launchpad.net/~widelands-dev/widelands/ai-scheduler/+merge/251327
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/ai-scheduler into lp:widelands.

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to