1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Apply recommended fixes

This commit is contained in:
Marijn van der Werf
2017-09-23 12:35:05 +02:00
parent 7795ec35dd
commit 9d80f7efed
4 changed files with 22 additions and 28 deletions

View File

@@ -35,7 +35,7 @@ typedef struct TITLE_COMMAND_ORDER {
rct_string_id descStringId;
} TITLE_COMMAND_ORDER;
static TITLE_COMMAND_ORDER window_title_command_editor_orders[] = {
static TITLE_COMMAND_ORDER _window_title_command_editor_orders[] = {
{ TITLE_SCRIPT_LOAD, STR_TITLE_EDITOR_ACTION_LOAD, STR_TITLE_EDITOR_ARGUMENT_SAVEFILE },
{ TITLE_SCRIPT_LOCATION, STR_TITLE_EDITOR_COMMAND_TYPE_LOCATION, STR_TITLE_EDITOR_ARGUMENT_COORDINATES },
{ TITLE_SCRIPT_ROTATE, STR_TITLE_EDITOR_COMMAND_TYPE_ROTATE, STR_TITLE_EDITOR_ARGUMENT_ROTATIONS },
@@ -148,7 +148,7 @@ static rct_window_event_list window_title_command_editor_events = {
static sint32 get_command_info_index(sint32 index)
{
for (sint32 i = 0; i < NUM_COMMANDS; i++) {
if (window_title_command_editor_orders[i].command == index)
if (_window_title_command_editor_orders[i].command == index)
return i;
}
return 0;
@@ -157,10 +157,10 @@ static sint32 get_command_info_index(sint32 index)
static TITLE_COMMAND_ORDER get_command_info(sint32 index)
{
for (sint32 i = 0; i < NUM_COMMANDS; i++) {
if (window_title_command_editor_orders[i].command == index)
return window_title_command_editor_orders[i];
if (_window_title_command_editor_orders[i].command == index)
return _window_title_command_editor_orders[i];
}
return window_title_command_editor_orders[0];
return _window_title_command_editor_orders[0];
}
static rct_xy16 get_location()
@@ -319,7 +319,7 @@ static void window_title_command_editor_mousedown(rct_window *w, rct_widgetindex
sint32 numItems = NUM_COMMANDS;
for (sint32 i = 0; i < numItems; i++) {
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = window_title_command_editor_orders[i].nameStringId;
gDropdownItemsArgs[i] = _window_title_command_editor_orders[i].nameStringId;
}
window_dropdown_show_text_custom_width(
@@ -387,7 +387,7 @@ static void window_title_command_editor_dropdown(rct_window *w, rct_widgetindex
if (dropdownIndex == get_command_info_index(command.Type)) {
break;
}
command.Type = window_title_command_editor_orders[dropdownIndex].command;
command.Type = _window_title_command_editor_orders[dropdownIndex].command;
switch (command.Type) {
case TITLE_SCRIPT_LOCATION:
{

View File

@@ -181,7 +181,7 @@ rct_window * window_track_place_open(const track_design_file_ref *tdFileRef)
_trackDesign = td6;
return w;
return w;
}
/**

View File

@@ -2,19 +2,13 @@
#define OPENRCT2_INTENT_H
#include "../common.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "../interface/window.h"
#ifdef __cplusplus
}
#include <map>
#endif // __cplusplus
#ifdef __cplusplus
#include <map>
struct IntentData
{
enum DATATYPE { DT_UINT, DT_SINT, DT_STRING, DT_POINTER } type;
@@ -42,15 +36,15 @@ public:
Intent * putExtra(uint32 key, sint32 value);
Intent * putExtra(uint32 key, utf8string value);
};
#else
typedef void Intent;
#endif
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#ifndef __cplusplus
typedef int Intent;
#endif // !__cplusplus
enum
{
INTENT_EXTRA_GUEST_LIST_FILTER,

View File

@@ -95,7 +95,7 @@ static rct_window_event_list window_object_load_error_events = {
window_object_load_error_scrollpaint
};
static rct_object_entry * invalid_entries = nullptr;
static rct_object_entry * _invalid_entries = nullptr;
static sint32 highlighted_index = -1;
static utf8* file_path = nullptr;
@@ -172,7 +172,7 @@ static utf8* combine_object_names(rct_window *w)
for (uint16 i = 0; i < w->no_list_items; i++) {
cur_len += (8 + line_sep_len);
assert(cur_len < buffer_len);
strncat(buffer, invalid_entries[i].name, 8);
strncat(buffer, _invalid_entries[i].name, 8);
strncat(buffer, PLATFORM_NEWLINE, line_sep_len);
}
return buffer;
@@ -181,8 +181,8 @@ static utf8* combine_object_names(rct_window *w)
rct_window * window_object_load_error_open(utf8 * path, size_t numMissingObjects, const rct_object_entry * missingObjects)
{
size_t missingObjectsSize = numMissingObjects * sizeof(rct_object_entry);
invalid_entries = Memory::AllocateArray<rct_object_entry>(numMissingObjects);
memcpy(invalid_entries, missingObjects, missingObjectsSize);
_invalid_entries = Memory::AllocateArray<rct_object_entry>(numMissingObjects);
memcpy(_invalid_entries, missingObjects, missingObjectsSize);
// Check if window is already open
rct_window * window = window_bring_to_front_by_class(WC_OBJECT_LOAD_ERROR);
@@ -214,7 +214,7 @@ rct_window * window_object_load_error_open(utf8 * path, size_t numMissingObjects
static void window_object_load_error_close(rct_window *w)
{
SafeFree(invalid_entries);
SafeFree(_invalid_entries);
}
static void window_object_load_error_update(rct_window *w)
@@ -236,7 +236,7 @@ static void window_object_load_error_mouseup(rct_window *w, rct_widgetindex widg
break;
case WIDX_COPY_CURRENT:
if (w->selected_list_item > -1) {
selected_name = strndup(invalid_entries[w->selected_list_item].name, 8);
selected_name = strndup(_invalid_entries[w->selected_list_item].name, 8);
platform_place_string_on_clipboard(selected_name);
SafeFree(selected_name);
}
@@ -321,14 +321,14 @@ static void window_object_load_error_scrollpaint(rct_window *w, rct_drawpixelinf
gfx_fill_rect(dpi, 0, y, list_width, y + LIST_ITEM_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000);
// Draw the actual object entry's name...
gfx_draw_string(dpi, strndup(invalid_entries[i].name, 8), COLOUR_DARK_GREEN, NAME_COL_LEFT, y);
gfx_draw_string(dpi, strndup(_invalid_entries[i].name, 8), COLOUR_DARK_GREEN, NAME_COL_LEFT, y);
// ... source game ...
rct_string_id sourceStringId = object_manager_get_source_game_string(&invalid_entries[i]);
rct_string_id sourceStringId = object_manager_get_source_game_string(&_invalid_entries[i]);
gfx_draw_string_left(dpi, sourceStringId, nullptr, COLOUR_DARK_GREEN, SOURCE_COL_LEFT, y);
// ... and type
rct_string_id type = get_object_type_string(&invalid_entries[i]);
rct_string_id type = get_object_type_string(&_invalid_entries[i]);
gfx_draw_string_left(dpi, type, nullptr, COLOUR_DARK_GREEN, TYPE_COL_LEFT, y);
}
}