Fel'Unh Ikk
Fel'Unh Ikk
CC#
Created by ApathyErr on 5/1/2023 in #help
❔ "Items collection must be empty before using ItemsSource."
Check designer where DGridCustomer is located, maybe there are some items added
6 replies
CC#
Created by ApathyErr on 5/1/2023 in #help
❔ "Items collection must be empty before using ItemsSource."
Seems your DGridCustomer.Items has some items added manually
6 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
and this baffles my mind on how to optimise it further. One way i thought of was sorting array for each field and getting only 'best' states
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
that's a problem because imagine 2 states, with all fields set to 0. first state has Progress of 100 and second state has Quality of 200. I have to keep both states as none of them are worse than each other
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
public bool AllWorseOrEqual(CESPacked o) { return Progress <= o.Progress && Quality <= o.Quality && CPRemaining <= o.CPRemaining && Durability <= o.Durability && AllBitFieldsWorseOrEqual(o); }
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
technically yes, i want to find states, that are the best
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
i don't know what you don't understand
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
i want to filter out states from array such as: if state from array is worse than any other state from the same array, it gets filtered out
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
state from array worse than any other state in the same array
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
there could technically be the best state, but if fields are different there won't be
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
and IsWorse is AllWorseOrEqual
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
CESPacked is what State is in this code
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
the method I use now includes some other unimportant code, but here it is public static int RemoveWorseStates_TwoPointers(CESPacked[] packedArray, ref int length) { int right = length - 1; int removedCount = 0; for (int i = 0; i < right; i++) { bool isWorse = false; for (int j = i + 1; j <= right; j++) { if (packedArray[i].AllWorseOrEqual(packedArray[j])) { isWorse = true; break; } } if (isWorse) { CESPacked temp = packedArray[i]; packedArray[i] = packedArray[right]; packedArray[right] = temp; right--; removedCount++; i--; } } length -= removedCount; int to = length + removedCount; for (int i = length; i < to; i++) { if (!packedArray[i].IsDisposed) { packedArray[i].Dispose(); } else Debugger.Break(); } return removedCount; }
24 replies
CC#
Created by Fel'Unh Ikk on 3/22/2023 in #help
❔ Filtering out worse states from states array
I also use ArrayPool so 'filtering out' means just moving worse states to the back and reducing Length variable
24 replies