More warning fixes, more warnings disabled

This commit is contained in:
Ted John 2017-01-12 13:12:53 +00:00
parent ca9c3cc5ee
commit 13a8eee1b4
12 changed files with 45 additions and 35 deletions

View File

@ -29,10 +29,12 @@
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4091;4100;4201;4204;4206;4221;4244;4245;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>4091;4100;4132;4200;4201;4204;4206;4221;4244;4245;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<!-- Warnings:
C4091: 'keyword': ignored on left of 'type' when no variable is declared
C4100: 'identifier': unreferenced formal parameter
C4132: 'identifier': const object should be initialized
C4200: nonstandard extension used: zero-sized array in struct/union
C4201: nonstandard extension used: nameless struct/union
C4204: nonstandard extension used: non-constant aggregate initializer
C4206: nonstandard extension used: translation unit is empty

View File

@ -323,7 +323,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
currentCode = (rle_code*)dst;
dst += 2;
int startX = 0;
int pixels = 0;
int npixels = 0;
bool pushRun = false;
for (unsigned int x = 0; x < width; x++) {
int paletteIndex = get_palette_index(src);
@ -378,24 +378,24 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
src += 4;
if (paletteIndex == -1) {
if (pixels != 0) {
if (npixels != 0) {
x--;
src -= 4;
pushRun = true;
}
} else {
if (pixels == 0)
if (npixels == 0)
startX = x;
pixels++;
npixels++;
*dst++ = (uint8)paletteIndex;
}
if (pixels == 127 || x == width - 1)
if (npixels == 127 || x == width - 1)
pushRun = true;
if (pushRun) {
if (pixels > 0) {
if (npixels > 0) {
previousCode = currentCode;
currentCode->num_pixels = pixels;
currentCode->num_pixels = npixels;
currentCode->offset_x = startX;
if (x == width - 1)
@ -413,7 +413,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
}
}
startX = 0;
pixels = 0;
npixels = 0;
pushRun = false;
}
}

View File

@ -42,6 +42,9 @@ static uint32 _allocatedImageCount;
#ifdef DEBUG
static std::list<ImageList> _allocatedLists;
#pragma warning(push)
#pragma warning(disable : 4505)
static bool AllocatedListContains(uint32 baseImageId, uint32 count)
{
bool contains = std::any_of(
@ -54,6 +57,8 @@ static bool AllocatedListContains(uint32 baseImageId, uint32 count)
return contains;
}
#pragma warning(pop)
static bool AllocatedListRemove(uint32 baseImageId, uint32 count)
{
auto foundItem = std::find_if(

View File

@ -154,7 +154,7 @@ void chat_draw(rct_drawpixelinfo * dpi)
y = _chatBottom - inputLineHeight - 5;
lineCh = lineBuffer;
int inputLineHeight = gfx_draw_string_left_wrapped(dpi, (void*)&lineCh, x, y + 3, _chatWidth - 10, STR_STRING, TEXT_COLOUR_255);
inputLineHeight = gfx_draw_string_left_wrapped(dpi, (void*)&lineCh, x, y + 3, _chatWidth - 10, STR_STRING, TEXT_COLOUR_255);
gfx_set_dirty_blocks(x, y, x + _chatWidth, y + inputLineHeight + 15);
//TODO: Show caret if the input text have multiple lines

View File

@ -319,14 +319,14 @@ void console_writeline(const utf8 *src)
void console_writeline_error(const utf8 *src)
{
safe_strcpy(_consoleErrorBuffer + 1, src, CONSOLE_BUFFER_2_SIZE - 1);
_consoleErrorBuffer[0] = (utf8)FORMAT_RED;
_consoleErrorBuffer[0] = (utf8)(uint8)FORMAT_RED;
console_writeline(_consoleErrorBuffer);
}
void console_writeline_warning(const utf8 *src)
{
safe_strcpy(_consoleErrorBuffer + 1, src, CONSOLE_BUFFER_2_SIZE - 1);
_consoleErrorBuffer[0] = (utf8)FORMAT_YELLOW;
_consoleErrorBuffer[0] = (utf8)(uint8)FORMAT_YELLOW;
console_writeline(_consoleErrorBuffer);
}

View File

@ -254,7 +254,7 @@ int cmdline_for_screenshot(const char **argv, int argc)
bool customLocation = false;
bool centreMapX = false;
bool centreMapY = false;
int resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation;
int resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation = 0;
const char *inputPath = argv[0];
const char *outputPath = argv[1];

View File

@ -125,8 +125,8 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view
// If the start location was invalid
// propagate the invalid location to the output.
// This fixes a bug that caused the game to enter an infinite loop.
if (start_x == (sint16)0x8000){
*out_x = (sint16)0x8000;
if (start_x == ((sint16)(uint16)0x8000)){
*out_x = ((sint16)(uint16)0x8000);
*out_y = 0;
return;
}
@ -554,9 +554,9 @@ void viewport_update_position(rct_window *window)
if (at_map_edge_x || at_map_edge_y) {
// The &0xFFFF is to prevent the sign extension messing the
// function up.
int z = map_element_height(x & 0xFFFF, y & 0xFFFF);
int zz = map_element_height(x & 0xFFFF, y & 0xFFFF);
int _2d_x, _2d_y;
center_2d_coordinates(x, y, z, &_2d_x, &_2d_y, viewport);
center_2d_coordinates(x, y, zz, &_2d_x, &_2d_y, viewport);
if (at_map_edge_x)
window->saved_view_x = _2d_x;
@ -776,7 +776,7 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo * dpi)
void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction)
{
screen_get_map_xy(*x, *y, x, y, NULL);
if (*x == (sint16)0x8000)
if (*x == MAP_LOCATION_NULL)
return;
int my_direction;
@ -818,7 +818,7 @@ rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16
rct_xy16 viewport_coord_to_map_coord(int x, int y, int z)
{
rct_xy16 ret;
rct_xy16 ret = { 0 };
switch (get_current_rotation()) {
case 0:
ret.x = -x / 2 + y + z;
@ -1529,7 +1529,7 @@ void screen_get_map_xy_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *
void screen_get_map_xy_quadrant(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *quadrant)
{
screen_get_map_xy(screenX, screenY, mapX, mapY, NULL);
if (*mapX == (sint16)0x8000)
if (*mapX == MAP_LOCATION_NULL)
return;
*quadrant = map_get_tile_quadrant(*mapX, *mapY);
@ -1544,7 +1544,7 @@ void screen_get_map_xy_quadrant(sint16 screenX, sint16 screenY, sint16 *mapX, si
void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *quadrant)
{
screen_get_map_xy_with_z(screenX, screenY, z, mapX, mapY);
if (*mapX == (sint16)0x8000)
if (*mapX == MAP_LOCATION_NULL)
return;
*quadrant = map_get_tile_quadrant(*mapX, *mapY);
@ -1559,7 +1559,7 @@ void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z,
void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *side)
{
screen_get_map_xy(screenX, screenY, mapX, mapY, NULL);
if (*mapX == (sint16)0x8000)
if (*mapX == MAP_LOCATION_NULL)
return;
*side = map_get_tile_side(*mapX, *mapY);
@ -1574,7 +1574,7 @@ void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16
void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *side)
{
screen_get_map_xy_with_z(screenX, screenY, z, mapX, mapY);
if (*mapX == (sint16)0x8000)
if (*mapX == MAP_LOCATION_NULL)
return;
*side = map_get_tile_side(*mapX, *mapY);

View File

@ -556,7 +556,7 @@ static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDist
closestPeep = NULL;
closestDistance = 0xFFFF;
FOR_ALL_PEEPS(spriteIndex, peep) {
if (peep->sprite_left == (sint16)0x8000)
if (peep->sprite_left == (sint16)(uint16)0x8000)
continue;
distance =

View File

@ -456,7 +456,7 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
int r = w->x + widget->right;
// TODO: -2 seems odd
if (widget->text == (rct_string_id)0xFFFFFFFE || widget->text == STR_NONE)
if (widget->text == (rct_string_id)-2 || widget->text == STR_NONE)
return;
if (widget_is_disabled(w, widgetIndex))
@ -1115,7 +1115,7 @@ static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
}
if (gTextBoxFrameNo <= 15){
uint8 colour = ColourMapA[w->colours[1]].mid_light;
colour = ColourMapA[w->colours[1]].mid_light;
gfx_fill_rect(dpi, cur_x, t + 9, cur_x + width, t + 9, colour + 5);
}
}

View File

@ -601,8 +601,8 @@ rct_window *window_create_auto_pos(int width, int height, rct_window_event_list
if (w->flags & WF_STICK_TO_BACK)
continue;
int x = w->x + w->width + 2;
int y = w->y;
x = w->x + w->width + 2;
y = w->y;
if (sub_6EA934(x, y, width, height)) goto foundSpace;
x = w->x - w->width - 2;
@ -639,8 +639,8 @@ rct_window *window_create_auto_pos(int width, int height, rct_window_event_list
if (w->flags & WF_STICK_TO_BACK)
continue;
int x = w->x + w->width + 2;
int y = w->y;
x = w->x + w->width + 2;
y = w->y;
if (sub_6EA8EC(x, y, width, height)) goto foundSpace;
x = w->x - w->width - 2;
@ -1499,7 +1499,10 @@ void window_zoom_set(rct_window *w, int zoomLevel, bool atCursor)
return;
// Zooming to cursor? Remember where we're pointing at the moment.
sint16 saved_map_x, saved_map_y, offset_x, offset_y;
sint16 saved_map_x = 0;
sint16 saved_map_y = 0;
sint16 offset_x = 0;
sint16 offset_y = 0;
if (gConfigGeneral.zoom_to_cursor && atCursor) {
window_viewport_get_map_coords_by_cursor(w, &saved_map_x, &saved_map_y, &offset_x, &offset_y);
}

View File

@ -32,7 +32,7 @@ int rct2_to_utf8(utf8 *dst, const char *src)
utf8 *start = dst;
const char *ch = src;
while (*ch != 0) {
if (*ch == (char)0xFF) {
if (*ch == (char)(uint8)0xFF) {
ch++;
// Read wide char
@ -60,7 +60,7 @@ int utf8_to_rct2(char *dst, const utf8 *src)
if (codepoint < 256) {
*dst++ = (char)codepoint;
} else if (codepoint <= 0xFFFF) {
*dst++ = (char)0xFF;
*dst++ = (char)(uint8)0xFF;
*dst++ = (codepoint >> 8) & 0xFF;
*dst++ = codepoint & 0xFF;
}

View File

@ -20,8 +20,8 @@
#include "../common.h"
#include "map.h"
#define DECRYPT_MONEY(money) rol32((money) ^ 0xF4EC9621, 13)
#define ENCRYPT_MONEY(money) (ror32((money), 13) ^ 0xF4EC9621)
#define DECRYPT_MONEY(money) ((money32)rol32((money) ^ 0xF4EC9621, 13))
#define ENCRYPT_MONEY(money) ((money32)(ror32((money), 13) ^ 0xF4EC9621))
enum {
PARK_FLAGS_PARK_OPEN = (1 << 0),