Merge pull request #3016 from janisozaur/fixes

Fixes
This commit is contained in:
Ted John 2016-02-26 13:27:22 +00:00
commit 9a9442ad01
15 changed files with 35 additions and 29 deletions

View File

@ -60,9 +60,9 @@ void audio_init()
if (result >= 0)
return;
log_fatal("SDL_Init %s", SDL_GetError());
exit(-1);
}
log_fatal("SDL_Init %s", SDL_GetError());
exit(-1);
}
void audio_quit()
{
@ -268,9 +268,9 @@ void audio_init_ride_sounds_and_info()
if (file == NULL)
continue;
uint32 head;
SDL_RWread(file, &head, sizeof(head), 1);
SDL_RWclose(file);
uint32 head;
SDL_RWread(file, &head, sizeof(head), 1);
SDL_RWclose(file);
if (head == 0x78787878)
rideMusicInfo->length = 0;
}
@ -330,7 +330,7 @@ void audio_stop_vehicle_sounds()
if (gOpenRCT2Headless || RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) == -1)
return;
for (int i = 0; i < countof(gVehicleSoundList); i++) {
for (int i = 0; i < countof(gVehicleSoundList); i++) {
rct_vehicle_sound *vehicleSound = &gVehicleSoundList[i];
if (vehicleSound->id == 0xFFFF)
continue;

View File

@ -1092,7 +1092,7 @@ static const utf8 *ttf_process_format_code(rct_drawpixelinfo *dpi, const utf8 *t
break;
case FORMAT_ADJUST_PALETTE:
{
uint16 eax = palette_to_g1_offset[*nextCh++];
uint16 eax = palette_to_g1_offset[(uint8)*nextCh++];
rct_g1_element *g1Element = &g1Elements[eax];
uint32 ebx = g1Element->offset[249] + 256;
if (!(info->flags & TEXT_DRAW_FLAG_OUTLINE)) {

View File

@ -102,7 +102,7 @@ void game_handle_edge_scroll();
void game_handle_key_scroll();
static void input_widget_left(int x, int y, rct_window *w, int widgetIndex);
void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_window* w, rct_widget* widget);
void sub_6ED990(char cursor_id);
void sub_6ED990(uint8 cursor_id);
static void input_window_position_continue(rct_window *w, int lastX, int lastY, int newX, int newY);
static void input_window_position_end(rct_window *w, int x, int y);
static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int y);
@ -1548,7 +1548,7 @@ int get_next_key()
*
* rct2: 0x006ED990
*/
void sub_6ED990(char cursor_id){
void sub_6ED990(uint8 cursor_id){
if (gInputState == INPUT_STATE_RESIZING)
{
cursor_id = CURSOR_DIAGONAL_ARROWS; //resize icon

View File

@ -1134,7 +1134,7 @@ rct_window *window_bring_to_front(rct_window *w)
if (!(v->flags & WF_STICK_TO_FRONT))
break;
if (v >= g_window_list && w != v) {
if (v >= g_window_list && w != v) {
do {
t = *w;
*w = *(w + 1);

View File

@ -148,7 +148,7 @@ public:
uint16 size;
std::shared_ptr<std::vector<uint8>> data;
int transferred;
unsigned int transferred;
int read;
};

View File

@ -115,7 +115,7 @@ static void object_list_sort()
{
rct_object_entry **objectBuffer, *newBuffer, *entry, *destEntry, *lowestEntry = NULL;
rct_object_filters *newFilters = NULL, *destFilter = NULL;
int numObjects, i, j, bufferSize, entrySize, lowestIndex;
int numObjects, i, j, bufferSize, entrySize, lowestIndex = 0;
char *objectName, *lowestString;
uint8 *copied;
@ -258,7 +258,10 @@ void object_list_load()
uint64 totalFileSize;
file_info enumFileInfo;
object_list_query_directory(&totalFiles, &totalFileSize, &fileDateModifiedChecksum);
int ok = object_list_query_directory(&totalFiles, &totalFileSize, &fileDateModifiedChecksum);
if (ok != 1) {
return;
}
// Would move this into cache load, but its used further on
totalFiles = ror32(totalFiles, 24);

View File

@ -120,7 +120,7 @@ void platform_free();
void platform_trigger_resize();
void platform_update_palette(const uint8 *colours, int start_index, int num_colours);
void platform_set_fullscreen_mode(int mode);
void platform_set_cursor(char cursor);
void platform_set_cursor(uint8 cursor);
void platform_refresh_video();
void platform_process_messages();
int platform_scancode_to_rct_keycode(int sdl_key);

View File

@ -159,7 +159,7 @@ void platform_update_fullscreen_resolutions()
void platform_get_closest_resolution(int inWidth, int inHeight, int *outWidth, int *outHeight)
{
int i, destinationArea, areaDiff, closestAreaDiff, closestWidth, closestHeight;
int i, destinationArea, areaDiff, closestAreaDiff, closestWidth = 640, closestHeight = 480;
closestAreaDiff = -1;
destinationArea = inWidth * inHeight;
@ -909,7 +909,7 @@ void platform_set_fullscreen_mode(int mode)
* derfererence the cursor before the function.
* rct2: 0x0407956
*/
void platform_set_cursor(char cursor)
void platform_set_cursor(uint8 cursor)
{
RCT2_GLOBAL(RCT2_ADDRESS_CURENT_CURSOR, uint8) = cursor;
SDL_SetCursor(_cursors[cursor]);

View File

@ -4174,8 +4174,8 @@ static void vehicle_update_crash(rct_vehicle *vehicle){
curVehicle->var_4E++;
if ((scenario_rand() & 0xFFFF) <= 0x1555) {
sprite_misc_3_create(
curVehicle->x + (scenario_rand() & 2 - 1),
curVehicle->y + (scenario_rand() & 2 - 1),
curVehicle->x + ((scenario_rand() & 2) - 1),
curVehicle->y + ((scenario_rand() & 2) - 1),
curVehicle->z
);
}

View File

@ -264,7 +264,7 @@ static void window_loadsave_close(rct_window *w)
static void window_loadsave_mouseup(rct_window *w, int widgetIndex)
{
int result;
int result = 0;
char path[MAX_PATH], filter[MAX_PATH];
switch (widgetIndex){

View File

@ -527,7 +527,7 @@ static void window_map_scrollgetsize(rct_window *w, int scrollIndex, int *width,
*/
static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, int y)
{
int mapX, mapY, mapZ;
int mapX = 0, mapY = 0, mapZ = 0;
rct_window *mainWindow;
map_window_screen_to_map(x, y, &mapX, &mapY);
@ -1603,7 +1603,7 @@ static uint16 map_window_get_pixel_colour_ride(int x, int y)
static void map_window_set_pixels(rct_window *w)
{
uint16 colour = 0, *destination;
int x, y, dx, dy;
int x = 0, y = 0, dx = 0, dy = 0;
destination = (uint16*)((RCT2_GLOBAL(0x00F1AD6C, uint32) * 511) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32) + 255);
switch (get_current_rotation()) {

View File

@ -986,7 +986,7 @@ static void window_ride_draw_tab_main(rct_drawpixelinfo *dpi, rct_window *w)
int widgetIndex = WIDX_TAB_1 + WINDOW_RIDE_PAGE_MAIN;
if (!(w->disabled_widgets & (1LL << widgetIndex))) {
int spriteIndex;
int spriteIndex = 0;
int rideType = get_ride(w->number)->type;
switch (gRideClassifications[rideType]) {
@ -1550,6 +1550,9 @@ static void window_ride_init_viewport(rct_window *w)
coordinate_focus coordinate;
} focus;
focus.coordinate.x = 0;
focus.coordinate.y = 0;
focus.coordinate.z = 0;
focus.sprite.sprite_id = -1;
focus.coordinate.zoom = 0;
focus.coordinate.rotation = get_current_rotation();
@ -1846,7 +1849,7 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
static void window_ride_show_open_dropdown(rct_window *w, rct_widget *widget)
{
rct_ride *ride;
int numItems, highlightedIndex, checkedIndex;
int numItems, highlightedIndex = 0, checkedIndex;
ride = get_ride(w->number);
@ -1938,7 +1941,7 @@ static void window_ride_main_mousedown(int widgetIndex, rct_window *w, rct_widge
static void window_ride_main_dropdown(rct_window *w, int widgetIndex, int dropdownIndex)
{
rct_ride *ride;
int status;
int status = 0;
switch (widgetIndex) {
case WIDX_VIEW_DROPDOWN:
@ -2687,7 +2690,7 @@ static void window_ride_vehicle_scrollpaint(rct_window *w, rct_drawpixelinfo *dp
rct_ride *ride;
rct_ride_entry *rideEntry;
rct_widget *widget;
int x, y, startX, startY, i, j, vehicleColourIndex, spriteIndex;
int x, y, startX, startY, i, j, vehicleColourIndex = 0, spriteIndex;
rct_vehichle_paintinfo *nextSpriteToDraw, *current, tmp;
vehicle_colour vehicleColour;

View File

@ -2392,7 +2392,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = mapTile.y;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = mapTile.x;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = mapTile.y;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 10 + parameter2 & 0xFF;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 10 + (parameter2 & 0xFF);
map_invalidate_selection_rect();

View File

@ -1304,7 +1304,7 @@ void footpath_connect_edges(int x, int y, rct_map_element *mapElement, int flags
void footpath_chain_ride_queue(int rideIndex, int entranceIndex, int x, int y, rct_map_element *mapElement, int direction)
{
rct_map_element *lastPathElement, *lastQueuePathElement;
int lastPathX, lastPathY, lastPathDirection;
int lastPathX = x, lastPathY = y, lastPathDirection = direction;
lastPathElement = NULL;
lastQueuePathElement = NULL;

View File

@ -392,7 +392,7 @@ int map_element_height(int x, int y)
// Remove the extra height bit
slope &= 0xF;
sint8 quad, quad_extra; // which quadrant the element is in?
sint8 quad = 0, quad_extra = 0; // which quadrant the element is in?
// quad_extra is for extra height tiles
uint8 xl, yl; // coordinates across this tile