From 65b17cbd5dac9698bbb0b026ecf54eaa676a058a Mon Sep 17 00:00:00 2001 From: adrian17 Date: Fri, 25 Jul 2014 17:31:32 +0200 Subject: [PATCH] Used defined flags macros. (and fixed indentation) --- src/award.c | 8 ++++---- src/park.c | 10 +++++----- src/widget.c | 6 +++--- src/window.c | 24 ++++++++++++------------ src/window_guest_list.c | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/award.c b/src/award.c index b4589e9eed..397af63a45 100644 --- a/src/award.c +++ b/src/award.c @@ -139,7 +139,7 @@ static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardT if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_ROLLERCOASTER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_ROLLERCOASTER) continue; - if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400)) + if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) continue; rollerCoasters++; @@ -438,7 +438,7 @@ static int award_is_deserved_best_water_rides(int awardType, int activeAwardType if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_WATER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_WATER) continue; - if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400)) + if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) continue; waterRides++; @@ -464,7 +464,7 @@ static int award_is_deserved_best_custom_designed_rides(int awardType, int activ continue; if (ride->excitement < RIDE_RATING(5, 50)) continue; - if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400)) + if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) continue; customDesignedRides++; @@ -530,7 +530,7 @@ static int award_is_deserved_best_gentle_rides(int awardType, int activeAwardTyp if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_GENTLE && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_GENTLE) continue; - if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400)) + if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)) continue; gentleRides++; diff --git a/src/park.c b/src/park.c index 5d0534efd3..f2b0b71ae2 100644 --- a/src/park.c +++ b/src/park.c @@ -364,9 +364,9 @@ static int park_calculate_guest_generation_probability() FOR_ALL_RIDES(i, ride) { if (ride->status != RIDE_STATUS_OPEN) continue; - if (ride->lifecycle_flags & 0x80) + if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) continue; - if (ride->lifecycle_flags & 0x400) + if (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED) continue; // Add guest score for ride type @@ -384,16 +384,16 @@ static int park_calculate_guest_generation_probability() if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) { suggestedMaxGuests = min(suggestedMaxGuests, 1000); FOR_ALL_RIDES(i, ride) { - if (ride->lifecycle_flags & 0x80) + if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) continue; - if (ride->lifecycle_flags & 0x400) + if (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED) continue; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000)) continue; if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x200)) continue; - if (!(ride->lifecycle_flags & 0x02)) + if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)) continue; if (ride->var_0E4 < 0x2580000) continue; diff --git a/src/widget.c b/src/widget.c index c180d6f6d0..1733eef68d 100644 --- a/src/widget.c +++ b/src/widget.c @@ -642,7 +642,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge // press = 0x70; - if (w->flags & 0x0400) + if (w->flags & WF_10) press |= 0x80; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); @@ -650,7 +650,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge } else { // press = 0x60; - if (w->flags & 0x0400) + if (w->flags & WF_10) press |= 0x80; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); @@ -694,7 +694,7 @@ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg // Check if the button is pressed down press = 0; - if (w->flags & 0x400) + if (w->flags & WF_10) press |= 0x80; if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) press |= 0x20; diff --git a/src/window.c b/src/window.c index 7708cf7add..71e2d08ee2 100644 --- a/src/window.c +++ b/src/window.c @@ -553,16 +553,16 @@ void window_close_top() * rct2: 0x006EE927 */ void window_close_all() { - rct_window* w; + rct_window* w; - window_close_by_id(WC_DROPDOWN, 0); + window_close_by_id(WC_DROPDOWN, 0); for (w = g_window_list; w < RCT2_LAST_WINDOW; w++){ - if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) { - window_close(w); - w = g_window_list; - } - } + if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) { + window_close(w); + w = g_window_list; + } + } } /** @@ -796,11 +796,11 @@ rct_window *window_bring_to_front(rct_window *w) int i; rct_window* v, t; - if (w->flags & 0x03) + if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) return w; for (v = RCT2_LAST_WINDOW; v >= g_window_list; v--) - if (!(v->flags & 2)) + if (!(v->flags & WF_STICK_TO_FRONT)) break; if (v >= g_window_list && w != v) { @@ -840,7 +840,7 @@ void window_push_others_below(rct_window *w1) continue; // ? - if (w2->flags & 3) + if (w2->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)) continue; // Check if w2 intersects with w1 @@ -1082,7 +1082,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi) // RCT2_CALLPROC_X(0x006EB15C, 0, 0, 0, 0, w, dpi, 0); // return; - if ((w->flags & WF_TRANSPARENT) && !(w->flags & 0x20)) + if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_5)) gfx_fill_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 0x2000000 | 51); widgetIndex = 0; @@ -1291,4 +1291,4 @@ void window_bubble_list_item(rct_window* w, int item_position){ char swap = w->list_item_positions[item_position]; w->list_item_positions[item_position] = w->list_item_positions[item_position + 1]; w->list_item_positions[item_position + 1] = swap; -} \ No newline at end of file +} diff --git a/src/window_guest_list.c b/src/window_guest_list.c index 8573386df3..47c825e04e 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -899,7 +899,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum *argument_2 = ride.var_04C; } else{ - *argument_1 = peep->flags & 1 ? STR_LEAVING_PARK : STR_WALKING; + *argument_1 = peep->flags & PEEP_FLAGS_LEAVING_PARK ? STR_LEAVING_PARK : STR_WALKING; *argument_2 = 0; } break;