summaryrefslogtreecommitdiff
path: root/src/scenes
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-12-02 15:14:30 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-12-02 15:14:30 +0100
commit1b85aeaf9882e29c15b116b683acdab41bb3e94a (patch)
treefa3bb18cf00663f0f9aee8c4404057ff8c3ec424 /src/scenes
parent496fb467ef596b73fc3eab4593881567aad832da (diff)
new locations, multi day trip view in schedule
Diffstat (limited to 'src/scenes')
-rw-r--r--src/scenes/place_detail.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c
index 7e4b20a..1d52e5e 100644
--- a/src/scenes/place_detail.c
+++ b/src/scenes/place_detail.c
@@ -967,7 +967,7 @@ static void draw_duration_of_scheduled_job_entry(scheduled_job job, scheduled_jo
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.");
+ //log_assert(duration_of_job_measured_in_timeslots_max < 36*TIME_SLOTS_PER_HOUR, "Multi-day trip not supported yet in schedule preview.");
s32 slots_outside_of_schedule = (24-(WORK_HOUR_END-WORK_HOUR_START))*TIME_SLOTS_PER_HOUR;
s32 overflow_to_next_day = -(((TIME_SLOTS_PER_DAY-scheduled_time.timeslot) -
@@ -982,7 +982,27 @@ static void draw_duration_of_scheduled_job_entry(scheduled_job job, scheduled_jo
renderer->render_rectangle(tx, ty, highlight_w, timeslot_h, tile_color_bg);
s32 highlight_y = ty+timeslot_h;
if (scheduled_time.day == SUNDAY) highlight_y = TILE_Y(MONDAY);
- if (overflow_to_next_day > 0) renderer->render_rectangle(TILE_X(0), highlight_y, timeslot_w*overflow_to_next_day, timeslot_h, tile_color_bg);
+
+ if (overflow_to_next_day > 0) {
+ int extra_days = overflow_to_next_day / TIME_SLOTS_PER_DAY;
+ int curr_day = scheduled_time.day;
+ for (int xx = 0; xx < extra_days; xx++) {
+ s32 overflow = overflow_to_next_day % TIME_SLOTS_PER_DAY;
+ if (xx != extra_days-1) overflow = TIME_SLOTS_PER_DAY;
+
+ if (curr_day == SUNDAY) {
+ curr_day = MONDAY;
+ highlight_y = TILE_Y(MONDAY);
+ }
+
+ printf("%d %d %d\n", overflow_to_next_day, extra_days, overflow);
+ renderer->render_rectangle(TILE_X(0), highlight_y, timeslot_w*overflow, timeslot_h, tile_color_bg);
+ overflow_to_next_day -= TIME_SLOTS_PER_DAY;
+ highlight_y += timeslot_h;
+ curr_day++;
+ if (curr_day == 7) curr_day = 0;
+ }
+ }
}
static bool termination_popup_active = false;