Merge pull request #2418 from janisozaur/fixes

fix remaining suspicious left shifts
This commit is contained in:
Ted John 2015-12-05 14:20:29 +00:00
commit ebcde1b231
5 changed files with 27 additions and 25 deletions

View File

@ -176,7 +176,7 @@ void research_finish_item(sint32 entryIndex)
base_ride_type = (entryIndex >> 8) & 0xFF;
rideEntryIndex = entryIndex & 0xFF;
rideEntry = GET_RIDE_ENTRY(rideEntryIndex);
RCT2_ADDRESS(0x01357404, uint32)[base_ride_type >> 5] |= (1 << (base_ride_type & 0x1F));
RCT2_ADDRESS(0x01357404, uint32)[base_ride_type >> 5] |= (1u << (base_ride_type & 0x1F));
RCT2_ADDRESS(0x01357444, uint32)[base_ride_type] = RCT2_ADDRESS(0x0097C468, uint32)[base_ride_type];
RCT2_ADDRESS(0x01357644, uint32)[base_ride_type] = RCT2_ADDRESS(0x0097C5D4, uint32)[base_ride_type];
if (RideData4[base_ride_type].flags & RIDE_TYPE_FLAG4_3) {
@ -184,7 +184,7 @@ void research_finish_item(sint32 entryIndex)
RCT2_ADDRESS(0x01357444, uint32)[ebx] = RCT2_ADDRESS(0x0097C468, uint32)[ebx];
RCT2_ADDRESS(0x01357644, uint32)[ebx] = RCT2_ADDRESS(0x0097C5D4, uint32)[ebx];
}
RCT2_ADDRESS(0x001357424, uint32)[rideEntryIndex >> 5] |= 1 << (rideEntryIndex & 0x1F);
RCT2_ADDRESS(0x001357424, uint32)[rideEntryIndex >> 5] |= 1u << (rideEntryIndex & 0x1F);
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) {
for (i = 0; i < 128; i++) {
rideEntry2 = GET_RIDE_ENTRY(i);
@ -194,7 +194,7 @@ void research_finish_item(sint32 entryIndex)
continue;
if (rideEntry2->ride_type[0] == base_ride_type || rideEntry2->ride_type[1] == base_ride_type || rideEntry2->ride_type[2] == base_ride_type)
RCT2_ADDRESS(0x001357424, uint32)[i >> 5] |= 1 << (i & 0x1F);
RCT2_ADDRESS(0x001357424, uint32)[i >> 5] |= 1u << (i & 0x1F);
}
}
@ -212,7 +212,7 @@ void research_finish_item(sint32 entryIndex)
scenerySetEntry = g_scenerySetEntries[entryIndex & 0xFFFF];
for (i = 0; i < scenerySetEntry->entry_count; i++) {
subSceneryEntryIndex = scenerySetEntry->scenery_entries[i];
RCT2_ADDRESS(0x01357BD0, sint32)[subSceneryEntryIndex >> 5] |= 1 << (subSceneryEntryIndex & 0x1F);
RCT2_ADDRESS(0x01357BD0, sint32)[subSceneryEntryIndex >> 5] |= 1u << (subSceneryEntryIndex & 0x1F);
}
// I don't think 0x009AC06C is ever not 0, so probably redundant

View File

@ -4724,8 +4724,10 @@ static void peep_update_walking(rct_peep* peep){
}
else{
uint8 pos_extr = 0;
for (int container = peep_empty_container_extra_flag(peep); pos_extr < 32; pos_extr++)if (container&(1 << pos_extr))break;
peep->item_extra_flags &= ~(1 << pos_extr);
for (int container = peep_empty_container_extra_flag(peep); pos_extr < 32; pos_extr++)
if (container & (1u << pos_extr))
break;
peep->item_extra_flags &= ~(1u << pos_extr);
bp = RCT2_ADDRESS(0x97EFE8, uint8)[pos_extr];
}
@ -8037,9 +8039,9 @@ loc_69B221:
// The peep has now decided to buy the item (or, specifically, has not been
// dissuaded so far).
if (shopItem >= 32)
peep->item_extra_flags |= (1 << (shopItem - 32));
peep->item_extra_flags |= (1u << (shopItem - 32));
else
peep->item_standard_flags |= (1 << shopItem);
peep->item_standard_flags |= (1u << shopItem);
if (shopItem == SHOP_ITEM_TSHIRT)
peep->tshirt_colour = ride->track_colour_main[0];

View File

@ -329,7 +329,7 @@ void game_command_set_staff_patrol(int *eax, int *ebx, int *ecx, int *edx, int *
rct_peep *peep = &g_sprite_list[sprite_id].peep;
int patrolOffset = peep->staff_id * (64 * 64 / 8);
int patrolIndex = ((x & 0x1F80) >> 7) | ((y & 0x1F80) >> 1);
int mask = 1 << (patrolIndex & 0x1F);
int mask = 1u << (patrolIndex & 0x1F);
int base = patrolIndex >> 5;
uint32 *patrolBits = (uint32*)(RCT2_ADDRESS_STAFF_PATROL_AREAS + patrolOffset + (base * 4));
@ -435,7 +435,7 @@ int staff_is_location_in_patrol_area(rct_peep *peep, int x, int y)
// Therefore there are in total 64 x 64 patrol quads in the 256 x 256 map
int patrolOffset = peep->staff_id * (64 * 64 / 8);
int patrolIndex = ((x & 0x1F80) >> 7) | ((y & 0x1F80) >> 1);
int mask = 1 << (patrolIndex & 0x1F);
int mask = 1u << (patrolIndex & 0x1F);
int base = patrolIndex >> 5;
uint32 *patrolBits = (uint32*)(RCT2_ADDRESS_STAFF_PATROL_AREAS + patrolOffset + (base * 4));

View File

@ -5225,9 +5225,9 @@ static money32 shop_item_get_common_price(rct_ride *forRide, int shopItem)
static bool shop_item_has_common_price(int shopItem)
{
if (shopItem < 32) {
return RCT2_GLOBAL(0x01358838, uint32) & (1 << shopItem);
return RCT2_GLOBAL(0x01358838, uint32) & (1u << shopItem);
} else {
return RCT2_GLOBAL(0x0135934C, uint32) & (1 << (shopItem - 32));
return RCT2_GLOBAL(0x0135934C, uint32) & (1u << (shopItem - 32));
}
}
@ -5263,11 +5263,11 @@ foundRideEntry:
}
*outRideIndex = rideIndex;
// Ride/vehicle colour is calcualted before applying to ensure
// Ride/vehicle colour is calcualted before applying to ensure
// correct colour is passed over the network.
if (!(flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_NETWORKED)) {
*outRideColour =
ride_get_random_colour_preset_index(type) |
*outRideColour =
ride_get_random_colour_preset_index(type) |
(ride_get_unused_preset_vehicle_colour(type, subType) << 8);
}

View File

@ -1597,7 +1597,7 @@ static void window_ride_init_viewport(rct_window *w)
*/
void window_ride_construct(rct_window *w)
{
// Window may be closed by close by class so
// Window may be closed by close by class so
// make backup before calling.
uint8 rideIndex = (uint8)w->number;
window_close_by_class(WC_RIDE_CONSTRUCTION);
@ -3468,7 +3468,7 @@ static void window_ride_maintenance_dropdown(rct_window *w, int widgetIndex, int
do {
vehicle = GET_VEHICLE(spriteId);
vehicle->update_flags &= ~(
VEHICLE_UPDATE_FLAG_BROKEN_CAR |
VEHICLE_UPDATE_FLAG_BROKEN_CAR |
VEHICLE_UPDATE_FLAG_7 |
VEHICLE_UPDATE_FLAG_BROKEN_TRAIN
);
@ -5413,12 +5413,12 @@ static void window_ride_income_toggle_primary_price(rct_window *w)
else {
if (shop_item < 32) {
newFlags = RCT2_GLOBAL(0x01358838, uint32);
newFlags ^= (1 << shop_item);
newFlags ^= (1u << shop_item);
game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item);
}
else {
newFlags = RCT2_GLOBAL(0x0135934C, uint32);
newFlags ^= (1 << (shop_item - 32));
newFlags ^= (1u << (shop_item - 32));
game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item);
}
}
@ -5456,12 +5456,12 @@ static void window_ride_income_toggle_secondary_price(rct_window *w)
else {
if (shop_item < 32) {
newFlags = RCT2_GLOBAL(0x01358838, uint32);
newFlags ^= (1 << shop_item);
newFlags ^= (1u << shop_item);
game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item);
}
else {
newFlags = RCT2_GLOBAL(0x0135934C, uint32);
newFlags ^= (1 << (shop_item - 32));
newFlags ^= (1u << (shop_item - 32));
game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item);
}
}
@ -5689,7 +5689,7 @@ static void window_ride_income_invalidate(rct_window *w)
if (ride->type == RIDE_TYPE_TOILETS || ((primaryItem = (sint8)rideEntry->shop_item) != -1)) {
window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WWT_CHECKBOX;
if (primaryItem < 32) {
if (RCT2_GLOBAL(0x01358838, uint32) & (1 << primaryItem))
if (RCT2_GLOBAL(0x01358838, uint32) & (1u << primaryItem))
w->pressed_widgets |= (1 << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK);
if (primaryItem != 31)
@ -5697,7 +5697,7 @@ static void window_ride_income_invalidate(rct_window *w)
}
else {
primaryItem -= 32;
if (RCT2_GLOBAL(0x0135934C, uint32) & (1 << primaryItem))
if (RCT2_GLOBAL(0x0135934C, uint32) & (1u << primaryItem))
w->pressed_widgets |= (1 << WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK);
window_ride_income_widgets[WIDX_PRIMARY_PRICE_LABEL].image = 2100 + primaryItem;
@ -5729,11 +5729,11 @@ static void window_ride_income_invalidate(rct_window *w)
// Set same price throughout park checkbox
w->pressed_widgets &= ~(1 << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK);
if (secondaryItem < 32) {
if (RCT2_GLOBAL(0x01358838, uint32) & (1 << secondaryItem))
if (RCT2_GLOBAL(0x01358838, uint32) & (1u << secondaryItem))
w->pressed_widgets |= (1 << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK);
} else {
secondaryItem -= 32;
if (RCT2_GLOBAL(0x0135934C, uint32) & (1 << secondaryItem))
if (RCT2_GLOBAL(0x0135934C, uint32) & (1u << secondaryItem))
w->pressed_widgets |= (1 << WIDX_SECONDARY_PRICE_SAME_THROUGHOUT_PARK);
}