From 513d08bd13609a9baaa77e8dc75ed88f0b73cfcf Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 26 Nov 2024 17:27:52 +0100 Subject: fix #14 --- src/scenes/place_detail.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c index 5f15474..dc366ba 100644 --- a/src/scenes/place_detail.c +++ b/src/scenes/place_detail.c @@ -946,12 +946,12 @@ static bool scheduling_job_is_correct() return true; } -static void draw_duration_of_scheduled_job_entry(scheduled_job_time scheduled_time, s32 hour_w, s32 tx, s32 ty, s32 timeslot_w, s32 x, s32 y, s32 timeslot_h, color tile_color) +static void draw_duration_of_scheduled_job_entry(scheduled_job job, scheduled_job_time scheduled_time, s32 hour_w, s32 tx, s32 ty, s32 timeslot_w, s32 x, s32 y, s32 timeslot_h, color tile_color) { #define TILE_X(_x) (x+hour_w+(timeslot_w*_x)+1) #define TILE_Y(_y) (y+(timeslot_h*(CDAYTORDAY(_y)))+1) - s32 duration_of_job_measured_in_timeslots_max = ceil((_active_scheduling_job.offer.duration_sec_max/60.0f) / (60.0f/TIME_SLOTS_PER_HOUR)); + s32 duration_of_job_measured_in_timeslots_max = ceil((job.offer.duration_sec_max/60.0f) / (60.0f/TIME_SLOTS_PER_HOUR)); if (!scheduled_time.stay_at_destination) duration_of_job_measured_in_timeslots_max*=2; log_assert(duration_of_job_measured_in_timeslots_max < 36*TIME_SLOTS_PER_HOUR, "Multi-day trip not supported yet in schedule preview."); @@ -1112,8 +1112,8 @@ static void place_detail_draw_schedule(platform_window* window) ty = TILE_Y(scheduled_time.day); } - // Draw duration of job. - draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + // Draw duration of job if dragging. + draw_duration_of_scheduled_job_entry(_active_scheduling_job, scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); // Draw left and right arrow. s32 icon_s = timeslot_w*0.7f; @@ -1133,11 +1133,11 @@ static void place_detail_draw_schedule(platform_window* window) // Highlight duration if selected. else if (is_selected) { - draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + draw_duration_of_scheduled_job_entry(_active_scheduling_job, scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); } - // Highlight duration if sharing save employee. + // Highlight duration if sharing same employee. else if (scheduled_time.assignee != 0 && scheduled_time.assignee == _active_scheduling_job.timeslots[_active_schedule_selected_job_index].assignee) { - draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + draw_duration_of_scheduled_job_entry(_active_scheduling_job, scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); } // Draw tile. @@ -1190,7 +1190,7 @@ static void place_detail_draw_schedule(platform_window* window) if (scheduled_time.assignee == 0) tc = is_selected ? COLOR_SCHEDULE_TILE_HOVERED : COLOR_SCHEDULE_TILE_INVALID; if (is_inspecting_employee || is_selected) { // Draw duration of job. - draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tc); + draw_duration_of_scheduled_job_entry(*job, scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tc); } renderer->render_rectangle(tx, ty, timeslot_w, timeslot_h, tc); -- cgit v1.2.3-70-g09d2