diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-30 23:17:13 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-30 23:17:13 +0100 |
| commit | 7c7b01a50676de67d805646ae2997f77d93cfb1e (patch) | |
| tree | 4bc8f221e291ff08d8af2fcca0cf23e57405607f /src | |
| parent | 81cc1fe615023e2d03b4373a3ac536f7dbcb0ea9 (diff) | |
close #25
Diffstat (limited to 'src')
| -rw-r--r-- | src/scenes/place_detail.c | 2 | ||||
| -rw-r--r-- | src/scenes/world_map.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c index 372a659..01e7d71 100644 --- a/src/scenes/place_detail.c +++ b/src/scenes/place_detail.c @@ -625,6 +625,8 @@ static void place_detail_draw_active_dealer(platform_window* window, truck_deale btn_x += btn_size;
s32 center_btn_w = 100*scale;
button_type type2 = purchase_animation.started || swap_animation.started ? BUTTON_STATIC : BUTTON_ENABLED;
+ if (_active_world->money < tr_curr->price)
+ type2 = BUTTON_DISABLED;
if (button_render(scale, type2, "purchase", btn_x, text_y, center_btn_w, btn_size)) {
ADD_EXPENSE(_active_world, _active_location, expenses_from_trucks, tr_curr->price)
add_truck_to_world_location(_active_world, _active_location, tr_curr);
diff --git a/src/scenes/world_map.c b/src/scenes/world_map.c index 4dfef05..2cf7446 100644 --- a/src/scenes/world_map.c +++ b/src/scenes/world_map.c @@ -848,7 +848,8 @@ static void world_map_draw_purchase_location_panel(platform_window* window) s32 button_w = 178 * scale;
s32 button_h = 37 * scale;
- if (button_render(scale, true, "Purchase", screen_center_x - (button_w/2), panel_y + panel_h - button_h - vertical_pad, button_w, button_h))
+ s32 state = (_active_world->money < world_location_get_price(scene_data.location_to_purchase)) ? BUTTON_DISABLED : BUTTON_ENABLED;
+ if (button_render(scale, state, "Purchase", screen_center_x - (button_w/2), panel_y + panel_h - button_h - vertical_pad, button_w, button_h))
{
// Mark as owned.
scene_data.location_to_purchase->is_owned = true;
|
