Fix MSVC build errors and warnings

This commit is contained in:
Ted John 2017-08-06 01:26:14 +01:00 committed by Michał Janiszewski
parent 2e89525888
commit f3ef92edcb
20 changed files with 52 additions and 65 deletions

View File

@ -147,6 +147,7 @@ extern "C"
/** The current shortcut being changed. */
extern uint8 gKeyboardShortcutChangeId;
extern const rct_string_id ShortcutStringIds[SHORTCUT_COUNT];
void keyboard_shortcuts_reset();
bool keyboard_shortcuts_load();

View File

@ -50,8 +50,8 @@
<ClCompile Include="UiContext.Linux.cpp" />
<ClCompile Include="UiContext.Win32.cpp" />
<ClCompile Include="WindowManager.cpp" />
<ClCompile Include="windows\shortcut_keys.c" />
<ClCompile Include="windows\shortcut_key_change.c" />
<ClCompile Include="windows\ShortcutKeys.cpp" />
<ClCompile Include="windows\ShortcutKeyChange.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="audio\AudioContext.h" />

View File

@ -24,8 +24,6 @@ extern "C"
#include <openrct2/localisation/localisation.h>
}
extern const rct_string_id ShortcutStringIds[];
#define WW 250
#define WH 60

View File

@ -90,7 +90,9 @@ static rct_window_event_list window_shortcut_events = {
window_shortcut_scrollpaint
};
const rct_string_id ShortcutStringIds[] = {
extern "C"
{
const rct_string_id ShortcutStringIds[SHORTCUT_COUNT] = {
STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW,
STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS,
STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE,
@ -156,6 +158,7 @@ const rct_string_id ShortcutStringIds[] = {
STR_LOAD_GAME,
STR_SHORTCUT_CLEAR_SCENERY,
};
}
/**
*

View File

@ -181,17 +181,6 @@ static void window_editor_bottom_toolbar_jump_back_to_invention_list_set_up() {
gfx_invalidate_screen();
}
/**
*
* rct2: 0x0066F666
*/
static void window_editor_bottom_toolbar_jump_back_to_scenario_options() {
window_close_all();
window_editor_scenario_options_open();
gS6Info.editor_step = EDITOR_STEP_OPTIONS_SELECTION;
gfx_invalidate_screen();
}
/**
*
* rct2: 0x0066F64E

View File

@ -29,6 +29,7 @@ extern "C"
#include "../sprites.h"
#include "../util/util.h"
#include "../world/scenery.h"
#include "_legacy.h"
}
#pragma region Widgets
@ -261,8 +262,6 @@ static void research_rides_setup(){
}
}
extern rct_object_entry RequiredSelectedObjects[7];
/**
*
* rct2: 0x0068590C
@ -271,7 +270,7 @@ extern rct_object_entry RequiredSelectedObjects[7];
static void research_scenery_sets_setup(){
for (size_t i = 0; i < Util::CountOf(RequiredSelectedObjects); i++) {
rct_object_entry * object = &RequiredSelectedObjects[i];
const rct_object_entry * object = &RequiredSelectedObjects[i];
uint8 entry_type, entry_index;
if (!find_object_in_entry_group(object, &entry_type, &entry_index))

View File

@ -1165,7 +1165,7 @@ static void window_editor_object_selection_invalidate(rct_window *w)
else {
for (sint32 i = 0; i < 6; i++) {
if (_filter_flags & (1 << (5 + i)))
w->pressed_widgets |= (uint64)(1 << (WIDX_FILTER_RIDE_TAB_TRANSPORT + i));
w->pressed_widgets |= (uint64)(1ULL << (WIDX_FILTER_RIDE_TAB_TRANSPORT + i));
}
}
w->widgets[WIDX_FILTER_RIDE_TAB_FRAME].type = WWT_IMGBTN;

View File

@ -958,13 +958,19 @@ static void window_guest_list_find_groups()
sint32 curr_num_guests = _window_guest_list_groups_num_guests[groupIndex];
sint32 swap_position = 0;
//This section places the groups in size order.
bool gotoNextPeep = false;
while (1) {
if (swap_position >= groupIndex)
goto nextPeep;
if (swap_position >= groupIndex) {
gotoNextPeep = true;
break;
}
if (curr_num_guests > _window_guest_list_groups_num_guests[swap_position])
break;
swap_position++;
}
if (gotoNextPeep) {
continue;
}
sint32 argument_1 = _window_guest_list_groups_argument_1[groupIndex];
sint32 argument_2 = _window_guest_list_groups_argument_2[groupIndex];
@ -992,8 +998,5 @@ static void window_guest_list_find_groups()
_window_guest_list_group_index[swap_position] = bl;
bl = temp;
} while (++swap_position <= groupIndex);
nextPeep:
;
}
}

View File

@ -1596,7 +1596,7 @@ static uint16 map_window_get_pixel_colour_peep(sint32 x, sint32 y)
if (!(mapElement->properties.surface.ownership & OWNERSHIP_OWNED))
colour = PALETTE_INDEX_10 | (colour & 0xFF00);
const sint32 maxSupportedMapElementType = Util::CountOf(ElementTypeAddColour);
const sint32 maxSupportedMapElementType = (sint32)Util::CountOf(ElementTypeAddColour);
while (!map_element_is_last_for_tile(mapElement++)) {
sint32 mapElementType = map_element_get_type(mapElement) >> 2;
if (mapElementType >= maxSupportedMapElementType) {

View File

@ -412,7 +412,7 @@ static rct_xy16 window_multiplayer_information_get_size()
height += (numLines + 1) * lineHeight;
_windowInformationSizeDirty = false;
_windowInformationSize = (rct_xy16){ (sint16) width, (sint16) height };
_windowInformationSize = { (sint16)width, (sint16)height };
return _windowInformationSize;
}

View File

@ -288,7 +288,7 @@ void window_new_ride_init_vars()
Reset what is highlighted in each tab.
Each 16bit number represents the item in its respective tab.
*/
_windowNewRideHighlightedItem[i] = (ride_list_item){ 255, 255 };
_windowNewRideHighlightedItem[i] = { 255, 255 };
}
}

View File

@ -1332,7 +1332,7 @@ static void window_options_dropdown(rct_window *w, rct_widgetindex widgetIndex,
case WINDOW_OPTIONS_PAGE_RENDERING:
switch (widgetIndex) {
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
if (dropdownIndex != gConfigGeneral.construction_marker_colour) {
if (dropdownIndex != (gConfigGeneral.construction_marker_colour ? 1 : 0)) {
gConfigGeneral.construction_marker_colour = (uint8)dropdownIndex;
config_save_default();
gfx_invalidate_screen();
@ -1565,6 +1565,7 @@ static void window_options_invalidate(rct_window *w)
break;
case WINDOW_OPTIONS_PAGE_RENDERING:
{
widget_set_checkbox_value(w, WIDX_TILE_SMOOTHING_CHECKBOX, gConfigGeneral.landscape_smoothing);
widget_set_checkbox_value(w, WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.always_show_gridlines);
widget_set_checkbox_value(w, WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.day_night_cycle);
@ -1608,6 +1609,7 @@ static void window_options_invalidate(rct_window *w)
window_options_rendering_widgets[WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX].type = WWT_CHECKBOX;
window_options_rendering_widgets[WIDX_SHOW_GUEST_PURCHASES_CHECKBOX].type = WWT_CHECKBOX;
break;
}
case WINDOW_OPTIONS_PAGE_CULTURE:
// currency: pounds, dollars, etc. (10 total)

View File

@ -4937,7 +4937,7 @@ static void window_ride_music_paint(rct_window *w, rct_drawpixelinfo *dpi)
static rct_string_id get_rating_name(ride_rating rating)
{
sint32 index = Math::Clamp<sint32>(0, rating >> 8, Util::CountOf(RatingNames) - 1);
sint32 index = Math::Clamp<sint32>(0, rating >> 8, (sint32)Util::CountOf(RatingNames) - 1);
return RatingNames[index];
}

View File

@ -380,7 +380,7 @@ static void window_ride_list_dropdown(rct_window *w, rct_widgetindex widgetIndex
uint32 arg = (uint32)gDropdownItemsArgs[dropdownIndex];
for (size_t i = 0; i < Util::CountOf(ride_info_type_string_mapping); i++) {
if (arg == ride_info_type_string_mapping[i]) {
informationType = i;
informationType = (sint32)i;
}
}

View File

@ -546,11 +546,6 @@ static sint32 window_scenery_rows_height(sint32 rows)
return rows * SCENERY_BUTTON_HEIGHT;
}
static sint32 rows_on_page(sint32 height)
{
return height / 90;
}
/**
*
* rct2: 0x006BD94C

View File

@ -590,10 +590,10 @@ static void window_tile_inspector_select_element_from_list(rct_window *w, sint32
// Get type of selected map element to select the correct page
rct_map_element *const mapElement = window_tile_inspector_get_selected_element(w);
page = (Math::Min(map_element_get_type(mapElement), MAP_ELEMENT_TYPE_CORRUPT) >> 2) + 1;
page = (Math::Min<uint32>(map_element_get_type(mapElement), MAP_ELEMENT_TYPE_CORRUPT) >> 2) + 1;
}
window_tile_inspector_set_page(w, page);
window_tile_inspector_set_page(w, (tile_inspector_page)page);
// Enable/disable buttons
window_tile_inspector_auto_set_buttons(w);
@ -914,22 +914,22 @@ static void window_tile_inspector_mouseup(rct_window *w, rct_widgetindex widgetI
window_close(w);
break;
case WIDX_SPINNER_X_INCREASE:
windowTileInspectorTileX = Math::Min(windowTileInspectorTileX + 1, 255);
windowTileInspectorTileX = Math::Min<uint32>(windowTileInspectorTileX + 1, 255);
window_tile_inspector_load_tile(w);
window_tile_inspector_auto_set_buttons(w);
break;
case WIDX_SPINNER_X_DECREASE:
windowTileInspectorTileX = Math::Max(windowTileInspectorTileX - 1, 0);
windowTileInspectorTileX = Math::Max<uint32>(windowTileInspectorTileX - 1, 0);
window_tile_inspector_load_tile(w);
window_tile_inspector_auto_set_buttons(w);
break;
case WIDX_SPINNER_Y_INCREASE:
windowTileInspectorTileY = Math::Min(windowTileInspectorTileY + 1, 255);
windowTileInspectorTileY = Math::Min<uint32>(windowTileInspectorTileY + 1, 255);
window_tile_inspector_load_tile(w);
window_tile_inspector_auto_set_buttons(w);
break;
case WIDX_SPINNER_Y_DECREASE:
windowTileInspectorTileY = Math::Max(windowTileInspectorTileY - 1, 0);
windowTileInspectorTileY = Math::Max<uint32>(windowTileInspectorTileY - 1, 0);
window_tile_inspector_load_tile(w);
window_tile_inspector_auto_set_buttons(w);
break;
@ -1624,15 +1624,15 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
}
// Draw coordinates
gfx_draw_string(dpi, "X:", COLOUR_DARK_GREEN, w->x + 6, w->y + 24);
gfx_draw_string(dpi, "Y:", COLOUR_DARK_GREEN, w->x + 64, w->y + 24);
gfx_draw_string(dpi, (char *)"X:", COLOUR_DARK_GREEN, w->x + 6, w->y + 24);
gfx_draw_string(dpi, (char *)"Y:", COLOUR_DARK_GREEN, w->x + 64, w->y + 24);
if (windowTileInspectorTileSelected) {
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &windowTileInspectorTileX, COLOUR_DARK_GREEN, w->x + 48, w->y + 24);
gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &windowTileInspectorTileY, COLOUR_DARK_GREEN, w->x + 105, w->y + 24);
}
else {
gfx_draw_string(dpi, "-", COLOUR_DARK_GREEN, w->x + 48 - 7, w->y + 24);
gfx_draw_string(dpi, "-", COLOUR_DARK_GREEN, w->x + 105 - 7, w->y + 24);
gfx_draw_string(dpi, (char *)"-", COLOUR_DARK_GREEN, w->x + 48 - 7, w->y + 24);
gfx_draw_string(dpi, (char *)"-", COLOUR_DARK_GREEN, w->x + 105 - 7, w->y + 24);
}
if (w->selected_list_item != -1) {
@ -1970,7 +1970,7 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
do {
sint32 type = map_element_get_type(mapElement);
char *typeName;
const char * typeName = "";
sint32 baseHeight = mapElement->base_height;
sint32 clearanceHeight = mapElement->clearance_height;
@ -2036,7 +2036,7 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo *
const bool broken = (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN) != 0;
const bool last = (mapElement->flags & MAP_ELEMENT_FLAG_LAST_TILE) != 0;
gfx_clip_string(buffer, w->widgets[WIDX_COLUMN_TYPE].right - w->widgets[WIDX_COLUMN_TYPE].left - COL_X_TYPE);
gfx_draw_string(dpi, typeName, COLOUR_DARK_GREEN, x + COL_X_TYPE + 3, y); // 3px padding
gfx_draw_string(dpi, (char *)typeName, COLOUR_DARK_GREEN, x + COL_X_TYPE + 3, y); // 3px padding
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &baseHeight, COLOUR_DARK_GREEN, x + COL_X_BH, y);
gfx_draw_string_left(dpi, STR_FORMAT_INTEGER, &clearanceHeight, COLOUR_DARK_GREEN, x + COL_X_CH, y);
if (ghost) gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1], x + COL_X_GF, y);

View File

@ -78,7 +78,7 @@ static sint32 _window_title_command_editor_index;
#define BUF_SIZE 50
static char textbox1Buffer[BUF_SIZE];
static char textbox2Buffer[BUF_SIZE];
static TitleCommand command = { TITLE_SCRIPT_LOAD, { .SaveIndex = 0 } };
static TitleCommand command = { TITLE_SCRIPT_LOAD, { 0 } };
static TitleSequence * _sequence = NULL;
static rct_widget window_title_command_editor_widgets[] = {

View File

@ -1905,7 +1905,7 @@ static void top_toolbar_tool_update_land(sint16 x, sint16 y){
}
sint16 tool_size = gLandToolSize;
rct_xy16 mapTile = { .x = x, .y = y };
rct_xy16 mapTile = { x, y };
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
if (tool_size == 1){
@ -2524,10 +2524,7 @@ static void top_toolbar_tool_update_scenery(sint16 x, sint16 y){
rct_xy16* selectedTile = gMapSelectionTiles;
for (rct_large_scenery_tile* tile = scenery->large_scenery.tiles; tile->x_offset != (sint16)(uint16)0xFFFF; tile++){
rct_xy16 tileLocation = {
.x = tile->x_offset,
.y = tile->y_offset
};
rct_xy16 tileLocation = { tile->x_offset, tile->y_offset };
rotate_map_coordinates(&tileLocation.x, &tileLocation.y, (parameter1 >> 8) & 0xFF);
@ -2538,7 +2535,7 @@ static void top_toolbar_tool_update_scenery(sint16 x, sint16 y){
selectedTile->y = tileLocation.y;
selectedTile++;
}
selectedTile->x = 0xFFFF;
selectedTile->x = -1;
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
map_invalidate_map_selection_tiles();
@ -2656,7 +2653,7 @@ static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIn
gMapSelectPositionA.x,
1,
gMapSelectPositionA.y,
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
((gClearSmallScenery ? 1 : 0) | (gClearLargeScenery ? 1 : 0) << 1 | (gClearFootpath ? 1 : 0) << 2),
GAME_COMMAND_CLEAR_SCENERY,
gMapSelectPositionB.x,
gMapSelectPositionB.y
@ -2791,7 +2788,7 @@ static void window_top_toolbar_water_tool_drag(sint16 x, sint16 y)
if (!viewport)
return;
sint16 dx = 0xFFF0;
sint16 dx = (sint16)(uint16)0xFFF0;
dx >>= viewport->zoom;
y -= gInputDragLastY;
@ -2859,7 +2856,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, rct_widgetindex widgetIn
gMapSelectPositionA.x,
1,
gMapSelectPositionA.y,
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
((gClearSmallScenery ? 1 : 0) | (gClearLargeScenery ? 1 : 0) << 1 | (gClearFootpath ? 1 : 0) << 2),
GAME_COMMAND_CLEAR_SCENERY,
gMapSelectPositionB.x,
gMapSelectPositionB.y

View File

@ -175,7 +175,7 @@ static void _window_track_place_open(const track_design_file_ref *tdFileRef)
window_push_others_right(w);
show_gridlines();
_window_track_place_last_cost = MONEY32_UNDEFINED;
_window_track_place_last_x = 0xFFFF;
_window_track_place_last_x = -1;
_currentTrackPieceDirection = (2 - get_current_rotation()) & 3;
window_track_place_clear_mini_preview();
@ -215,14 +215,14 @@ static void window_track_place_mouseup(rct_window *w, rct_widgetindex widgetInde
window_track_place_clear_provisional();
_currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3;
window_invalidate(w);
_window_track_place_last_x = 0xFFFF;
_window_track_place_last_x = -1;
window_track_place_draw_mini_preview(_trackDesign);
break;
case WIDX_MIRROR:
track_design_mirror(_trackDesign);
_currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3;
window_invalidate(w);
_window_track_place_last_x = 0xFFFF;
_window_track_place_last_x = -1;
window_track_place_draw_mini_preview(_trackDesign);
break;
case WIDX_SELECT_DIFFERENT_DESIGN:
@ -605,9 +605,9 @@ static void window_track_place_draw_mini_preview_maze(rct_track_td6 *td6, sint32
static rct_xy16 draw_mini_preview_get_pixel_position(sint16 x, sint16 y)
{
return (rct_xy16) {
(sint16) (80 + ((y / 32) - (x / 32)) * 4),
(sint16) (38 + ((y / 32) + (x / 32)) * 2)
return {
(sint16)(80 + ((y / 32) - (x / 32)) * 4),
(sint16)(38 + ((y / 32) + (x / 32)) * 2)
};
}

View File

@ -320,7 +320,7 @@ typedef struct rct_xy16 {
} rct_xy16;
assert_struct_size(rct_xy16, 4);
#define MakeXY16(x, y) ((rct_xy16) {(sint16)(x), (sint16)(y)} )
#define MakeXY16(x, y) {(sint16)(x), (sint16)(y)}
typedef struct rct_xyz16 {
sint16 x, y, z;