Vanilla-Conquer icon indicating copy to clipboard operation
Vanilla-Conquer copied to clipboard

Fixes indexing of various Overlapper related loops.

Open tomsons26 opened this issue 2 years ago • 4 comments

tomsons26 avatar Jul 02 '22 07:07 tomsons26

I don't want to refactor the use cases of this array which would be what i'd need to do if i'd introduce the enum. Most of TD codebase will eventually go as it merges with RA's so this is just needless work and pollution.

tomsons26 avatar Jul 05 '22 07:07 tomsons26

I don't want to refactor the use cases of this array which would be what i'd need to do if i'd introduce the enum. Most of TD codebase will eventually go as it merges with RA's so this is just needless work and pollution.

You don't need to refactor the use cases. And pollution in this case is quite subjective. Still, loops like this: for (int i = 0; i < MAX_OVERLAPPERS; i++)

reads way better than:

for (unsigned i = 0; i < (sizeof(_offsets) / sizeof(_offsets[0]) - 1); i++)

or

         for (i = 0; i < ARRAY_SIZE((*this)[cell].CellClass::Overlapper); i++) {

which is flirted with obscurantism.

giulianobelinassi avatar Jul 05 '22 13:07 giulianobelinassi

How does RA handle this in the instances where the TD code has been updated? Or are these bits TD specific logic? I think a macro for the array sizes would make things easier to read, I wasn't a fan of the ARRAY_SIZE macro in the chronoshift days either :D

OmniBlade avatar Jul 18 '22 09:07 OmniBlade

This is RA's changes ported over

tomsons26 avatar Jul 20 '22 10:07 tomsons26