diff 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 (2010-04-18)
parents d4b66296e3f9
children 5d8e60ba4e28
line wrap: on
line diff
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -279,7 +279,7 @@
 			/* Round the time taken up to the nearest day, as this will avoid
 			 * confusion for people who are timetabling in days, and can be
 			 * adjusted later by people who aren't. */
-			time_taken = (((time_taken - 1) / DAY_TICKS) + 1) * DAY_TICKS;
+			time_taken = CeilDiv(time_taken, DAY_TICKS) * DAY_TICKS;
 
 			ChangeTimetable(v, v->cur_order_index, time_taken, travelling);
 		}