M_AssignSprayCans: Don't handle the prepended cans in reverse order

Was messing around with part-duplicating this code for Prison Egg CDs, and realised a corruption/overwriting bug if you had more freebie Spray Cans than the standard ones.
This commit is contained in:
toaster 2023-10-11 16:11:14 +01:00
parent 46dcfe0000
commit 2cc796a042

View file

@ -806,14 +806,15 @@ static void M_AssignSpraycans(void)
M_Shuffle_UINT16(tempcanlist + prependoffset - (prependlen - 1), prependlen);
// Put at the front of the main list
// (technically reverses the prepend order, but it
// (technically messes with the main order, but it
// was LITERALLY just shuffled so it doesn't matter)
while (prependlen)
i = 0;
while (i < prependlen)
{
prependlen--;
tempcanlist[listlen] = tempcanlist[prependlen];
tempcanlist[prependlen] = tempcanlist[prependoffset - prependlen];
tempcanlist[listlen] = tempcanlist[i];
tempcanlist[i] = tempcanlist[prependoffset - i];
listlen++;
i++;
}
}