Code review comment for lp:~widelands-dev/widelands/ai-scheduler

Revision history for this message
GunChleoc (gunchleoc) wrote :

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.

« Back to merge proposal