Mercurial > hg > openttd
comparison src/timetable_cmd.cpp @ 15050:73f4e0e490b7 draft
(svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 18 Apr 2010 14:56:05 +0000 |
parents | d4b66296e3f9 |
children | 5d8e60ba4e28 |
comparison
equal
deleted
inserted
replaced
15049:177c89d03be1 | 15050:73f4e0e490b7 |
---|---|
277 * always the case when we cleared the timetable). */ | 277 * always the case when we cleared the timetable). */ |
278 if (!v->current_order.IsType(OT_CONDITIONAL) && (travelling || time_taken > v->current_order.wait_time)) { | 278 if (!v->current_order.IsType(OT_CONDITIONAL) && (travelling || time_taken > v->current_order.wait_time)) { |
279 /* Round the time taken up to the nearest day, as this will avoid | 279 /* Round the time taken up to the nearest day, as this will avoid |
280 * confusion for people who are timetabling in days, and can be | 280 * confusion for people who are timetabling in days, and can be |
281 * adjusted later by people who aren't. */ | 281 * adjusted later by people who aren't. */ |
282 time_taken = (((time_taken - 1) / DAY_TICKS) + 1) * DAY_TICKS; | 282 time_taken = CeilDiv(time_taken, DAY_TICKS) * DAY_TICKS; |
283 | 283 |
284 ChangeTimetable(v, v->cur_order_index, time_taken, travelling); | 284 ChangeTimetable(v, v->cur_order_index, time_taken, travelling); |
285 } | 285 } |
286 | 286 |
287 if (v->cur_order_index == 0 && travelling) { | 287 if (v->cur_order_index == 0 && travelling) { |