1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Refactoring and bug fixing.

Noticed a bug that was causing path bits to fail to be changed.
Reduced compile warnings by using ints for coordinates.
Rearanged colour picker to stop bug that prevents its use when first clicked.
This commit is contained in:
Duncan Frost
2015-04-23 20:40:53 +01:00
parent b950447330
commit e04165eef4
3 changed files with 24 additions and 14 deletions

View File

@@ -411,6 +411,17 @@ void window_dropdown_show_colour_available(rct_window *w, rct_widget *widget, ui
if (availableColours & (1 << i))
numItems++;
// Set items
for (i = 0; i < 32; i++) {
if (availableColours & (1 << i)) {
if (selectedColour == i)
RCT2_GLOBAL(0x009DEBA2, sint16) = i;
gDropdownItemsFormat[i] = 0xFFFE;
gDropdownItemsArgs[i] = ((uint64)i << 32) | (0x20000000 | (i << 19) | 5059);
}
}
// Show dropdown
window_dropdown_show_image(
w->x + widget->left,
@@ -424,14 +435,4 @@ void window_dropdown_show_colour_available(rct_window *w, rct_widget *widget, ui
gAppropriateImageDropdownItemsPerRow[numItems]
);
// Set items
for (i = 0; i < 32; i++) {
if (availableColours & (1 << i)) {
if (selectedColour == i)
RCT2_GLOBAL(0x009DEBA2, sint16) = i;
gDropdownItemsFormat[i] = 0xFFFE;
gDropdownItemsArgs[i] = ((uint64)i << 32) | (0x20000000 | (i << 19) | 5059);
}
}
}

View File

@@ -943,7 +943,10 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
int interaction_type = 0;
rct_map_element* map_element;
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
int map_x, map_y;
get_map_coordinates_from_pos(x, y, flags, &map_x, &map_y, &interaction_type, &map_element, NULL);
*grid_x = (sint16)map_x;
*grid_y = (sint16)map_y;
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
{
@@ -1020,7 +1023,10 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
int interaction_type = 0;
rct_map_element* map_element;
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
int map_x, map_y;
get_map_coordinates_from_pos(x, y, flags, &map_x, &map_y, &interaction_type, &map_element, NULL);
*grid_x = (sint16)map_x;
*grid_y = (sint16)map_y;
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
{
@@ -1166,7 +1172,10 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
int interaction_type = 0;
rct_map_element* map_element;
get_map_coordinates_from_pos(x, y, flags, grid_x, grid_y, &interaction_type, &map_element, NULL);
int map_x, map_y;
get_map_coordinates_from_pos(x, y, flags, &map_x, &map_y, &interaction_type, &map_element, NULL);
*grid_x = (sint16)map_x;
*grid_y = (sint16)map_y;
if (interaction_type == VIEWPORT_INTERACTION_ITEM_NONE)
{

View File

@@ -231,7 +231,7 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
if (flags & (1 << 4))
return MONEY32_UNDEFINED;
if (!(flags & (1 << 6))) {
if (flags & (1 << 6)) {
if (mapElement->properties.path.additions & 0x0F) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_NONE;
return MONEY32_UNDEFINED;