1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Merge pull request #3004 from janisozaur/new-compilers

Fixes for upcoming GCC6 & Clang 3.8
This commit is contained in:
Duncan
2016-02-25 18:37:27 +00:00
5 changed files with 16 additions and 11 deletions

View File

@@ -883,7 +883,7 @@ static rct_window *ride_create_or_find_construction_window(int rideIndex)
int ride_create_ride(ride_list_item listItem)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
edx = *((uint16*)&listItem);
edx = listItem.ride_type_and_entry;
eax = 0;
ecx = 0;
ebx = GAME_COMMAND_FLAG_APPLY;
@@ -4355,7 +4355,7 @@ rct_vehicle *vehicle_create_car(
vehicle->track_x = x;
vehicle->track_y = y;
vehicle->track_z = z;
vehicle->current_station = (mapElement->properties.track.sequence & 0x70) << 4;
vehicle->current_station = map_get_station(mapElement);
z += RCT2_GLOBAL(0x0097D21A + (ride->type * 8), sint8);

View File

@@ -44,8 +44,13 @@ typedef struct {
* Couples a ride type and subtype together.
*/
typedef struct {
uint8 type;
uint8 entry_index;
union {
struct {
uint8 type;
uint8 entry_index;
};
uint16 ride_type_and_entry;
};
} ride_list_item;
typedef struct {

View File

@@ -693,7 +693,7 @@ static void window_new_ride_scrollmousedown(rct_window *w, int scrollIndex, int
return;
RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item;
w->new_ride.selected_ride_id = *((sint16*)&item);
w->new_ride.selected_ride_id = item.ride_type_and_entry;
audio_play_sound_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
w->new_ride.selected_ride_countdown = 8;
@@ -713,10 +713,10 @@ static void window_new_ride_scrollmouseover(rct_window *w, int scrollIndex, int
item = window_new_ride_scroll_get_ride_list_item_at(w, x, y);
if (w->new_ride.highlighted_ride_id == *((sint16*)&item))
if (w->new_ride.highlighted_ride_id == item.ride_type_and_entry)
return;
w->new_ride.highlighted_ride_id = *((sint16*)&item);
w->new_ride.highlighted_ride_id = item.ride_type_and_entry;
RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, ride_list_item)[_window_new_ride_current_tab] = item;
window_invalidate(w);
}
@@ -765,7 +765,7 @@ static void window_new_ride_paint(rct_window *w, rct_drawpixelinfo *dpi)
window_new_ride_draw_tab_images(dpi, w);
if (_window_new_ride_current_tab != WINDOW_NEW_RIDE_PAGE_RESEARCH) {
ride_list_item item = *((ride_list_item*)&w->new_ride.highlighted_ride_id);
ride_list_item item = { .ride_type_and_entry = w->new_ride.highlighted_ride_id };
if (item.type != 255 || item.entry_index != 255)
window_new_ride_paint_ride_information(w, dpi, item, w->x + 3, w->y + w->height - 52, w->width - 6);
} else {
@@ -934,7 +934,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
*/
static void window_new_ride_select(rct_window *w)
{
ride_list_item item = *((ride_list_item*)&w->new_ride.selected_ride_id);
ride_list_item item = { .ride_type_and_entry = w->new_ride.selected_ride_id };
if (item.type == 255)
return;

View File

@@ -1151,7 +1151,7 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
// Also places it in lower but think thats for clobering
*parameter_1 = (selected_scenery & 0xFF) << 8;
*parameter_2 = cl ^ (1 << 1) | (window_scenery_primary_colour << 8);
*parameter_2 = (cl ^ (1 << 1)) | (window_scenery_primary_colour << 8);
*parameter_3 = rotation | (window_scenery_secondary_colour << 16);
return;
}

View File

@@ -3943,7 +3943,7 @@ rct_map_element *map_element_insert(int x, int y, int z, int flags)
newMapElement->base_height = z;
newMapElement->flags = flags;
newMapElement->clearance_height = z;
*((uint32*)&newMapElement->properties) = 0;
memset(&newMapElement->properties, 0, sizeof(newMapElement->properties));
newMapElement++;
// Insert rest of map elements above insert height