Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/ride/ride.c
Original file line number Diff line number Diff line change
Expand Up @@ -5498,10 +5498,12 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e

void ride_set_name(int rideIndex, const char *name)
{
char name_buffer[36];
safe_strcpy(name_buffer, name, sizeof(name_buffer));
gGameCommandErrorTitle = STR_CANT_RENAME_RIDE_ATTRACTION;
game_do_command(1, (rideIndex << 8) | 1, 0, *((int*)(name + 0)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 8)), *((int*)(name + 4)));
game_do_command(2, (rideIndex << 8) | 1, 0, *((int*)(name + 12)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 20)), *((int*)(name + 16)));
game_do_command(0, (rideIndex << 8) | 1, 0, *((int*)(name + 24)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name + 32)), *((int*)(name + 28)));
game_do_command(1, (rideIndex << 8) | 1, 0, *((int*)(name_buffer + 0)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name_buffer + 8)), *((int*)(name_buffer + 4)));
game_do_command(2, (rideIndex << 8) | 1, 0, *((int*)(name_buffer + 12)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name_buffer + 20)), *((int*)(name_buffer + 16)));
game_do_command(0, (rideIndex << 8) | 1, 0, *((int*)(name_buffer + 24)), GAME_COMMAND_SET_RIDE_NAME, *((int*)(name_buffer + 32)), *((int*)(name_buffer + 28)));
}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/ride/track_design.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ static rct_track_td6 *track_design_open_from_buffer(uint8 *src, size_t srcLength
rct_track_td6 *td6 = calloc(1, sizeof(rct_track_td6));
uint8 *readPtr = src;

// Clear top of track_design as this is not loaded from the td4 files
memset(&td6->track_spine_colour, 0, 67);

// Read start of track_design
copy(td6, &readPtr, 32);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This memset has wrong argument: tries to set 67 bytes of a 4-byte item and is not needed, as the space for object has been calloced.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not wrong, its setting several fields - not just that one. But as you say, it should already by zeroed by calloc.


Expand Down
3 changes: 2 additions & 1 deletion src/ride/track_design_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static void track_design_save_pop_map_element_desc(rct_object_entry *entry, int
memmove(
&_trackSavedMapElementsDesc[removeIndex],
&_trackSavedMapElementsDesc[removeIndex + 1],
remainingNumItems * sizeof(rct_td6_scenery_element*)
remainingNumItems * sizeof(rct_td6_scenery_element)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is what you intended to do.

);
}
_trackSavedMapElementsDescCount--;
Expand Down Expand Up @@ -1288,6 +1288,7 @@ static bool track_design_save_to_file(rct_track_td6 *td6, utf8 *path)

// Encode TD6 data
uint8 *encodedData = malloc(0x8000);
assert(td6Buffer.ptr != NULL);
int encodedDataLength = sawyercoding_encode_td6((uint8*)td6Buffer.ptr, encodedData, td6Buffer.length);

// Save encoded TD6 data to file
Expand Down