mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor memcpy to std::memcpy and memset to std::memset (#8408)
This commit is contained in:
parent
748da25f78
commit
7d19a5bc77
|
@ -66,7 +66,7 @@ void InGameConsole::Input(CONSOLE_INPUT input)
|
|||
if (_consoleHistoryIndex > 0)
|
||||
{
|
||||
_consoleHistoryIndex--;
|
||||
memcpy(_consoleCurrentLine, _consoleHistory[_consoleHistoryIndex], CONSOLE_INPUT_SIZE);
|
||||
std::memcpy(_consoleCurrentLine, _consoleHistory[_consoleHistoryIndex], CONSOLE_INPUT_SIZE);
|
||||
}
|
||||
_consoleTextInputSession->Size = strlen(_consoleTextInputSession->Buffer);
|
||||
_consoleTextInputSession->Length = utf8_length(_consoleTextInputSession->Buffer);
|
||||
|
@ -76,7 +76,7 @@ void InGameConsole::Input(CONSOLE_INPUT input)
|
|||
if (_consoleHistoryIndex < _consoleHistoryCount - 1)
|
||||
{
|
||||
_consoleHistoryIndex++;
|
||||
memcpy(_consoleCurrentLine, _consoleHistory[_consoleHistoryIndex], CONSOLE_INPUT_SIZE);
|
||||
std::memcpy(_consoleCurrentLine, _consoleHistory[_consoleHistoryIndex], CONSOLE_INPUT_SIZE);
|
||||
_consoleTextInputSession->Size = strlen(_consoleTextInputSession->Buffer);
|
||||
_consoleTextInputSession->Length = utf8_length(_consoleTextInputSession->Buffer);
|
||||
_consoleTextInputSession->SelectionStart = strlen(_consoleCurrentLine);
|
||||
|
@ -118,10 +118,10 @@ void InGameConsole::HistoryAdd(const utf8* src)
|
|||
if (_consoleHistoryCount >= CONSOLE_HISTORY_SIZE)
|
||||
{
|
||||
for (int32_t i = 0; i < _consoleHistoryCount - 1; i++)
|
||||
memcpy(_consoleHistory[i], _consoleHistory[i + 1], CONSOLE_INPUT_SIZE);
|
||||
std::memcpy(_consoleHistory[i], _consoleHistory[i + 1], CONSOLE_INPUT_SIZE);
|
||||
_consoleHistoryCount--;
|
||||
}
|
||||
memcpy(_consoleHistory[_consoleHistoryCount++], src, CONSOLE_INPUT_SIZE);
|
||||
std::memcpy(_consoleHistory[_consoleHistoryCount++], src, CONSOLE_INPUT_SIZE);
|
||||
_consoleHistoryIndex = _consoleHistoryCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -1045,7 +1045,7 @@ static void widget_text_box_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
|
|||
|
||||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[TEXT_INPUT_SIZE] = { 0 };
|
||||
memcpy(temp_string, wrapped_string, std::min(string_length, gTextInput->SelectionStart));
|
||||
std::memcpy(temp_string, wrapped_string, std::min(string_length, gTextInput->SelectionStart));
|
||||
int32_t cur_x = l + gfx_get_string_width(temp_string) + 3;
|
||||
|
||||
int32_t width = 6;
|
||||
|
|
|
@ -217,8 +217,8 @@ void window_dropdown_show_text_custom_width(
|
|||
|
||||
// Input state
|
||||
gDropdownHighlightedIndex = -1;
|
||||
memset(_dropdownItemsDisabled, 0, sizeof(_dropdownItemsDisabled));
|
||||
memset(_dropdownItemsChecked, 0, sizeof(_dropdownItemsChecked));
|
||||
std::fill_n(_dropdownItemsDisabled, sizeof(_dropdownItemsDisabled), false);
|
||||
std::fill_n(_dropdownItemsChecked, sizeof(_dropdownItemsChecked), false);
|
||||
gDropdownIsColour = false;
|
||||
gDropdownDefaultIndex = -1;
|
||||
input_set_state(INPUT_STATE_DROPDOWN_ACTIVE);
|
||||
|
@ -297,8 +297,8 @@ void window_dropdown_show_image(
|
|||
|
||||
// Input state
|
||||
gDropdownHighlightedIndex = -1;
|
||||
memset(_dropdownItemsDisabled, 0, sizeof(_dropdownItemsDisabled));
|
||||
memset(_dropdownItemsChecked, 0, sizeof(_dropdownItemsChecked));
|
||||
std::fill_n(_dropdownItemsDisabled, sizeof(_dropdownItemsDisabled), false);
|
||||
std::fill_n(_dropdownItemsChecked, sizeof(_dropdownItemsChecked), false);
|
||||
gDropdownIsColour = false;
|
||||
gDropdownDefaultIndex = -1;
|
||||
input_set_state(INPUT_STATE_DROPDOWN_ACTIVE);
|
||||
|
|
|
@ -396,7 +396,7 @@ rct_window* window_editor_object_selection_open()
|
|||
| (((uint32_t)1) << WIDX_LIST_SORT_RIDE);
|
||||
|
||||
_filter_flags = gConfigInterface.object_selection_filter_flags;
|
||||
memset(_filter_string, 0, sizeof(_filter_string));
|
||||
std::fill_n(_filter_string, sizeof(_filter_string), 0x00);
|
||||
|
||||
for (int32_t i = WIDX_TAB_1; i < WIDX_TAB_1 + OBJECT_TYPE_COUNT; i++)
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ static void window_editor_object_selection_mouseup(rct_window* w, rct_widgetinde
|
|||
window_start_textbox(w, widgetIndex, STR_STRING, _filter_string, sizeof(_filter_string));
|
||||
break;
|
||||
case WIDX_FILTER_CLEAR_BUTTON:
|
||||
memset(_filter_string, 0, sizeof(_filter_string));
|
||||
std::fill_n(_filter_string, sizeof(_filter_string), 0x00);
|
||||
filter_update_counts();
|
||||
w->scrolls->v_top = 0;
|
||||
visible_list_refresh(w);
|
||||
|
|
|
@ -682,7 +682,7 @@ static void window_game_bottom_toolbar_draw_middle_panel(rct_drawpixelinfo* dpi,
|
|||
|
||||
// Check if there is a map tooltip to draw
|
||||
rct_string_id stringId;
|
||||
memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
std::memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
if (stringId == STR_NONE)
|
||||
{
|
||||
gfx_draw_string_centred_wrapped(dpi, gMapTooltipFormatArgs, x, y, width, STR_TITLE_SEQUENCE_OPENRCT2, w->colours[0]);
|
||||
|
|
|
@ -574,8 +574,8 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex
|
|||
i = y / SUMMARISED_GUEST_ROW_HEIGHT;
|
||||
if (i < _window_guest_list_num_groups)
|
||||
{
|
||||
memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[i], 4);
|
||||
memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[i], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[i], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[i], 4);
|
||||
_window_guest_list_selected_filter = _window_guest_list_selected_view;
|
||||
_window_guest_list_selected_tab = PAGE_INDIVIDUAL;
|
||||
window_guest_list_widgets[WIDX_TRACKING].type = WWT_FLATBTN;
|
||||
|
@ -909,10 +909,10 @@ static void get_arguments_from_peep(rct_peep* peep, uint32_t* argument_1, uint32
|
|||
{
|
||||
// HACK The out arguments here are used to draw the group text so we just return
|
||||
// gCommonFormatArgs as two uint32_ts.
|
||||
memset(gCommonFormatArgs, 0, sizeof(*argument_1) + sizeof(*argument_2));
|
||||
std::memset(gCommonFormatArgs, 0, sizeof(*argument_1) + sizeof(*argument_2));
|
||||
peep_thought_set_format_args(thought);
|
||||
memcpy(argument_1, gCommonFormatArgs, sizeof(*argument_1));
|
||||
memcpy(argument_2, gCommonFormatArgs + sizeof(*argument_1), sizeof(*argument_2));
|
||||
std::memcpy(argument_1, gCommonFormatArgs, sizeof(*argument_1));
|
||||
std::memcpy(argument_2, gCommonFormatArgs + sizeof(*argument_1), sizeof(*argument_2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -973,8 +973,8 @@ static void window_guest_list_find_groups()
|
|||
|
||||
get_arguments_from_peep(
|
||||
peep, &_window_guest_list_groups_argument_1[groupIndex], &_window_guest_list_groups_argument_2[groupIndex]);
|
||||
memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[groupIndex], 4);
|
||||
memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[groupIndex], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[groupIndex], 4);
|
||||
std::memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[groupIndex], 4);
|
||||
|
||||
_window_guest_list_group_index[groupIndex] = groupIndex;
|
||||
faceIndex = groupIndex * 56;
|
||||
|
@ -1050,11 +1050,11 @@ static void window_guest_list_find_groups()
|
|||
_window_guest_list_groups_argument_2[swap_position] = temp;
|
||||
|
||||
uint8_t temp_faces[56];
|
||||
memcpy(temp_faces, &(_window_guest_list_groups_guest_faces[groupIndex * 56]), 56);
|
||||
memcpy(
|
||||
std::memcpy(temp_faces, &(_window_guest_list_groups_guest_faces[groupIndex * 56]), 56);
|
||||
std::memcpy(
|
||||
&(_window_guest_list_groups_guest_faces[groupIndex * 56]),
|
||||
&(_window_guest_list_groups_guest_faces[swap_position * 56]), 56);
|
||||
memcpy(&(_window_guest_list_groups_guest_faces[swap_position * 56]), temp_faces, 56);
|
||||
std::memcpy(&(_window_guest_list_groups_guest_faces[swap_position * 56]), temp_faces, 56);
|
||||
|
||||
temp = _window_guest_list_group_index[swap_position];
|
||||
_window_guest_list_group_index[swap_position] = bl;
|
||||
|
|
|
@ -94,7 +94,7 @@ void window_map_tooltip_update_visibility()
|
|||
|
||||
// Show or hide tooltip
|
||||
rct_string_id stringId;
|
||||
memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
std::memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
|
||||
if (_cursorHoldDuration < 25 || stringId == STR_NONE
|
||||
|| input_test_place_object_modifier(
|
||||
|
@ -158,7 +158,7 @@ static void window_map_tooltip_update(rct_window* w)
|
|||
static void window_map_tooltip_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
rct_string_id stringId;
|
||||
memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
std::memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
|
||||
if (stringId == STR_NONE)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -356,7 +356,7 @@ static ride_list_item* window_new_ride_iterate_over_ride_group(
|
|||
{
|
||||
uint8_t rideEntryIndex = *rideEntryIndexPtr++;
|
||||
char rideEntryName[DAT_NAME_LENGTH + 1];
|
||||
memcpy(rideEntryName, object_entry_get_entry(OBJECT_TYPE_RIDE, rideEntryIndex)->name, 8);
|
||||
std::memcpy(rideEntryName, object_entry_get_entry(OBJECT_TYPE_RIDE, rideEntryIndex)->name, 8);
|
||||
rideEntryName[DAT_NAME_LENGTH] = 0;
|
||||
|
||||
// Skip if vehicle type is not invented yet
|
||||
|
@ -1084,7 +1084,7 @@ static void window_new_ride_list_vehicles_for(const uint8_t rideType, const rct_
|
|||
return;
|
||||
}
|
||||
|
||||
memset(out, 0, AVAILABILITY_STRING_SIZE);
|
||||
std::fill_n(out, AVAILABILITY_STRING_SIZE, 0x00);
|
||||
|
||||
uint8_t* rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideType);
|
||||
|
||||
|
|
|
@ -3695,7 +3695,7 @@ static void window_ride_operating_invalidate(rct_window* w)
|
|||
if (ride->type == RIDE_TYPE_TWIST)
|
||||
{
|
||||
uint16_t arg;
|
||||
memcpy(&arg, gCommonFormatArgs + 18, sizeof(uint16_t));
|
||||
std::memcpy(&arg, gCommonFormatArgs + 18, sizeof(uint16_t));
|
||||
set_format_arg(18, uint16_t, arg * 3);
|
||||
}
|
||||
|
||||
|
|
|
@ -698,7 +698,7 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
formatSecondary = STR_QUEUE_EMPTY;
|
||||
{
|
||||
uint16_t arg;
|
||||
memcpy(&arg, gCommonFormatArgs + 2, sizeof(uint16_t));
|
||||
std::memcpy(&arg, gCommonFormatArgs + 2, sizeof(uint16_t));
|
||||
|
||||
if (arg == 1)
|
||||
formatSecondary = STR_QUEUE_ONE_PERSON;
|
||||
|
@ -711,7 +711,7 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
formatSecondary = STR_QUEUE_TIME_LABEL;
|
||||
{
|
||||
uint16_t arg;
|
||||
memcpy(&arg, gCommonFormatArgs + 2, sizeof(uint16_t));
|
||||
std::memcpy(&arg, gCommonFormatArgs + 2, sizeof(uint16_t));
|
||||
|
||||
if (arg > 1)
|
||||
formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL;
|
||||
|
|
|
@ -370,13 +370,9 @@ static void window_server_list_textinput(rct_window* w, rct_widgetindex widgetIn
|
|||
if (strcmp(_playerName, text) == 0)
|
||||
return;
|
||||
|
||||
if (strlen(text) == 0)
|
||||
std::fill_n(_playerName, sizeof(_playerName), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
memset(_playerName, 0, sizeof(_playerName));
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(_playerName, 0, sizeof(_playerName));
|
||||
safe_strcpy(_playerName, text, sizeof(_playerName));
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
if (strcmp(_port, text) == 0)
|
||||
return;
|
||||
|
||||
memset(_port, 0, sizeof(_port));
|
||||
std::fill_n(_port, sizeof(_port), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
safe_strcpy(_port, text, sizeof(_port));
|
||||
|
@ -259,7 +259,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
if (strcmp(_name, text) == 0)
|
||||
return;
|
||||
|
||||
memset(_name, 0, sizeof(_name));
|
||||
std::fill_n(_name, sizeof(_name), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
safe_strcpy(_name, text, sizeof(_name));
|
||||
|
@ -278,7 +278,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
if (strcmp(_description, text) == 0)
|
||||
return;
|
||||
|
||||
memset(_description, 0, sizeof(_description));
|
||||
std::fill_n(_description, sizeof(_description), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
safe_strcpy(_description, text, sizeof(_description));
|
||||
|
@ -297,7 +297,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
if (strcmp(_greeting, text) == 0)
|
||||
return;
|
||||
|
||||
memset(_greeting, 0, sizeof(_greeting));
|
||||
std::fill_n(_greeting, sizeof(_greeting), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
safe_strcpy(_greeting, text, sizeof(_greeting));
|
||||
|
@ -316,7 +316,7 @@ static void window_server_start_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
if (strcmp(_password, text) == 0)
|
||||
return;
|
||||
|
||||
memset(_password, 0, sizeof(_password));
|
||||
std::fill_n(_password, sizeof(_password), 0x00);
|
||||
if (strlen(text) > 0)
|
||||
{
|
||||
safe_strcpy(_password, text, sizeof(_password));
|
||||
|
|
|
@ -231,7 +231,7 @@ static void window_text_input_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[TEXT_INPUT_SIZE] = { 0 };
|
||||
memcpy(temp_string, wrap_pointer, gTextInput->SelectionStart - char_count);
|
||||
std::memcpy(temp_string, wrap_pointer, gTextInput->SelectionStart - char_count);
|
||||
cursorX = w->x + 13 + gfx_get_string_width(temp_string);
|
||||
cursorY = y;
|
||||
|
||||
|
|
|
@ -667,7 +667,7 @@ static void window_tile_inspector_paste_element(rct_window* w)
|
|||
{
|
||||
// Construct the data to send using the surface's properties
|
||||
int32_t data[2];
|
||||
memcpy(&data[0], &tileInspectorCopiedElement, 8);
|
||||
std::memcpy(&data[0], &tileInspectorCopiedElement, 8);
|
||||
assert_struct_size(data, sizeof(tileInspectorCopiedElement));
|
||||
|
||||
game_do_command(
|
||||
|
|
|
@ -103,7 +103,7 @@ void window_tooltip_show(rct_string_id id, int32_t x, int32_t y)
|
|||
window_tooltip_widgets[WIDX_BACKGROUND].right = width;
|
||||
window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;
|
||||
|
||||
memcpy(_tooltipText, buffer, sizeof(_tooltipText));
|
||||
std::memcpy(_tooltipText, buffer, sizeof(_tooltipText));
|
||||
|
||||
int32_t screenWidth = context_get_width();
|
||||
int32_t screenHeight = context_get_height();
|
||||
|
|
|
@ -224,7 +224,7 @@ static bool sprite_file_export(int32_t spriteIndex, const char* outPath)
|
|||
spriteHeader = &spriteFileEntries[spriteIndex];
|
||||
pixelBufferSize = spriteHeader->width * spriteHeader->height;
|
||||
pixels = (uint8_t*)malloc(pixelBufferSize);
|
||||
memset(pixels, 0, pixelBufferSize);
|
||||
std::fill_n(pixels, pixelBufferSize, 0x00);
|
||||
|
||||
dpi.bits = pixels;
|
||||
dpi.x = 0;
|
||||
|
@ -234,7 +234,7 @@ static bool sprite_file_export(int32_t spriteIndex, const char* outPath)
|
|||
dpi.pitch = 0;
|
||||
dpi.zoom_level = 0;
|
||||
|
||||
memcpy(spriteFilePalette, CmdlineSprite::_standardPalette, 256 * 4);
|
||||
std::memcpy(spriteFilePalette, CmdlineSprite::_standardPalette, 256 * 4);
|
||||
|
||||
if (spriteHeader->flags & G1_FLAG_RLE_COMPRESSION)
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
sprite_entries_make_absolute();
|
||||
|
||||
spriteFileEntries[spriteFileHeader.num_entries - 1] = spriteElement;
|
||||
memcpy(spriteFileData + (spriteFileHeader.total_size - bufferLength), buffer, bufferLength);
|
||||
std::memcpy(spriteFileData + (spriteFileHeader.total_size - bufferLength), buffer, bufferLength);
|
||||
spriteFileEntries[spriteFileHeader.num_entries - 1].offset = spriteFileData
|
||||
+ (spriteFileHeader.total_size - bufferLength);
|
||||
|
||||
|
@ -675,7 +675,7 @@ int32_t cmdline_for_sprite(const char** argv, int32_t argc)
|
|||
sprite_entries_make_absolute();
|
||||
|
||||
spriteFileEntries[spriteFileHeader.num_entries - 1] = spriteElement;
|
||||
memcpy(spriteFileData + (spriteFileHeader.total_size - bufferLength), buffer, bufferLength);
|
||||
std::memcpy(spriteFileData + (spriteFileHeader.total_size - bufferLength), buffer, bufferLength);
|
||||
spriteFileEntries[spriteFileHeader.num_entries - 1].offset = spriteFileData
|
||||
+ (spriteFileHeader.total_size - bufferLength);
|
||||
|
||||
|
|
|
@ -767,7 +767,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c
|
|||
{
|
||||
static char banner_name[128];
|
||||
|
||||
memset(banner_name, ' ', sizeof(banner_name));
|
||||
std::fill_n(banner_name, sizeof(banner_name), ' ');
|
||||
int nameChunkIndex = *eax & 0xFFFF;
|
||||
|
||||
int nameChunkOffset = nameChunkIndex - 1;
|
||||
|
@ -775,9 +775,9 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c
|
|||
nameChunkOffset = 2;
|
||||
nameChunkOffset *= 12;
|
||||
nameChunkOffset = std::min(nameChunkOffset, (int32_t)(std::size(banner_name) - 12));
|
||||
memcpy(banner_name + nameChunkOffset + 0, edx, 4);
|
||||
memcpy(banner_name + nameChunkOffset + 4, ebp, 4);
|
||||
memcpy(banner_name + nameChunkOffset + 8, edi, 4);
|
||||
std::memcpy(banner_name + nameChunkOffset + 0, edx, 4);
|
||||
std::memcpy(banner_name + nameChunkOffset + 4, ebp, 4);
|
||||
std::memcpy(banner_name + nameChunkOffset + 8, edi, 4);
|
||||
banner_name[sizeof(banner_name) - 1] = '\0';
|
||||
|
||||
char* args_sign[2] = {
|
||||
|
@ -1283,7 +1283,7 @@ static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processL
|
|||
for (size_t i = 0; i < autosavesCount; i++)
|
||||
{
|
||||
autosaveFiles[i] = (utf8*)malloc(sizeof(utf8) * MAX_PATH);
|
||||
memset(autosaveFiles[i], 0, sizeof(utf8) * MAX_PATH);
|
||||
std::memset(autosaveFiles[i], 0, sizeof(utf8) * MAX_PATH);
|
||||
|
||||
if (scanner->Next())
|
||||
{
|
||||
|
|
|
@ -288,7 +288,7 @@ public:
|
|||
ride->inspection_interval = RIDE_INSPECTION_EVERY_30_MINUTES;
|
||||
ride->last_inspection = 0;
|
||||
ride->downtime = 0;
|
||||
memset(ride->downtime_history, 0, sizeof(ride->downtime_history));
|
||||
std::fill_n(ride->downtime_history, sizeof(ride->downtime_history), 0x00);
|
||||
ride->no_primary_items_sold = 0;
|
||||
ride->no_secondary_items_sold = 0;
|
||||
ride->last_crash_type = RIDE_CRASH_TYPE_NONE;
|
||||
|
|
|
@ -404,7 +404,7 @@ namespace String
|
|||
{
|
||||
size_t srcSize = SizeOf(src) + 1;
|
||||
result = Memory::Allocate<utf8>(srcSize);
|
||||
memcpy(result, src, srcSize);
|
||||
std::memcpy(result, src, srcSize);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
const char* jniChars = env->GetStringUTFChars(jniString, nullptr);
|
||||
|
||||
utf8* string = (char*)malloc(strlen(jniChars) + 1);
|
||||
memcpy((void*)string, jniChars, strlen(jniChars));
|
||||
std::memcpy((void*)string, jniChars, strlen(jniChars));
|
||||
string[strlen(jniChars)] = 0x00;
|
||||
|
||||
env->ReleaseStringUTFChars(jniString, jniChars);
|
||||
|
@ -158,7 +158,7 @@ JNIEXPORT jlong JNICALL Java_website_openrct2_ZipArchive_allocBytes(JNIEnv* env,
|
|||
jbyte* bufferPtr = env->GetByteArrayElements(input, nullptr);
|
||||
|
||||
void* data = Memory::Allocate<void>((size_t)numBytes);
|
||||
memcpy(data, bufferPtr, numBytes);
|
||||
std::memcpy(data, bufferPtr, numBytes);
|
||||
|
||||
env->ReleaseByteArrayElements(input, bufferPtr, 0);
|
||||
|
||||
|
|
|
@ -548,18 +548,18 @@ uint8_t* FASTCALL gfx_draw_sprite_get_palette(int32_t image_id, uint32_t tertiar
|
|||
auto tertiary_palette = gfx_get_g1_element(tertiary_offset);
|
||||
if (tertiary_palette != nullptr)
|
||||
{
|
||||
memcpy(palette_pointer + 0x2E, &tertiary_palette->offset[0xF3], 12);
|
||||
std::memcpy(palette_pointer + 0x2E, &tertiary_palette->offset[0xF3], 12);
|
||||
}
|
||||
}
|
||||
auto primary_palette = gfx_get_g1_element(primary_offset);
|
||||
if (primary_palette != nullptr)
|
||||
{
|
||||
memcpy(palette_pointer + 0xF3, &primary_palette->offset[0xF3], 12);
|
||||
std::memcpy(palette_pointer + 0xF3, &primary_palette->offset[0xF3], 12);
|
||||
}
|
||||
auto secondary_palette = gfx_get_g1_element(secondary_offset);
|
||||
if (secondary_palette != nullptr)
|
||||
{
|
||||
memcpy(palette_pointer + 0xCA, &secondary_palette->offset[0xF3], 12);
|
||||
std::memcpy(palette_pointer + 0xCA, &secondary_palette->offset[0xF3], 12);
|
||||
}
|
||||
|
||||
return palette_pointer;
|
||||
|
|
|
@ -690,8 +690,8 @@ static const utf8* ttf_process_format_code(rct_drawpixelinfo* dpi, const utf8* t
|
|||
info->palette[2] = (ebx >> 8) & 0xFF;
|
||||
|
||||
// Adjust the text palette
|
||||
memcpy(info->palette + 3, &(g1->offset[247]), 2);
|
||||
memcpy(info->palette + 5, &(g1->offset[250]), 2);
|
||||
std::memcpy(info->palette + 3, &(g1->offset[247]), 2);
|
||||
std::memcpy(info->palette + 5, &(g1->offset[250]), 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ static const utf8* ttf_process_glyph_run(rct_drawpixelinfo* dpi, const utf8* tex
|
|||
else
|
||||
{
|
||||
size_t length = (size_t)(ch - text);
|
||||
memcpy(buffer, text, length);
|
||||
std::memcpy(buffer, text, length);
|
||||
buffer[length] = 0;
|
||||
ttf_draw_string_raw(dpi, buffer, info);
|
||||
return ch;
|
||||
|
@ -926,10 +926,10 @@ void ttf_draw_string(rct_drawpixelinfo* dpi, const_utf8string text, int32_t colo
|
|||
info.flags |= TEXT_DRAW_FLAG_TTF;
|
||||
}
|
||||
|
||||
memcpy(info.palette, text_palette, sizeof(info.palette));
|
||||
std::memcpy(info.palette, text_palette, sizeof(info.palette));
|
||||
ttf_process_initial_colour(colour, &info);
|
||||
ttf_process_string(dpi, text, &info);
|
||||
memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
std::memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
|
||||
gCurrentFontSpriteBase = info.font_sprite_base;
|
||||
gCurrentFontFlags = info.flags;
|
||||
|
@ -985,10 +985,10 @@ void gfx_draw_string_with_y_offsets(
|
|||
info.flags |= TEXT_DRAW_FLAG_TTF;
|
||||
}
|
||||
|
||||
memcpy(info.palette, text_palette, sizeof(info.palette));
|
||||
std::memcpy(info.palette, text_palette, sizeof(info.palette));
|
||||
ttf_process_initial_colour(colour, &info);
|
||||
ttf_process_string(dpi, text, &info);
|
||||
memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
std::memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
|
||||
gCurrentFontSpriteBase = info.font_sprite_base;
|
||||
gCurrentFontFlags = info.flags;
|
||||
|
|
|
@ -123,9 +123,9 @@ static void FASTCALL DrawRLESprite2(
|
|||
{
|
||||
if (zoom_level == 0)
|
||||
{
|
||||
// Since we're sampling each pixel at this zoom level, just do a straight memcpy
|
||||
// Since we're sampling each pixel at this zoom level, just do a straight std::memcpy
|
||||
if (numPixels > 0)
|
||||
memcpy(copyDest, copySrc, numPixels);
|
||||
std::memcpy(copyDest, copySrc, numPixels);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ std::tuple<void*, size_t> ImageImporter::EncodeRLE(const int32_t* pixels, uint32
|
|||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
std::memset(buffer, 0, (height * 2) + (width * height * 16));
|
||||
std::fill_n(buffer, (height * 2) + (width * height * 16), 0x00);
|
||||
auto yOffsets = (uint16_t*)buffer;
|
||||
auto dst = buffer + (height * 2);
|
||||
for (uint32_t y = 0; y < height; y++)
|
||||
|
|
|
@ -130,10 +130,10 @@ void lightfx_init()
|
|||
_LightListBack = _LightListA;
|
||||
_LightListFront = _LightListB;
|
||||
|
||||
memset(_bakedLightTexture_lantern_0, 0xFF, 32 * 32);
|
||||
memset(_bakedLightTexture_lantern_1, 0xFF, 64 * 64);
|
||||
memset(_bakedLightTexture_lantern_2, 0xFF, 128 * 128);
|
||||
memset(_bakedLightTexture_lantern_3, 0xFF, 256 * 256);
|
||||
std::fill_n(_bakedLightTexture_lantern_0, 32 * 32, 0xFF);
|
||||
std::fill_n(_bakedLightTexture_lantern_1, 64 * 64, 0xFF);
|
||||
std::fill_n(_bakedLightTexture_lantern_2, 128 * 128, 0xFF);
|
||||
std::fill_n(_bakedLightTexture_lantern_3, 256 * 256, 0xFF);
|
||||
|
||||
uint8_t* parcer = _bakedLightTexture_lantern_3;
|
||||
|
||||
|
@ -171,7 +171,7 @@ void lightfx_update_buffers(rct_drawpixelinfo* info)
|
|||
_light_rendered_buffer_front = realloc(_light_rendered_buffer_front, info->width * info->height);
|
||||
_light_rendered_buffer_back = realloc(_light_rendered_buffer_back, info->width * info->height);
|
||||
|
||||
memcpy(&_pixelInfo, info, sizeof(rct_drawpixelinfo));
|
||||
std::memcpy(&_pixelInfo, info, sizeof(rct_drawpixelinfo));
|
||||
}
|
||||
|
||||
extern void viewport_paint_setup();
|
||||
|
@ -500,7 +500,7 @@ void lightfx_render_lights_to_frontbuffer()
|
|||
return;
|
||||
}
|
||||
|
||||
memset(_light_rendered_buffer_front, 0, _pixelInfo.width * _pixelInfo.height);
|
||||
std::memset(_light_rendered_buffer_front, 0, _pixelInfo.width * _pixelInfo.height);
|
||||
|
||||
_lightPolution_back = 0;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void scrolling_text_initialise_bitmaps()
|
|||
|
||||
for (int32_t i = 0; i < FONT_SPRITE_GLYPH_COUNT; i++)
|
||||
{
|
||||
memset(drawingSurface, 0, sizeof(drawingSurface));
|
||||
std::fill_n(drawingSurface, sizeof(drawingSurface), 0x00);
|
||||
gfx_draw_sprite_software(&dpi, SPR_CHAR_START + FONT_SPRITE_BASE_TINY + i, -1, 0, 0);
|
||||
|
||||
for (int32_t x = 0; x < 8; x++)
|
||||
|
@ -80,7 +80,7 @@ void scrolling_text_initialise_bitmaps()
|
|||
|
||||
for (int32_t i = 0; i < SPR_G2_GLYPH_COUNT; i++)
|
||||
{
|
||||
memset(drawingSurface, 0, sizeof(drawingSurface));
|
||||
std::fill_n(drawingSurface, sizeof(drawingSurface), 0x00);
|
||||
gfx_draw_sprite_software(&dpi, SPR_G2_CHAR_BEGIN + (FONT_SIZE_TINY * SPR_G2_GLYPH_COUNT) + i, -1, 0, 0);
|
||||
|
||||
for (int32_t x = 0; x < 8; x++)
|
||||
|
@ -148,8 +148,8 @@ static int32_t scrolling_text_get_matching_or_oldest(rct_string_id stringId, uin
|
|||
|
||||
// If exact match return the matching index
|
||||
uint32_t stringArgs0, stringArgs1;
|
||||
memcpy(&stringArgs0, gCommonFormatArgs + 0, sizeof(uint32_t));
|
||||
memcpy(&stringArgs1, gCommonFormatArgs + 4, sizeof(uint32_t));
|
||||
std::memcpy(&stringArgs0, gCommonFormatArgs + 0, sizeof(uint32_t));
|
||||
std::memcpy(&stringArgs1, gCommonFormatArgs + 4, sizeof(uint32_t));
|
||||
if (scrollText->string_id == stringId && scrollText->string_args_0 == stringArgs0
|
||||
&& scrollText->string_args_1 == stringArgs1 && scrollText->position == scroll && scrollText->mode == scrollingMode)
|
||||
{
|
||||
|
@ -1487,8 +1487,8 @@ int32_t scrolling_text_setup(paint_session* session, rct_string_id stringId, uin
|
|||
|
||||
// Setup scrolling text
|
||||
uint32_t stringArgs0, stringArgs1;
|
||||
memcpy(&stringArgs0, gCommonFormatArgs + 0, sizeof(uint32_t));
|
||||
memcpy(&stringArgs1, gCommonFormatArgs + 4, sizeof(uint32_t));
|
||||
std::memcpy(&stringArgs0, gCommonFormatArgs + 0, sizeof(uint32_t));
|
||||
std::memcpy(&stringArgs1, gCommonFormatArgs + 4, sizeof(uint32_t));
|
||||
|
||||
rct_draw_scroll_text* scrollText = &_drawScrollTextList[scrollIndex];
|
||||
scrollText->string_id = stringId;
|
||||
|
@ -1504,7 +1504,7 @@ int32_t scrolling_text_setup(paint_session* session, rct_string_id stringId, uin
|
|||
|
||||
const int16_t* scrollingModePositions = _scrollPositions[scrollingMode];
|
||||
|
||||
memset(scrollText->bitmap, 0, 320 * 8);
|
||||
std::fill_n(scrollText->bitmap, 320 * 8, 0x00);
|
||||
if (LocalisationService_UseTrueTypeFont())
|
||||
{
|
||||
scrolling_text_set_bitmap_for_ttf(scrollString, scroll, scrollText->bitmap, scrollingModePositions);
|
||||
|
|
|
@ -27,7 +27,9 @@ misrepresented as being the original software.
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
# include <algorithm>
|
||||
# include <cmath>
|
||||
# include <cstring>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
@ -236,7 +238,7 @@ static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf,
|
|||
for (line = height; line > 0 && dst < dst_check; --line)
|
||||
{
|
||||
/* 1 because 0 is the bg color */
|
||||
memset(dst, 1, textbuf->w);
|
||||
std::fill_n(dst, textbuf->w, 0x01);
|
||||
dst += textbuf->pitch;
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +259,7 @@ static void TTF_drawLine_Shaded(const TTF_Font* font, const TTFSurface* textbuf,
|
|||
/* Draw line */
|
||||
for (line = height; line > 0 && dst < dst_check; --line)
|
||||
{
|
||||
memset(dst, NUM_GRAYS - 1, textbuf->w);
|
||||
std::fill_n(dst, textbuf->w, NUM_GRAYS - 1);
|
||||
dst += textbuf->pitch;
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +390,7 @@ static TTF_Font* TTF_OpenFontIndexRW(FILE* src, int freesrc, int ptsize, long in
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
memset(font, 0, sizeof(*font));
|
||||
std::fill_n((uint8_t*)font, sizeof(*font), 0x00);
|
||||
|
||||
font->src = src;
|
||||
font->freesrc = freesrc;
|
||||
|
@ -400,7 +402,7 @@ static TTF_Font* TTF_OpenFontIndexRW(FILE* src, int freesrc, int ptsize, long in
|
|||
TTF_CloseFont(font);
|
||||
return NULL;
|
||||
}
|
||||
memset(stream, 0, sizeof(*stream));
|
||||
std::fill_n((uint8_t*)stream, sizeof(*stream), 0x00);
|
||||
|
||||
stream->read = RWread;
|
||||
stream->descriptor.pointer = src;
|
||||
|
@ -702,7 +704,7 @@ static FT_Error Load_Glyph(TTF_Font* font, uint16_t ch, c_glyph* cached, int wan
|
|||
{
|
||||
dst = &cached->pixmap;
|
||||
}
|
||||
memcpy(dst, src, sizeof(*dst));
|
||||
std::memcpy(dst, src, sizeof(*dst));
|
||||
|
||||
/* FT_Render_Glyph() and .fon fonts always generate a
|
||||
* two-color (black and white) glyphslot surface, even
|
||||
|
@ -748,7 +750,7 @@ static FT_Error Load_Glyph(TTF_Font* font, uint16_t ch, c_glyph* cached, int wan
|
|||
{
|
||||
return FT_Err_Out_Of_Memory;
|
||||
}
|
||||
memset(dst->buffer, 0, dst->pitch * dst->rows);
|
||||
std::fill_n(dst->buffer, dst->pitch * dst->rows, 0x00);
|
||||
|
||||
for (i = 0; i < src->rows; i++)
|
||||
{
|
||||
|
@ -894,7 +896,7 @@ static FT_Error Load_Glyph(TTF_Font* font, uint16_t ch, c_glyph* cached, int wan
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy(dst->buffer + doffset, src->buffer + soffset, src->pitch);
|
||||
std::memcpy(dst->buffer + doffset, src->buffer + soffset, src->pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -750,7 +750,7 @@ void X8DrawingContext::DrawSpriteRawMasked(int32_t x, int32_t y, uint32_t maskIm
|
|||
void X8DrawingContext::DrawSpriteSolid(uint32_t image, int32_t x, int32_t y, uint8_t colour)
|
||||
{
|
||||
uint8_t palette[256];
|
||||
memset(palette, colour, 256);
|
||||
std::fill_n(palette, sizeof(palette), colour);
|
||||
palette[0] = 0;
|
||||
|
||||
image &= 0x7FFFF;
|
||||
|
|
|
@ -64,8 +64,8 @@ void chat_toggle()
|
|||
|
||||
void chat_init()
|
||||
{
|
||||
memset(_chatHistory, 0, sizeof(_chatHistory));
|
||||
memset(_chatHistoryTime, 0, sizeof(_chatHistoryTime));
|
||||
std::memset(_chatHistory, 0x00, sizeof(_chatHistory));
|
||||
std::memset(_chatHistoryTime, 0x00, sizeof(_chatHistoryTime));
|
||||
}
|
||||
|
||||
void chat_update()
|
||||
|
@ -178,7 +178,7 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
|||
// TODO: Show caret if the input text has multiple lines
|
||||
if (_chatCaretTicks < 15 && gfx_get_string_width(lineBuffer) < (_chatWidth - 10))
|
||||
{
|
||||
memcpy(lineBuffer, _chatCurrentLine, _chatTextInputSession->SelectionStart);
|
||||
std::memcpy(lineBuffer, _chatCurrentLine, _chatTextInputSession->SelectionStart);
|
||||
lineBuffer[_chatTextInputSession->SelectionStart] = 0;
|
||||
int32_t caretX = x + gfx_get_string_width(lineBuffer);
|
||||
int32_t caretY = y + 14;
|
||||
|
@ -208,7 +208,7 @@ void chat_history_add(const char* src)
|
|||
const char* srcText = ch;
|
||||
|
||||
// Copy format codes to buffer
|
||||
memcpy(buffer, src, std::min(bufferSize, (size_t)(srcText - src)));
|
||||
std::memcpy(buffer, src, std::min(bufferSize, (size_t)(srcText - src)));
|
||||
|
||||
// Prepend a timestamp
|
||||
time_t timer;
|
||||
|
@ -220,8 +220,8 @@ void chat_history_add(const char* src)
|
|||
|
||||
// Add to history list
|
||||
int32_t index = _chatHistoryIndex % CHAT_HISTORY_SIZE;
|
||||
memset(_chatHistory[index], 0, CHAT_INPUT_SIZE);
|
||||
memcpy(_chatHistory[index], buffer, std::min<size_t>(strlen(buffer), CHAT_INPUT_SIZE - 1));
|
||||
std::fill_n(_chatHistory[index], CHAT_INPUT_SIZE, 0x00);
|
||||
std::memcpy(_chatHistory[index], buffer, std::min<size_t>(strlen(buffer), CHAT_INPUT_SIZE - 1));
|
||||
_chatHistoryTime[index] = platform_get_ticks();
|
||||
_chatHistoryIndex++;
|
||||
|
||||
|
|
|
@ -1020,7 +1020,7 @@ static int32_t cc_load_object(InteractiveConsole& console, const utf8** argv, in
|
|||
if (argc > 0)
|
||||
{
|
||||
char name[9] = { 0 };
|
||||
memset(name, ' ', 8);
|
||||
std::fill_n(name, 8, ' ');
|
||||
int32_t i = 0;
|
||||
for (const char* ch = argv[0]; *ch != '\0' && i < 8; ch++)
|
||||
{
|
||||
|
@ -1547,7 +1547,7 @@ void InteractiveConsole::Execute(const std::string& s)
|
|||
if (length > 0)
|
||||
{
|
||||
utf8* arg = (utf8*)malloc(length + 1);
|
||||
memcpy(arg, start, length);
|
||||
std::memcpy(arg, start, length);
|
||||
arg[length] = 0;
|
||||
|
||||
if (argc >= argvCapacity)
|
||||
|
|
|
@ -261,7 +261,7 @@ static void viewport_redraw_after_shift(
|
|||
|
||||
// save viewport
|
||||
rct_viewport view_copy;
|
||||
memcpy(&view_copy, viewport, sizeof(rct_viewport));
|
||||
std::memcpy(&view_copy, viewport, sizeof(rct_viewport));
|
||||
|
||||
if (viewport->x < window->x)
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ static void viewport_redraw_after_shift(
|
|||
}
|
||||
|
||||
// restore viewport
|
||||
memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
std::memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -449,7 +449,7 @@ static void viewport_move(int16_t x, int16_t y, rct_window* w, rct_viewport* vie
|
|||
}
|
||||
|
||||
rct_viewport view_copy;
|
||||
memcpy(&view_copy, viewport, sizeof(rct_viewport));
|
||||
std::memcpy(&view_copy, viewport, sizeof(rct_viewport));
|
||||
|
||||
if (viewport->x < 0)
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ static void viewport_move(int16_t x, int16_t y, rct_window* w, rct_viewport* vie
|
|||
|
||||
if (viewport->width <= 0)
|
||||
{
|
||||
memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
std::memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ static void viewport_move(int16_t x, int16_t y, rct_window* w, rct_viewport* vie
|
|||
|
||||
if (viewport->height <= 0)
|
||||
{
|
||||
memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
std::memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ static void viewport_move(int16_t x, int16_t y, rct_window* w, rct_viewport* vie
|
|||
viewport_shift_pixels(dpi, w, viewport, x_diff, y_diff);
|
||||
}
|
||||
|
||||
memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
std::memcpy(viewport, &view_copy, sizeof(rct_viewport));
|
||||
}
|
||||
|
||||
// rct2: 0x006E7A15
|
||||
|
@ -1498,7 +1498,7 @@ static bool sub_679074(rct_drawpixelinfo* dpi, int32_t imageId, int16_t x, int16
|
|||
{
|
||||
source_pointer++;
|
||||
total_no_pixels -= no_pixels;
|
||||
memcpy((char*)new_source_pointer, (char*)source_pointer, no_pixels);
|
||||
std::memcpy((char*)new_source_pointer, (char*)source_pointer, no_pixels);
|
||||
new_source_pointer += no_pixels;
|
||||
source_pointer += no_pixels;
|
||||
continue;
|
||||
|
@ -1516,7 +1516,7 @@ static bool sub_679074(rct_drawpixelinfo* dpi, int32_t imageId, int16_t x, int16
|
|||
source_pointer = (uint8_t*)ebx1;
|
||||
ebx1 = eax;
|
||||
eax = 0;
|
||||
memcpy((char*)new_source_pointer, (char*)source_pointer, ecx);
|
||||
std::memcpy((char*)new_source_pointer, (char*)source_pointer, ecx);
|
||||
new_source_pointer += ecx;
|
||||
source_pointer = (uint8_t*)ebx1;
|
||||
}
|
||||
|
|
|
@ -2001,7 +2001,7 @@ void window_start_textbox(
|
|||
window_close_by_class(WC_TEXTINPUT);
|
||||
|
||||
// Clear the text input buffer
|
||||
memset(gTextBoxInput, 0, maxLength);
|
||||
std::fill_n(gTextBoxInput, maxLength, 0x00);
|
||||
|
||||
// Enter in the text input buffer any existing
|
||||
// text.
|
||||
|
|
|
@ -372,13 +372,13 @@ static void format_append_string(char** dest, size_t* size, const utf8* string)
|
|||
size_t length = strlen(string);
|
||||
if (length < (*size))
|
||||
{
|
||||
memcpy((*dest), string, length);
|
||||
std::memcpy((*dest), string, length);
|
||||
(*dest) += length;
|
||||
(*size) -= length;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy((*dest), string, (*size) - 1);
|
||||
std::memcpy((*dest), string, (*size) - 1);
|
||||
(*dest) += (*size) - 1;
|
||||
*(*dest)++ = '\0';
|
||||
(*size) = 0;
|
||||
|
@ -392,13 +392,13 @@ static void format_append_string_n(char** dest, size_t* size, const utf8* string
|
|||
size_t length = std::min(maxlen, strlen(string));
|
||||
if (length < (*size))
|
||||
{
|
||||
memcpy((*dest), string, length);
|
||||
std::memcpy((*dest), string, length);
|
||||
(*dest) += length;
|
||||
(*size) -= length;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy((*dest), string, (*size) - 1);
|
||||
std::memcpy((*dest), string, (*size) - 1);
|
||||
(*dest) += (*size) - 1;
|
||||
*(*dest)++ = '\0';
|
||||
(*size) = 0;
|
||||
|
|
|
@ -80,7 +80,7 @@ extern const rct_string_id DateGameShortMonthNames[MONTH_COUNT];
|
|||
|
||||
[[maybe_unused]] static inline void set_format_arg_body(uint8_t* args, size_t offset, uintptr_t value, size_t size)
|
||||
{
|
||||
memcpy(args + offset, &value, size);
|
||||
std::memcpy(args + offset, &value, size);
|
||||
}
|
||||
|
||||
#define set_format_arg(offset, type, value) \
|
||||
|
|
|
@ -24,7 +24,7 @@ static bool user_string_exists(const utf8* text);
|
|||
*/
|
||||
void user_string_clear_all()
|
||||
{
|
||||
memset(gUserStrings, 0, MAX_USER_STRINGS * USER_STRING_MAX_LENGTH);
|
||||
std::memset(gUserStrings, 0x00, MAX_USER_STRINGS * USER_STRING_MAX_LENGTH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenRCT2::Network::Http
|
|||
size_t copy_this_much = wt->sizeleft;
|
||||
if (copy_this_much > buffer_size)
|
||||
copy_this_much = buffer_size;
|
||||
memcpy(dst, wt->readptr, copy_this_much);
|
||||
std::memcpy(dst, wt->readptr, copy_this_much);
|
||||
|
||||
wt->readptr += copy_this_much;
|
||||
wt->sizeleft -= copy_this_much;
|
||||
|
@ -212,7 +212,7 @@ namespace OpenRCT2::Network::Http
|
|||
return 0;
|
||||
}
|
||||
|
||||
memcpy(data, res.body.c_str(), dataSize);
|
||||
std::memcpy(data, res.body.c_str(), dataSize);
|
||||
*outData = data;
|
||||
|
||||
return dataSize;
|
||||
|
|
|
@ -1511,7 +1511,7 @@ uint8_t* Network::save_for_network(size_t& out_size, const std::vector<const Obj
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy(&header[header_len], compressed, out_size);
|
||||
std::memcpy(&header[header_len], compressed, out_size);
|
||||
out_size += header_len;
|
||||
log_verbose("Sending map of size %u bytes, compressed to %u bytes", size, out_size);
|
||||
}
|
||||
|
@ -1528,7 +1528,7 @@ uint8_t* Network::save_for_network(size_t& out_size, const std::vector<const Obj
|
|||
else
|
||||
{
|
||||
out_size = size;
|
||||
memcpy(header, data, size);
|
||||
std::memcpy(header, data, size);
|
||||
}
|
||||
}
|
||||
return header;
|
||||
|
@ -2176,7 +2176,7 @@ void Network::Client_Handle_TOKEN(NetworkConnection& connection, NetworkPacket&
|
|||
char* signature;
|
||||
const std::string pubkey = _key.PublicKeyString();
|
||||
_challenge.resize(challenge_size);
|
||||
memcpy(_challenge.data(), challenge, challenge_size);
|
||||
std::memcpy(_challenge.data(), challenge, challenge_size);
|
||||
bool ok = _key.Sign(_challenge.data(), _challenge.size(), &signature, &sigsize);
|
||||
if (!ok)
|
||||
{
|
||||
|
@ -2490,7 +2490,7 @@ void Network::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connection,
|
|||
intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { gNetwork.Close(); });
|
||||
context_open_intent(&intent);
|
||||
|
||||
memcpy(&chunk_buffer[offset], (void*)packet.Read(chunksize), chunksize);
|
||||
std::memcpy(&chunk_buffer[offset], (void*)packet.Read(chunksize), chunksize);
|
||||
if (offset + chunksize == size)
|
||||
{
|
||||
context_force_close_window_by_class(WC_NETWORK_STATUS);
|
||||
|
@ -3484,9 +3484,9 @@ void game_command_modify_groups(
|
|||
nameChunkOffset = 2;
|
||||
nameChunkOffset *= 12;
|
||||
nameChunkOffset = (std::min)(nameChunkOffset, std::size(newName) - 12);
|
||||
memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 0), edx, sizeof(uint32_t));
|
||||
memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 4), ebp, sizeof(uint32_t));
|
||||
memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 8), edi, sizeof(uint32_t));
|
||||
std::memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 0), edx, sizeof(uint32_t));
|
||||
std::memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 4), ebp, sizeof(uint32_t));
|
||||
std::memcpy((void*)((uintptr_t)newName + (uintptr_t)nameChunkOffset + 8), edi, sizeof(uint32_t));
|
||||
|
||||
if (nameChunkIndex != 0)
|
||||
{
|
||||
|
|
|
@ -472,7 +472,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy(ss, result->ai_addr, result->ai_addrlen);
|
||||
std::memcpy(ss, result->ai_addr, result->ai_addrlen);
|
||||
*ss_len = (int32_t)result->ai_addrlen;
|
||||
freeaddrinfo(result);
|
||||
return true;
|
||||
|
|
|
@ -425,7 +425,7 @@ namespace ObjectFactory
|
|||
entry.checksum = std::stoul(originalId.substr(18, 8), nullptr, 16);
|
||||
}
|
||||
auto minLength = std::min<size_t>(8, originalName.length());
|
||||
memcpy(entry.name, originalName.c_str(), minLength);
|
||||
std::memcpy(entry.name, originalName.c_str(), minLength);
|
||||
|
||||
result = CreateObject(entry);
|
||||
auto readContext = ReadObjectContext(objectRepository, id, !gOpenRCT2NoGraphics, fileRetriever);
|
||||
|
|
|
@ -59,8 +59,8 @@ int32_t object_entry_group_encoding[] = {
|
|||
bool object_entry_is_empty(const rct_object_entry* entry)
|
||||
{
|
||||
uint64_t a, b;
|
||||
memcpy(&a, (uint8_t*)entry, 8);
|
||||
memcpy(&b, (uint8_t*)entry + 8, 8);
|
||||
std::memcpy(&a, (uint8_t*)entry, 8);
|
||||
std::memcpy(&b, (uint8_t*)entry + 8, 8);
|
||||
|
||||
if (a == 0xFFFFFFFFFFFFFFFF && b == 0xFFFFFFFFFFFFFFFF)
|
||||
return true;
|
||||
|
@ -161,7 +161,7 @@ void* get_loaded_object_chunk(size_t index)
|
|||
void object_entry_get_name_fixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry)
|
||||
{
|
||||
bufferSize = std::min((size_t)DAT_NAME_LENGTH + 1, bufferSize);
|
||||
memcpy(buffer, entry->name, bufferSize - 1);
|
||||
std::memcpy(buffer, entry->name, bufferSize - 1);
|
||||
buffer[bufferSize - 1] = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1240,8 +1240,8 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
|||
tunnel_entry backupLeftTunnels[TUNNEL_MAX_COUNT];
|
||||
tunnel_entry backupRightTunnels[TUNNEL_MAX_COUNT];
|
||||
|
||||
memcpy(backupLeftTunnels, session->LeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
memcpy(backupRightTunnels, session->RightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(backupLeftTunnels, session->LeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(backupRightTunnels, session->RightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
|
||||
viewport_surface_draw_land_side_top(
|
||||
session, EDGE_TOPLEFT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[3]);
|
||||
|
@ -1252,8 +1252,8 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
|
|||
viewport_surface_draw_land_side_bottom(
|
||||
session, EDGE_BOTTOMRIGHT, height / 16, edgeStyle, tileDescriptors[0], tileDescriptors[2]);
|
||||
|
||||
memcpy(session->LeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
memcpy(session->RightTunnels, backupRightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(session->LeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
std::memcpy(session->RightTunnels, backupRightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
}
|
||||
|
||||
if (tileElement->AsSurface()->GetWaterHeight() > 0)
|
||||
|
|
|
@ -1310,7 +1310,7 @@ int32_t peep_pathfind_choose_direction(TileCoordsXYZ loc, rct_peep* peep)
|
|||
peep->pathfind_goal.direction = 0;
|
||||
|
||||
// Clear pathfinding history
|
||||
memset(peep->pathfind_history, 0xFF, sizeof(peep->pathfind_history));
|
||||
std::fill_n((uint8_t*)peep->pathfind_history, sizeof(peep->pathfind_history), 0xFF);
|
||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
if (gPathFindDebug)
|
||||
{
|
||||
|
@ -1366,7 +1366,7 @@ int32_t peep_pathfind_choose_direction(TileCoordsXYZ loc, rct_peep* peep)
|
|||
_peepPathFindNumJunctions = _peepPathFindMaxJunctions;
|
||||
|
||||
// Initialise _peepPathFindHistory.
|
||||
memset(_peepPathFindHistory, 0xFF, sizeof(_peepPathFindHistory));
|
||||
std::memset(_peepPathFindHistory, 0xFF, sizeof(_peepPathFindHistory));
|
||||
|
||||
/* The pathfinding will only use elements
|
||||
* 1.._peepPathFindMaxJunctions, so the starting point
|
||||
|
|
|
@ -1831,10 +1831,10 @@ rct_peep* peep_generate(int32_t x, int32_t y, int32_t z)
|
|||
|
||||
peep->toilet = 0;
|
||||
peep->time_to_consume = 0;
|
||||
memset(&peep->rides_been_on, 0, 32);
|
||||
std::fill_n(peep->rides_been_on, 32, 0x00);
|
||||
|
||||
peep->no_of_rides = 0;
|
||||
memset(&peep->ride_types_been_on, 0, 16);
|
||||
std::fill_n(peep->ride_types_been_on, 16, 0x00);
|
||||
peep->id = gNextGuestNumber++;
|
||||
peep->name_string_idx = STR_GUEST_X;
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ uint16_t platform_get_locale_language()
|
|||
break;
|
||||
}
|
||||
}
|
||||
} // end strip
|
||||
memcpy(pattern, langString, length); // copy all until first '.' or '@'
|
||||
} // end strip
|
||||
std::memcpy(pattern, langString, length); // copy all until first '.' or '@'
|
||||
pattern[length] = '\0';
|
||||
// find _ if present
|
||||
const char* strip = strchr(pattern, '_');
|
||||
|
@ -177,7 +177,7 @@ bool platform_get_steam_path(utf8* outPath, size_t outSize)
|
|||
return true;
|
||||
}
|
||||
|
||||
memset(steamPath, 0, sizeof(steamPath));
|
||||
std::fill_n(steamPath, sizeof(steamPath), 0x00);
|
||||
safe_strcpy(steamPath, homeDir, sizeof(steamPath));
|
||||
safe_strcat_path(steamPath, ".steam/steam/ubuntu12_32/steamapps/content", sizeof(steamPath));
|
||||
if (platform_directory_exists(steamPath))
|
||||
|
|
|
@ -54,7 +54,7 @@ char* strndup(const char* src, size_t size)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
dst = (char*)memcpy(dst, src, len);
|
||||
dst = (char*)std::memcpy(dst, src, len);
|
||||
dst[len] = '\0';
|
||||
return dst;
|
||||
}
|
||||
|
|
|
@ -742,7 +742,7 @@ private:
|
|||
|
||||
void ImportRide(Ride* dst, rct1_ride* src)
|
||||
{
|
||||
memset(dst, 0, sizeof(Ride));
|
||||
std::memset(dst, 0x00, sizeof(Ride));
|
||||
|
||||
// This is a peculiarity of this exact version number, which only Heide-Park seems to use.
|
||||
if (_s4.game_version == 110018 && src->type == RCT1_RIDE_TYPE_INVERTED_ROLLER_COASTER)
|
||||
|
@ -1995,7 +1995,7 @@ private:
|
|||
auto dst = &gTileElements[index + dstOffset];
|
||||
if (src->base_height == 0xFF)
|
||||
{
|
||||
memcpy(dst, src, sizeof(*src));
|
||||
std::memcpy(dst, src, sizeof(*src));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ void SawyerChunkReader::ReadChunk(void* dst, size_t length)
|
|||
if (remainingLength > 0)
|
||||
{
|
||||
auto offset = (uint8_t*)dst + chunkLength;
|
||||
std::memset(offset, 0, remainingLength);
|
||||
std::fill_n(offset, remainingLength, 0x00);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ size_t SawyerChunkReader::DecodeChunkRLE(void* dst, size_t dstCapacity, const vo
|
|||
throw SawyerChunkException(EXCEPTION_MSG_DESTINATION_TOO_SMALL);
|
||||
}
|
||||
|
||||
std::memset(dst8, src8[i], count);
|
||||
std::fill_n(dst8, count, src8[i]);
|
||||
dst8 += count;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
S6Exporter::S6Exporter()
|
||||
{
|
||||
RemoveTracklessRides = false;
|
||||
memset(&_s6, 0, sizeof(_s6));
|
||||
std::memset(&_s6, 0x00, sizeof(_s6));
|
||||
}
|
||||
|
||||
void S6Exporter::SaveGame(const utf8* path)
|
||||
|
@ -191,7 +191,7 @@ void S6Exporter::Export()
|
|||
_s6.scenario_srand_0 = gScenarioSrand0;
|
||||
_s6.scenario_srand_1 = gScenarioSrand1;
|
||||
|
||||
memcpy(_s6.tile_elements, gTileElements, sizeof(_s6.tile_elements));
|
||||
std::memcpy(_s6.tile_elements, gTileElements, sizeof(_s6.tile_elements));
|
||||
|
||||
_s6.next_free_tile_element_pointer_index = gNextFreeTileElementPointerIndex;
|
||||
// Sprites needs to be reset before they get used.
|
||||
|
@ -201,7 +201,7 @@ void S6Exporter::Export()
|
|||
sprite_clear_all_unused();
|
||||
for (int32_t i = 0; i < RCT2_MAX_SPRITES; i++)
|
||||
{
|
||||
memcpy(&_s6.sprites[i], get_sprite(i), sizeof(rct_sprite));
|
||||
std::memcpy(&_s6.sprites[i], get_sprite(i), sizeof(rct_sprite));
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < NUM_SPRITE_LISTS; i++)
|
||||
|
@ -232,13 +232,13 @@ void S6Exporter::Export()
|
|||
researchedTrackPiecesA[i] = (RideTypePossibleTrackConfigurations[i]) & 0xFFFFFFFFULL;
|
||||
researchedTrackPiecesB[i] = (RideTypePossibleTrackConfigurations[i] >> 32ULL) & 0xFFFFFFFFULL;
|
||||
}
|
||||
memcpy(_s6.researched_track_types_a, researchedTrackPiecesA, sizeof(_s6.researched_track_types_a));
|
||||
memcpy(_s6.researched_track_types_b, researchedTrackPiecesB, sizeof(_s6.researched_track_types_b));
|
||||
std::memcpy(_s6.researched_track_types_a, researchedTrackPiecesA, sizeof(_s6.researched_track_types_a));
|
||||
std::memcpy(_s6.researched_track_types_b, researchedTrackPiecesB, sizeof(_s6.researched_track_types_b));
|
||||
|
||||
_s6.guests_in_park = gNumGuestsInPark;
|
||||
_s6.guests_heading_for_park = gNumGuestsHeadingForPark;
|
||||
|
||||
memcpy(_s6.expenditure_table, gExpenditureTable, sizeof(_s6.expenditure_table));
|
||||
std::memcpy(_s6.expenditure_table, gExpenditureTable, sizeof(_s6.expenditure_table));
|
||||
|
||||
_s6.last_guests_in_park = gNumGuestsInParkLastWeek;
|
||||
// pad_01357BCA
|
||||
|
@ -250,8 +250,8 @@ void S6Exporter::Export()
|
|||
|
||||
_s6.park_rating = gParkRating;
|
||||
|
||||
memcpy(_s6.park_rating_history, gParkRatingHistory, sizeof(_s6.park_rating_history));
|
||||
memcpy(_s6.guests_in_park_history, gGuestsInParkHistory, sizeof(_s6.guests_in_park_history));
|
||||
std::memcpy(_s6.park_rating_history, gParkRatingHistory, sizeof(_s6.park_rating_history));
|
||||
std::memcpy(_s6.guests_in_park_history, gGuestsInParkHistory, sizeof(_s6.guests_in_park_history));
|
||||
|
||||
_s6.active_research_types = gResearchPriorities;
|
||||
_s6.research_progress_stage = gResearchProgressStage;
|
||||
|
@ -275,10 +275,10 @@ void S6Exporter::Export()
|
|||
// pad_013580FA
|
||||
_s6.objective_currency = gScenarioObjectiveCurrency;
|
||||
_s6.objective_guests = gScenarioObjectiveNumGuests;
|
||||
memcpy(_s6.campaign_weeks_left, gMarketingCampaignDaysLeft, sizeof(_s6.campaign_weeks_left));
|
||||
memcpy(_s6.campaign_ride_index, gMarketingCampaignRideIndex, sizeof(_s6.campaign_ride_index));
|
||||
std::memcpy(_s6.campaign_weeks_left, gMarketingCampaignDaysLeft, sizeof(_s6.campaign_weeks_left));
|
||||
std::memcpy(_s6.campaign_ride_index, gMarketingCampaignRideIndex, sizeof(_s6.campaign_ride_index));
|
||||
|
||||
memcpy(_s6.balance_history, gCashHistory, sizeof(_s6.balance_history));
|
||||
std::memcpy(_s6.balance_history, gCashHistory, sizeof(_s6.balance_history));
|
||||
|
||||
_s6.current_expenditure = gCurrentExpenditure;
|
||||
_s6.current_profit = gCurrentProfit;
|
||||
|
@ -286,17 +286,17 @@ void S6Exporter::Export()
|
|||
_s6.weekly_profit_average_divisor = gWeeklyProfitAverageDivisor;
|
||||
// pad_0135833A
|
||||
|
||||
memcpy(_s6.weekly_profit_history, gWeeklyProfitHistory, sizeof(_s6.weekly_profit_history));
|
||||
std::memcpy(_s6.weekly_profit_history, gWeeklyProfitHistory, sizeof(_s6.weekly_profit_history));
|
||||
|
||||
_s6.park_value = gParkValue;
|
||||
|
||||
memcpy(_s6.park_value_history, gParkValueHistory, sizeof(_s6.park_value_history));
|
||||
std::memcpy(_s6.park_value_history, gParkValueHistory, sizeof(_s6.park_value_history));
|
||||
|
||||
_s6.completed_company_value = gScenarioCompletedCompanyValue;
|
||||
_s6.total_admissions = gTotalAdmissions;
|
||||
_s6.income_from_admissions = gTotalIncomeFromAdmissions;
|
||||
_s6.company_value = gCompanyValue;
|
||||
memcpy(_s6.peep_warning_throttle, gPeepWarningThrottle, sizeof(_s6.peep_warning_throttle));
|
||||
std::memcpy(_s6.peep_warning_throttle, gPeepWarningThrottle, sizeof(_s6.peep_warning_throttle));
|
||||
|
||||
// Awards
|
||||
for (int32_t i = 0; i < RCT12_MAX_AWARDS; i++)
|
||||
|
@ -319,7 +319,7 @@ void S6Exporter::Export()
|
|||
// pad_013587CA
|
||||
_s6.historical_profit = gHistoricalProfit;
|
||||
// pad_013587D4
|
||||
memcpy(_s6.scenario_completed_name, gScenarioCompletedBy, sizeof(_s6.scenario_completed_name));
|
||||
std::memcpy(_s6.scenario_completed_name, gScenarioCompletedBy, sizeof(_s6.scenario_completed_name));
|
||||
_s6.cash = ENCRYPT_MONEY(gCash);
|
||||
// pad_013587FC
|
||||
_s6.park_rating_casualty_penalty = gParkRatingCasualtyPenalty;
|
||||
|
@ -335,8 +335,8 @@ void S6Exporter::Export()
|
|||
// pad_01358842
|
||||
ExportResearchList();
|
||||
_s6.map_base_z = gMapBaseZ;
|
||||
memcpy(_s6.scenario_name, gScenarioName, sizeof(_s6.scenario_name));
|
||||
memcpy(_s6.scenario_description, gScenarioDetails, sizeof(_s6.scenario_description));
|
||||
std::memcpy(_s6.scenario_name, gScenarioName, sizeof(_s6.scenario_name));
|
||||
std::memcpy(_s6.scenario_description, gScenarioDetails, sizeof(_s6.scenario_description));
|
||||
_s6.current_interest_rate = gBankLoanInterestRate;
|
||||
// pad_0135934B
|
||||
_s6.same_price_throughout_extended = gSamePriceThroughoutParkB;
|
||||
|
@ -349,9 +349,9 @@ void S6Exporter::Export()
|
|||
_s6.park_entrance_direction[i] = gParkEntrances[i].direction;
|
||||
}
|
||||
safe_strcpy(_s6.scenario_filename, gScenarioFileName, sizeof(_s6.scenario_filename));
|
||||
memcpy(_s6.saved_expansion_pack_names, gScenarioExpansionPacks, sizeof(_s6.saved_expansion_pack_names));
|
||||
memcpy(_s6.banners, gBanners, sizeof(_s6.banners));
|
||||
memcpy(_s6.custom_strings, gUserStrings, sizeof(_s6.custom_strings));
|
||||
std::memcpy(_s6.saved_expansion_pack_names, gScenarioExpansionPacks, sizeof(_s6.saved_expansion_pack_names));
|
||||
std::memcpy(_s6.banners, gBanners, sizeof(_s6.banners));
|
||||
std::memcpy(_s6.custom_strings, gUserStrings, sizeof(_s6.custom_strings));
|
||||
_s6.game_ticks_1 = gCurrentTicks;
|
||||
|
||||
this->ExportRides();
|
||||
|
@ -361,16 +361,16 @@ void S6Exporter::Export()
|
|||
_s6.saved_view_y = gSavedViewY;
|
||||
_s6.saved_view_zoom = gSavedViewZoom;
|
||||
_s6.saved_view_rotation = gSavedViewRotation;
|
||||
memcpy(_s6.map_animations, gAnimatedObjects, sizeof(_s6.map_animations));
|
||||
std::memcpy(_s6.map_animations, gAnimatedObjects, sizeof(_s6.map_animations));
|
||||
_s6.num_map_animations = gNumMapAnimations;
|
||||
// pad_0138B582
|
||||
|
||||
_s6.ride_ratings_calc_data = gRideRatingsCalcData;
|
||||
memcpy(_s6.ride_measurements, gRideMeasurements, sizeof(_s6.ride_measurements));
|
||||
std::memcpy(_s6.ride_measurements, gRideMeasurements, sizeof(_s6.ride_measurements));
|
||||
_s6.next_guest_index = gNextGuestNumber;
|
||||
_s6.grass_and_scenery_tilepos = gGrassSceneryTileLoopPosition;
|
||||
memcpy(_s6.patrol_areas, gStaffPatrolAreas, sizeof(_s6.patrol_areas));
|
||||
memcpy(_s6.staff_modes, gStaffModes, sizeof(_s6.staff_modes));
|
||||
std::memcpy(_s6.patrol_areas, gStaffPatrolAreas, sizeof(_s6.patrol_areas));
|
||||
std::memcpy(_s6.staff_modes, gStaffModes, sizeof(_s6.staff_modes));
|
||||
// unk_13CA73E
|
||||
// pad_13CA73F
|
||||
_s6.byte_13CA740 = gUnk13CA740;
|
||||
|
@ -402,7 +402,7 @@ void S6Exporter::Export()
|
|||
dst->Ticks = src->Ticks;
|
||||
dst->MonthYear = src->MonthYear;
|
||||
dst->Day = src->Day;
|
||||
memcpy(dst->Text, src->Text, sizeof(dst->Text));
|
||||
std::memcpy(dst->Text, src->Text, sizeof(dst->Text));
|
||||
}
|
||||
|
||||
// pad_13CE730
|
||||
|
@ -463,7 +463,7 @@ void S6Exporter::ExportRides()
|
|||
|
||||
void S6Exporter::ExportRide(rct2_ride* dst, const Ride* src)
|
||||
{
|
||||
memset(dst, 0, sizeof(rct2_ride));
|
||||
std::memset(dst, 0, sizeof(rct2_ride));
|
||||
|
||||
dst->type = src->type;
|
||||
dst->subtype = src->subtype;
|
||||
|
@ -728,7 +728,7 @@ void S6Exporter::ExportResearchedSceneryItems()
|
|||
|
||||
void S6Exporter::ExportResearchList()
|
||||
{
|
||||
memcpy(_s6.research_items, gResearchItems, sizeof(_s6.research_items));
|
||||
std::memcpy(_s6.research_items, gResearchItems, sizeof(_s6.research_items));
|
||||
}
|
||||
|
||||
enum : uint32_t
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
gNextFreeTileElementPointerIndex = _s6.next_free_tile_element_pointer_index;
|
||||
for (int32_t i = 0; i < RCT2_MAX_SPRITES; i++)
|
||||
{
|
||||
memcpy(get_sprite(i), &_s6.sprites[i], sizeof(rct_sprite));
|
||||
std::memcpy(get_sprite(i), &_s6.sprites[i], sizeof(rct_sprite));
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < NUM_SPRITE_LISTS; i++)
|
||||
|
@ -269,8 +269,8 @@ public:
|
|||
|
||||
gParkRating = _s6.park_rating;
|
||||
|
||||
memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history));
|
||||
memcpy(gGuestsInParkHistory, _s6.guests_in_park_history, sizeof(_s6.guests_in_park_history));
|
||||
std::memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history));
|
||||
std::memcpy(gGuestsInParkHistory, _s6.guests_in_park_history, sizeof(_s6.guests_in_park_history));
|
||||
|
||||
gResearchPriorities = _s6.active_research_types;
|
||||
gResearchProgressStage = _s6.research_progress_stage;
|
||||
|
@ -294,8 +294,8 @@ public:
|
|||
// pad_013580FA
|
||||
gScenarioObjectiveCurrency = _s6.objective_currency;
|
||||
gScenarioObjectiveNumGuests = _s6.objective_guests;
|
||||
memcpy(gMarketingCampaignDaysLeft, _s6.campaign_weeks_left, sizeof(_s6.campaign_weeks_left));
|
||||
memcpy(gMarketingCampaignRideIndex, _s6.campaign_ride_index, sizeof(_s6.campaign_ride_index));
|
||||
std::memcpy(gMarketingCampaignDaysLeft, _s6.campaign_weeks_left, sizeof(_s6.campaign_weeks_left));
|
||||
std::memcpy(gMarketingCampaignRideIndex, _s6.campaign_ride_index, sizeof(_s6.campaign_ride_index));
|
||||
|
||||
gCurrentExpenditure = _s6.current_expenditure;
|
||||
gCurrentProfit = _s6.current_profit;
|
||||
|
@ -316,7 +316,7 @@ public:
|
|||
gTotalAdmissions = _s6.total_admissions;
|
||||
gTotalIncomeFromAdmissions = _s6.income_from_admissions;
|
||||
gCompanyValue = _s6.company_value;
|
||||
memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle));
|
||||
std::memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle));
|
||||
|
||||
// Awards
|
||||
for (int32_t i = 0; i < RCT12_MAX_AWARDS; i++)
|
||||
|
@ -339,7 +339,7 @@ public:
|
|||
// pad_013587CA
|
||||
gHistoricalProfit = _s6.historical_profit;
|
||||
// pad_013587D4
|
||||
memcpy(gScenarioCompletedBy, _s6.scenario_completed_name, sizeof(_s6.scenario_completed_name));
|
||||
std::memcpy(gScenarioCompletedBy, _s6.scenario_completed_name, sizeof(_s6.scenario_completed_name));
|
||||
gCash = DECRYPT_MONEY(_s6.cash);
|
||||
// pad_013587FC
|
||||
gParkRatingCasualtyPenalty = _s6.park_rating_casualty_penalty;
|
||||
|
@ -355,8 +355,8 @@ public:
|
|||
// pad_01358842
|
||||
ImportResearchList();
|
||||
gMapBaseZ = _s6.map_base_z;
|
||||
memcpy(gScenarioName, _s6.scenario_name, sizeof(_s6.scenario_name));
|
||||
memcpy(gScenarioDetails, _s6.scenario_description, sizeof(_s6.scenario_description));
|
||||
std::memcpy(gScenarioName, _s6.scenario_name, sizeof(_s6.scenario_name));
|
||||
std::memcpy(gScenarioDetails, _s6.scenario_description, sizeof(_s6.scenario_description));
|
||||
gBankLoanInterestRate = _s6.current_interest_rate;
|
||||
// pad_0135934B
|
||||
gSamePriceThroughoutParkB = _s6.same_price_throughout_extended;
|
||||
|
@ -378,11 +378,11 @@ public:
|
|||
// For savegames the filename can be arbitrary, so we have no choice but to rely on the name provided
|
||||
String::Set(gScenarioFileName, sizeof(gScenarioFileName), _s6.scenario_filename);
|
||||
}
|
||||
memcpy(gScenarioExpansionPacks, _s6.saved_expansion_pack_names, sizeof(_s6.saved_expansion_pack_names));
|
||||
memcpy(gBanners, _s6.banners, sizeof(_s6.banners));
|
||||
std::memcpy(gScenarioExpansionPacks, _s6.saved_expansion_pack_names, sizeof(_s6.saved_expansion_pack_names));
|
||||
std::memcpy(gBanners, _s6.banners, sizeof(_s6.banners));
|
||||
// Clear all of the strings, since we will probably have a higher limit on user strings in the future than RCT2.
|
||||
user_string_clear_all();
|
||||
memcpy(gUserStrings, _s6.custom_strings, sizeof(_s6.custom_strings));
|
||||
std::memcpy(gUserStrings, _s6.custom_strings, sizeof(_s6.custom_strings));
|
||||
gCurrentTicks = _s6.game_ticks_1;
|
||||
gCurrentRealTimeTicks = 0;
|
||||
|
||||
|
@ -402,11 +402,11 @@ public:
|
|||
// pad_0138B582
|
||||
|
||||
gRideRatingsCalcData = _s6.ride_ratings_calc_data;
|
||||
memcpy(gRideMeasurements, _s6.ride_measurements, sizeof(_s6.ride_measurements));
|
||||
std::memcpy(gRideMeasurements, _s6.ride_measurements, sizeof(_s6.ride_measurements));
|
||||
gNextGuestNumber = _s6.next_guest_index;
|
||||
gGrassSceneryTileLoopPosition = _s6.grass_and_scenery_tilepos;
|
||||
memcpy(gStaffPatrolAreas, _s6.patrol_areas, sizeof(_s6.patrol_areas));
|
||||
memcpy(gStaffModes, _s6.staff_modes, sizeof(_s6.staff_modes));
|
||||
std::memcpy(gStaffPatrolAreas, _s6.patrol_areas, sizeof(_s6.patrol_areas));
|
||||
std::memcpy(gStaffModes, _s6.staff_modes, sizeof(_s6.staff_modes));
|
||||
// unk_13CA73E
|
||||
// pad_13CA73F
|
||||
gUnk13CA740 = _s6.byte_13CA740;
|
||||
|
@ -440,7 +440,7 @@ public:
|
|||
dst->Ticks = src->Ticks;
|
||||
dst->MonthYear = src->MonthYear;
|
||||
dst->Day = src->Day;
|
||||
memcpy(dst->Text, src->Text, sizeof(src->Text));
|
||||
std::memcpy(dst->Text, src->Text, sizeof(src->Text));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ public:
|
|||
|
||||
void ImportRide(Ride* dst, const rct2_ride* src, const uint8_t rideIndex)
|
||||
{
|
||||
memset(dst, 0, sizeof(Ride));
|
||||
std::memset(dst, 0, sizeof(Ride));
|
||||
|
||||
dst->type = src->type;
|
||||
dst->subtype = src->subtype;
|
||||
|
@ -790,7 +790,7 @@ public:
|
|||
|
||||
void ImportResearchList()
|
||||
{
|
||||
memcpy(gResearchItems, _s6.research_items, sizeof(_s6.research_items));
|
||||
std::memcpy(gResearchItems, _s6.research_items, sizeof(_s6.research_items));
|
||||
}
|
||||
|
||||
void Initialise()
|
||||
|
@ -865,7 +865,7 @@ public:
|
|||
auto dst = &gTileElements[index];
|
||||
if (src->base_height == 0xFF)
|
||||
{
|
||||
memcpy(dst, src, sizeof(*src));
|
||||
std::memcpy(dst, src, sizeof(*src));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -874,7 +874,7 @@ public:
|
|||
if (tileElementType == RCT12TileElementType::Corrupt
|
||||
|| tileElementType == RCT12TileElementType::EightCarsCorrupt14
|
||||
|| tileElementType == RCT12TileElementType::EightCarsCorrupt15)
|
||||
memcpy(dst, src, sizeof(*src));
|
||||
std::memcpy(dst, src, sizeof(*src));
|
||||
else
|
||||
ImportTileElement(dst, src);
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ void get_ride_entry_name(char* name, int32_t index)
|
|||
}
|
||||
|
||||
const auto entryName = object_entry_get_entry(OBJECT_TYPE_RIDE, index)->name;
|
||||
memcpy(name, entryName, 8);
|
||||
std::memcpy(name, entryName, 8);
|
||||
name[8] = '\0';
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ void reset_type_to_ride_entry_index_map(IObjectManager& objectManager)
|
|||
{
|
||||
size_t stride = MAX_RIDE_OBJECTS + 1;
|
||||
uint8_t* entryTypeTable = (uint8_t*)malloc(RIDE_TYPE_COUNT * stride);
|
||||
memset(entryTypeTable, 0xFF, RIDE_TYPE_COUNT * stride);
|
||||
std::fill_n(entryTypeTable, RIDE_TYPE_COUNT * stride, 0xFF);
|
||||
|
||||
for (uint8_t i = 0; i < MAX_RIDE_OBJECTS; i++)
|
||||
{
|
||||
|
@ -6980,7 +6980,7 @@ void ride_all_has_any_track_elements(bool* rideIndexArray)
|
|||
{
|
||||
tile_element_iterator it;
|
||||
|
||||
memset(rideIndexArray, 0, MAX_RIDES * sizeof(bool));
|
||||
std::fill_n(rideIndexArray, MAX_RIDES, false);
|
||||
|
||||
tile_element_iterator_begin(&it);
|
||||
while (tile_element_iterator_next(&it))
|
||||
|
|
|
@ -137,7 +137,7 @@ static rct_track_td6* track_design_open_from_td4(uint8_t* src, size_t srcLength)
|
|||
uint8_t version = (src[7] >> 2) & 3;
|
||||
if (version == 0)
|
||||
{
|
||||
memcpy(td4, src, 0x38);
|
||||
std::memcpy(td4, src, 0x38);
|
||||
td4->elementsSize = srcLength - 0x38;
|
||||
td4->elements = malloc(td4->elementsSize);
|
||||
if (td4->elements == nullptr)
|
||||
|
@ -146,11 +146,11 @@ static rct_track_td6* track_design_open_from_td4(uint8_t* src, size_t srcLength)
|
|||
SafeFree(td4);
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(td4->elements, src + 0x38, td4->elementsSize);
|
||||
std::memcpy(td4->elements, src + 0x38, td4->elementsSize);
|
||||
}
|
||||
else if (version == 1)
|
||||
{
|
||||
memcpy(td4, src, 0xC4);
|
||||
std::memcpy(td4, src, 0xC4);
|
||||
td4->elementsSize = srcLength - 0xC4;
|
||||
td4->elements = malloc(td4->elementsSize);
|
||||
if (td4->elements == nullptr)
|
||||
|
@ -159,7 +159,7 @@ static rct_track_td6* track_design_open_from_td4(uint8_t* src, size_t srcLength)
|
|||
SafeFree(td4);
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(td4->elements, src + 0xC4, td4->elementsSize);
|
||||
std::memcpy(td4->elements, src + 0xC4, td4->elementsSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -191,15 +191,15 @@ static rct_track_td6* track_design_open_from_td4(uint8_t* src, size_t srcLength)
|
|||
{
|
||||
const char* name = RCT1::GetRideTypeObject(td4->type);
|
||||
assert(name != nullptr);
|
||||
memcpy(vehicleObject.name, name, std::min(String::SizeOf(name), (size_t)8));
|
||||
std::memcpy(vehicleObject.name, name, std::min(String::SizeOf(name), (size_t)8));
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* name = RCT1::GetVehicleObject(td4->vehicle_type);
|
||||
assert(name != nullptr);
|
||||
memcpy(vehicleObject.name, name, std::min(String::SizeOf(name), (size_t)8));
|
||||
std::memcpy(vehicleObject.name, name, std::min(String::SizeOf(name), (size_t)8));
|
||||
}
|
||||
memcpy(&td6->vehicle_object, &vehicleObject, sizeof(rct_object_entry));
|
||||
std::memcpy(&td6->vehicle_object, &vehicleObject, sizeof(rct_object_entry));
|
||||
td6->vehicle_type = td4->vehicle_type;
|
||||
|
||||
td6->flags = td4->flags;
|
||||
|
@ -347,7 +347,7 @@ static rct_track_td6* track_design_open_from_buffer(uint8_t* src, size_t srcLeng
|
|||
log_error("Unable to allocate memory for TD6 data.");
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(td6, src, 0xA3);
|
||||
std::memcpy(td6, src, 0xA3);
|
||||
td6->elementsSize = srcLength - 0xA3;
|
||||
td6->elements = malloc(td6->elementsSize);
|
||||
if (td6->elements == nullptr)
|
||||
|
@ -356,7 +356,7 @@ static rct_track_td6* track_design_open_from_buffer(uint8_t* src, size_t srcLeng
|
|||
log_error("Unable to allocate memory for TD6 element data.");
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(td6->elements, src + 0xA3, td6->elementsSize);
|
||||
std::memcpy(td6->elements, src + 0xA3, td6->elementsSize);
|
||||
|
||||
// Cap operation setting
|
||||
td6->operation_setting = std::min(td6->operation_setting, RideProperties[td6->type].max_value);
|
||||
|
@ -378,7 +378,7 @@ static void td6_reset_trailing_elements(rct_track_td6* td6)
|
|||
lastElement = (void*)((uintptr_t)mazeElement + 1);
|
||||
|
||||
size_t trailingSize = td6->elementsSize - (size_t)((uintptr_t)lastElement - (uintptr_t)td6->elements);
|
||||
memset(lastElement, 0, trailingSize);
|
||||
std::memset(lastElement, 0, trailingSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ static void td6_reset_trailing_elements(rct_track_td6* td6)
|
|||
lastElement = (void*)((uintptr_t)trackElement + 1);
|
||||
|
||||
size_t trailingSize = td6->elementsSize - (size_t)((uintptr_t)lastElement - (uintptr_t)td6->elements);
|
||||
memset(lastElement, 0xFF, trailingSize);
|
||||
std::memset(lastElement, 0xFF, trailingSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2192,7 +2192,7 @@ void track_design_draw_preview(rct_track_td6* td6, uint8_t* pixels)
|
|||
uint8_t flags;
|
||||
if (!track_design_place_preview(td6, &cost, &rideIndex, &flags))
|
||||
{
|
||||
memset(pixels, 0, TRACK_PREVIEW_IMAGE_SIZE * 4);
|
||||
std::fill_n(pixels, TRACK_PREVIEW_IMAGE_SIZE * 4, 0x00);
|
||||
track_design_preview_restore_map(mapBackup);
|
||||
return;
|
||||
}
|
||||
|
@ -2290,8 +2290,8 @@ static map_backup* track_design_preview_backup_map()
|
|||
map_backup* backup = (map_backup*)malloc(sizeof(map_backup));
|
||||
if (backup != nullptr)
|
||||
{
|
||||
memcpy(backup->tile_elements, gTileElements, sizeof(backup->tile_elements));
|
||||
memcpy(backup->tile_pointers, gTileElementTilePointers, sizeof(backup->tile_pointers));
|
||||
std::memcpy(backup->tile_elements, gTileElements, sizeof(backup->tile_elements));
|
||||
std::memcpy(backup->tile_pointers, gTileElementTilePointers, sizeof(backup->tile_pointers));
|
||||
backup->next_free_tile_element = gNextFreeTileElement;
|
||||
backup->map_size_units = gMapSizeUnits;
|
||||
backup->map_size_units_minus_2 = gMapSizeMinus2;
|
||||
|
@ -2307,8 +2307,8 @@ static map_backup* track_design_preview_backup_map()
|
|||
*/
|
||||
static void track_design_preview_restore_map(map_backup* backup)
|
||||
{
|
||||
memcpy(gTileElements, backup->tile_elements, sizeof(backup->tile_elements));
|
||||
memcpy(gTileElementTilePointers, backup->tile_pointers, sizeof(backup->tile_pointers));
|
||||
std::memcpy(gTileElements, backup->tile_elements, sizeof(backup->tile_elements));
|
||||
std::memcpy(gTileElementTilePointers, backup->tile_pointers, sizeof(backup->tile_pointers));
|
||||
gNextFreeTileElement = backup->next_free_tile_element;
|
||||
gMapSizeUnits = backup->map_size_units;
|
||||
gMapSizeMinus2 = backup->map_size_units_minus_2;
|
||||
|
|
|
@ -62,8 +62,8 @@ void track_design_save_init()
|
|||
_trackSavedTileElementsCount = 0;
|
||||
_trackSavedTileElementsDescCount = 0;
|
||||
|
||||
memset(_trackSavedTileElements, 0, sizeof(_trackSavedTileElements));
|
||||
memset(_trackSavedTileElementsDesc, 0, sizeof(_trackSavedTileElementsDesc));
|
||||
std::memset(_trackSavedTileElements, 0, sizeof(_trackSavedTileElements));
|
||||
std::memset(_trackSavedTileElementsDesc, 0, sizeof(_trackSavedTileElementsDesc));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -669,7 +669,7 @@ static bool track_design_save_copy_scenery_to_td6(rct_track_td6* td6)
|
|||
// Copy TD6 scenery elements to new memory and add end marker
|
||||
size_t totalSceneryElementsSize = _trackSavedTileElementsDescCount * sizeof(rct_td6_scenery_element);
|
||||
td6->scenery_elements = (rct_td6_scenery_element*)malloc(totalSceneryElementsSize + 1);
|
||||
memcpy(td6->scenery_elements, _trackSavedTileElementsDesc, totalSceneryElementsSize);
|
||||
std::memcpy(td6->scenery_elements, _trackSavedTileElementsDesc, totalSceneryElementsSize);
|
||||
*((uint8_t*)&td6->scenery_elements[_trackSavedTileElementsDescCount]) = 0xFF;
|
||||
|
||||
// Run an element loop
|
||||
|
@ -762,7 +762,7 @@ static rct_track_td6* track_design_save_to_td6(uint8_t rideIndex)
|
|||
|
||||
// Note we are only copying rct_object_entry in size and
|
||||
// not the extended as we don't need the chunk size.
|
||||
memcpy(&td6->vehicle_object, object, sizeof(rct_object_entry));
|
||||
std::memcpy(&td6->vehicle_object, object, sizeof(rct_object_entry));
|
||||
|
||||
td6->ride_mode = ride->mode;
|
||||
|
||||
|
@ -1265,7 +1265,7 @@ static void auto_buffer_write(auto_buffer* buffer, const void* src, size_t len)
|
|||
|
||||
buffer->ptr = realloc(buffer->ptr, buffer->capacity);
|
||||
}
|
||||
memcpy((void*)((uintptr_t)buffer->ptr + buffer->length), src, len);
|
||||
std::memcpy((void*)((uintptr_t)buffer->ptr + buffer->length), src, len);
|
||||
buffer->length += len;
|
||||
}
|
||||
|
||||
|
|
|
@ -3107,8 +3107,8 @@ void vehicle_test_reset(rct_vehicle* vehicle)
|
|||
ride->num_sheltered_sections = 0;
|
||||
ride->highest_drop_height = 0;
|
||||
ride->special_track_elements = 0;
|
||||
memset(&ride->length, 0, 4 * 4);
|
||||
memset(&ride->time, 0, 4 * 2);
|
||||
std::fill_n(ride->length, MAX_STATIONS, 0);
|
||||
std::fill_n(ride->time, MAX_STATIONS, 0);
|
||||
ride->total_air_time = 0;
|
||||
ride->current_test_station = vehicle->current_station;
|
||||
window_invalidate_by_number(WC_RIDE, vehicle->ride);
|
||||
|
|
|
@ -52,7 +52,7 @@ void vehicle_visual_roto_drop(
|
|||
sub_98197C(session, image_id, 0, 0, 16, 16, 41, z, -5, -5, z + 1);
|
||||
|
||||
uint8_t riding_peep_sprites[64];
|
||||
memset(riding_peep_sprites, 0xFF, sizeof(riding_peep_sprites));
|
||||
std::fill_n(riding_peep_sprites, sizeof(riding_peep_sprites), 0xFF);
|
||||
for (int32_t i = 0; i < vehicle->num_peeps; i++)
|
||||
{
|
||||
uint8_t cl = (i & 3) * 16;
|
||||
|
|
|
@ -160,7 +160,7 @@ void scenario_begin()
|
|||
map_count_remaining_land_rights();
|
||||
staff_reset_stats();
|
||||
gLastEntranceStyle = 0;
|
||||
memset(gMarketingCampaignDaysLeft, 0, 20);
|
||||
std::fill_n(gMarketingCampaignDaysLeft, sizeof(gMarketingCampaignDaysLeft), 0x00);
|
||||
gParkRatingCasualtyPenalty = 0;
|
||||
|
||||
// Open park with free entry when there is no money
|
||||
|
@ -782,11 +782,9 @@ static void scenario_objective_check_park_value_by()
|
|||
static void scenario_objective_check_10_rollercoasters()
|
||||
{
|
||||
int32_t i, rcs = 0;
|
||||
uint8_t type_already_counted[256];
|
||||
uint8_t type_already_counted[256] = {};
|
||||
Ride* ride;
|
||||
|
||||
memset(type_already_counted, 0, 256);
|
||||
|
||||
FOR_ALL_RIDES (i, ride)
|
||||
{
|
||||
uint8_t subtype_id = ride->subtype;
|
||||
|
@ -881,12 +879,10 @@ static void scenario_objective_check_monthly_ride_income()
|
|||
static void scenario_objective_check_10_rollercoasters_length()
|
||||
{
|
||||
int32_t i, rcs = 0;
|
||||
uint8_t type_already_counted[256];
|
||||
uint8_t type_already_counted[256] = {};
|
||||
int16_t objective_length = gScenarioObjectiveNumGuests;
|
||||
Ride* ride;
|
||||
|
||||
memset(type_already_counted, 0, 256);
|
||||
|
||||
FOR_ALL_RIDES (i, ride)
|
||||
{
|
||||
uint8_t subtype_id = ride->subtype;
|
||||
|
|
|
@ -705,7 +705,7 @@ private:
|
|||
scenario_highscore_entry* InsertHighscore()
|
||||
{
|
||||
auto highscore = new scenario_highscore_entry();
|
||||
memset(highscore, 0, sizeof(scenario_highscore_entry));
|
||||
std::memset(highscore, 0, sizeof(scenario_highscore_entry));
|
||||
_highscores.push_back(highscore);
|
||||
return highscore;
|
||||
}
|
||||
|
|
|
@ -54,18 +54,18 @@ size_t sawyercoding_write_chunk_buffer(uint8_t* dst_file, const uint8_t* buffer,
|
|||
switch (chunkHeader.encoding)
|
||||
{
|
||||
case CHUNK_ENCODING_NONE:
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
std::memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, buffer, chunkHeader.length);
|
||||
std::memcpy(dst_file, buffer, chunkHeader.length);
|
||||
// fwrite(&chunkHeader, sizeof(sawyercoding_chunk_header), 1, file);
|
||||
// fwrite(buffer, 1, chunkHeader.length, file);
|
||||
break;
|
||||
case CHUNK_ENCODING_RLE:
|
||||
encode_buffer = (uint8_t*)malloc(0x600000);
|
||||
chunkHeader.length = (uint32_t)encode_chunk_rle(buffer, encode_buffer, chunkHeader.length);
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
std::memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, encode_buffer, chunkHeader.length);
|
||||
std::memcpy(dst_file, encode_buffer, chunkHeader.length);
|
||||
|
||||
free(encode_buffer);
|
||||
break;
|
||||
|
@ -74,20 +74,20 @@ size_t sawyercoding_write_chunk_buffer(uint8_t* dst_file, const uint8_t* buffer,
|
|||
encode_buffer2 = (uint8_t*)malloc(0x600000);
|
||||
chunkHeader.length = (uint32_t)encode_chunk_repeat(buffer, encode_buffer, chunkHeader.length);
|
||||
chunkHeader.length = (uint32_t)encode_chunk_rle(encode_buffer, encode_buffer2, chunkHeader.length);
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
std::memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, encode_buffer2, chunkHeader.length);
|
||||
std::memcpy(dst_file, encode_buffer2, chunkHeader.length);
|
||||
|
||||
free(encode_buffer2);
|
||||
free(encode_buffer);
|
||||
break;
|
||||
case CHUNK_ENCODING_ROTATE:
|
||||
encode_buffer = (uint8_t*)malloc(chunkHeader.length);
|
||||
memcpy(encode_buffer, buffer, chunkHeader.length);
|
||||
std::memcpy(encode_buffer, buffer, chunkHeader.length);
|
||||
encode_chunk_rotate(encode_buffer, chunkHeader.length);
|
||||
memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
std::memcpy(dst_file, &chunkHeader, sizeof(sawyercoding_chunk_header));
|
||||
dst_file += sizeof(sawyercoding_chunk_header);
|
||||
memcpy(dst_file, encode_buffer, chunkHeader.length);
|
||||
std::memcpy(dst_file, encode_buffer, chunkHeader.length);
|
||||
|
||||
free(encode_buffer);
|
||||
break;
|
||||
|
@ -204,12 +204,12 @@ static size_t decode_chunk_rle(const uint8_t* src_buffer, uint8_t* dst_buffer, s
|
|||
{
|
||||
i++;
|
||||
count = 257 - rleCodeByte;
|
||||
memset(dst, src_buffer[i], count);
|
||||
std::fill_n(dst, count, src_buffer[i]);
|
||||
dst = (uint8_t*)((uintptr_t)dst + count);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(dst, src_buffer + i + 1, rleCodeByte + 1);
|
||||
std::memcpy(dst, src_buffer + i + 1, rleCodeByte + 1);
|
||||
dst = (uint8_t*)((uintptr_t)dst + rleCodeByte + 1);
|
||||
i += rleCodeByte + 1;
|
||||
}
|
||||
|
@ -241,14 +241,14 @@ static size_t decode_chunk_rle_with_size(const uint8_t* src_buffer, uint8_t* dst
|
|||
count = 257 - rleCodeByte;
|
||||
assert(dst + count <= dst_buffer + dstSize);
|
||||
assert(i < length);
|
||||
memset(dst, src_buffer[i], count);
|
||||
std::fill_n(dst, count, src_buffer[i]);
|
||||
dst = (uint8_t*)((uintptr_t)dst + count);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(dst + rleCodeByte + 1 <= dst_buffer + dstSize);
|
||||
assert(i + 1 < length);
|
||||
memcpy(dst, src_buffer + i + 1, rleCodeByte + 1);
|
||||
std::memcpy(dst, src_buffer + i + 1, rleCodeByte + 1);
|
||||
dst = (uint8_t*)((uintptr_t)dst + rleCodeByte + 1);
|
||||
i += rleCodeByte + 1;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ static size_t encode_chunk_rle(const uint8_t* src_buffer, uint8_t* dst_buffer, s
|
|||
if ((count && *src == src[1]) || count > 125)
|
||||
{
|
||||
*dst++ = count - 1;
|
||||
memcpy(dst, src_norm_start, count);
|
||||
std::memcpy(dst, src_norm_start, count);
|
||||
dst += count;
|
||||
src_norm_start += count;
|
||||
count = 0;
|
||||
|
@ -308,7 +308,7 @@ static size_t encode_chunk_rle(const uint8_t* src_buffer, uint8_t* dst_buffer, s
|
|||
if (count)
|
||||
{
|
||||
*dst++ = count - 1;
|
||||
memcpy(dst, src_norm_start, count);
|
||||
std::memcpy(dst, src_norm_start, count);
|
||||
dst += count;
|
||||
}
|
||||
return dst - dst_buffer;
|
||||
|
|
|
@ -3269,14 +3269,14 @@ void map_reorganise_elements()
|
|||
;
|
||||
|
||||
num_elements = (uint32_t)(endElement - startElement);
|
||||
memcpy(new_elements_pointer, startElement, num_elements * sizeof(TileElement));
|
||||
std::memcpy(new_elements_pointer, startElement, num_elements * sizeof(TileElement));
|
||||
new_elements_pointer += num_elements;
|
||||
}
|
||||
}
|
||||
|
||||
num_elements = (uint32_t)(new_elements_pointer - new_tile_elements);
|
||||
memcpy(gTileElements, new_tile_elements, num_elements * sizeof(TileElement));
|
||||
memset(
|
||||
std::memcpy(gTileElements, new_tile_elements, num_elements * sizeof(TileElement));
|
||||
std::memset(
|
||||
gTileElements + num_elements, 0,
|
||||
(3 * (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) - num_elements) * sizeof(TileElement));
|
||||
|
||||
|
@ -3361,7 +3361,7 @@ TileElement* tile_element_insert(int32_t x, int32_t y, int32_t z, int32_t flags)
|
|||
newTileElement->base_height = z;
|
||||
newTileElement->flags = flags;
|
||||
newTileElement->clearance_height = z;
|
||||
memset(&newTileElement->pad_04, 0, sizeof(newTileElement->pad_04));
|
||||
std::memset(&newTileElement->pad_04, 0, sizeof(newTileElement->pad_04));
|
||||
newTileElement++;
|
||||
|
||||
// Insert rest of map elements above insert height
|
||||
|
@ -4469,7 +4469,7 @@ void game_command_modify_tile(
|
|||
TileElement elementToPaste;
|
||||
const int32_t data[] = { *edx, *edi };
|
||||
assert_struct_size(data, sizeof(elementToPaste));
|
||||
memcpy(&elementToPaste, data, 8);
|
||||
std::memcpy(&elementToPaste, data, 8);
|
||||
*ebx = tile_inspector_paste_element_at(x, y, elementToPaste, flags);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ void mapgen_generate(mapgen_settings* settings)
|
|||
// Create the temporary height map and initialise
|
||||
_heightSize = mapSize * 2;
|
||||
_height = new uint8_t[_heightSize * _heightSize];
|
||||
memset(_height, 0, _heightSize * _heightSize * sizeof(uint8_t));
|
||||
std::fill_n(_height, _heightSize * _heightSize, 0x00);
|
||||
|
||||
mapgen_simplex(settings);
|
||||
mapgen_smooth_height(2 + (util_rand() % 6));
|
||||
|
@ -415,7 +415,7 @@ static void mapgen_smooth_height(int32_t iterations)
|
|||
|
||||
for (i = 0; i < iterations; i++)
|
||||
{
|
||||
memcpy(copyHeight, _height, arraySize);
|
||||
std::memcpy(copyHeight, _height, arraySize);
|
||||
for (y = 1; y < _heightSize - 1; y++)
|
||||
{
|
||||
for (x = 1; x < _heightSize - 1; x++)
|
||||
|
@ -773,7 +773,7 @@ void mapgen_generate_from_heightmap(mapgen_settings* settings)
|
|||
|
||||
// Make a copy of the original height map that we can edit
|
||||
uint8_t* dest = new uint8_t[_heightMapData.width * _heightMapData.height];
|
||||
memcpy(dest, _heightMapData.mono_bitmap, _heightMapData.width * _heightMapData.width);
|
||||
std::memcpy(dest, _heightMapData.mono_bitmap, _heightMapData.width * _heightMapData.width);
|
||||
|
||||
map_init(_heightMapData.width + 2); // + 2 for the black tiles around the map
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void invalidate_sprite_2(rct_sprite* sprite)
|
|||
void reset_sprite_list()
|
||||
{
|
||||
gSavedAge = 0;
|
||||
memset(_spriteList, 0, sizeof(rct_sprite) * MAX_SPRITES);
|
||||
std::memset(_spriteList, 0, sizeof(_spriteList));
|
||||
|
||||
for (int32_t i = 0; i < NUM_SPRITE_LISTS; i++)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ static void sprite_reset(rct_sprite_generic* sprite)
|
|||
uint16_t sprite_index = sprite->sprite_index;
|
||||
_spriteFlashingList[sprite_index] = false;
|
||||
|
||||
memset(sprite, 0, sizeof(rct_sprite));
|
||||
std::memset(sprite, 0, sizeof(rct_sprite));
|
||||
|
||||
sprite->linked_list_type_offset = llto;
|
||||
sprite->next = next;
|
||||
|
|
|
@ -146,7 +146,7 @@ void TileElement::ClearAs(uint8_t newType)
|
|||
flags = 0;
|
||||
base_height = 2;
|
||||
clearance_height = 2;
|
||||
memset(pad_04, 0, sizeof(pad_04));
|
||||
std::fill_n(pad_04, sizeof(pad_04), 0x00);
|
||||
}
|
||||
|
||||
void TileElementBase::Remove()
|
||||
|
|
Loading…
Reference in New Issue