gordon-david / 2DGame

0 stars 0 forks source link

No item duplicates #7

Closed gordon-david closed 5 years ago

gordon-david commented 5 years ago

Build all equipment into a container (list), then sort into an order to be given in (ie random order or otherwise).

gordon-david commented 5 years ago

I'll try and fix this today.

gordon-david commented 5 years ago

https://github.com/DavieCakes/2DGame/commit/6798bbea38c87ad73d67e58d30431f1c2884362c <- added in this commit

Ok, it's finished. Added a singleton EquipmentQueue to the Builder class that maintains a sorted queue of the equipment to get. Every '.Pop()' operation just get's the equipment with the lowest sum of it's modifiers (because equipment can have more that one modifier), so it's sorted by least -> more powerful.

I tried to make everything as 'safe' as I could (i.e. checking for null references, checking for successful procedure completions, etc.).