Fix td6_reset_trailing_elements

Only one byte, 0xFF terminates the track elements rather than a track element with a type of 0xFF.
This commit is contained in:
Ted John 2016-10-15 20:57:29 +01:00
parent 5708b2e749
commit de341f1d86
1 changed files with 2 additions and 4 deletions

View File

@ -315,15 +315,13 @@ static void td6_reset_trailing_elements(rct_track_td6 * td6)
while (mazeElement->all != 0) {
mazeElement++;
}
mazeElement++;
lastElement = mazeElement;
lastElement = (void *)((uintptr_t)mazeElement + 1);
} else {
rct_td6_track_element * trackElement = (rct_td6_track_element *)td6->elements;
while (trackElement->type != 0xFF) {
trackElement++;
}
trackElement++;
lastElement = trackElement;
lastElement = (void *)((uintptr_t)trackElement + 1);
}
size_t trailingSize = td6->elementsSize - (size_t)((uintptr_t)lastElement - (uintptr_t)td6->elements);
memset(lastElement, 0xFF, trailingSize);