diff options
author | rubidium <rubidium@openttd.org> | 2006-08-15 16:49:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2006-08-15 16:49:48 +0000 |
commit | 1cc6e186f06f98c76b43f94a787abaec7f024cd7 (patch) | |
tree | a8dc2bb9573156c15f1089772e4b388b37989f2d | |
parent | 08fd0bed1f443ade7050613a0f7de103a6c4e40c (diff) | |
download | openttd-1cc6e186f06f98c76b43f94a787abaec7f024cd7.tar.xz |
(svn r5918) -Cleanup: rename ConvertDayToYMD/ConvertYMDToDay as they really convert a Date to/from a YearMonthDay.
-Cleanup: swap ConvertDateToYMD's parameters to make the order consistent with the name of the function.
-rw-r--r-- | aircraft_gui.c | 2 | ||||
-rw-r--r-- | date.c | 10 | ||||
-rw-r--r-- | date.h | 4 | ||||
-rw-r--r-- | main_gui.c | 4 | ||||
-rw-r--r-- | misc_gui.c | 4 | ||||
-rw-r--r-- | roadveh_gui.c | 2 | ||||
-rw-r--r-- | ship_gui.c | 2 | ||||
-rw-r--r-- | strings.c | 6 | ||||
-rw-r--r-- | subsidy_gui.c | 2 | ||||
-rw-r--r-- | train_gui.c | 2 |
10 files changed, 19 insertions, 19 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 4aecb168d..3f59d7adc 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -36,7 +36,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) const Engine *e = GetEngine(engine_number); CargoID cargo; YearMonthDay ymd; - ConvertDayToYMD(&ymd, e->intro_date); + ConvertDateToYMD(e->intro_date, &ymd); /* Purchase cost - Max speed */ SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5); @@ -23,7 +23,7 @@ void SetDate(Date date) YearMonthDay ymd; _date = date; - ConvertDayToYMD(&ymd, date); + ConvertDateToYMD(date, &ymd); _cur_year = ymd.year; _cur_month = ymd.month; #ifdef ENABLE_NETWORK @@ -71,7 +71,7 @@ static const uint16 _accum_days_for_month[] = { }; -void ConvertDayToYMD(YearMonthDay *ymd, Date date) +void ConvertDateToYMD(Date date, YearMonthDay *ymd) { uint yr = date / (365 + 365 + 365 + 366); uint rem = date % (365 + 365 + 365 + 366); @@ -101,7 +101,7 @@ void ConvertDayToYMD(YearMonthDay *ymd, Date date) * @param month is a number between 0..11 * @param day is a number between 1..31 */ -uint ConvertYMDToDay(Year year, Month month, Day day) +Date ConvertYMDToDate(Year year, Month month, Day day) { uint rem; @@ -147,7 +147,7 @@ Date ConvertIntDate(uint date) /* invalid ranges? */ if (month >= 12 || !IS_INT_INSIDE(day, 1, 31 + 1)) return (Date)-1; - return ConvertYMDToDay(year, month, day); + return ConvertYMDToDate(year, month, day); } @@ -246,7 +246,7 @@ void IncreaseDate(void) } /* check if we entered a new month? */ - ConvertDayToYMD(&ymd, _date); + ConvertDateToYMD(_date, &ymd); if (ymd.month == _cur_month) return; _cur_month = ymd.month; @@ -30,6 +30,6 @@ extern DateFract _date_fract; void SetDate(Date date); -void ConvertDayToYMD(YearMonthDay *ymd, Date date); -uint ConvertYMDToDay(Year year, Month month, Day day); +void ConvertDateToYMD(Date date, YearMonthDay *ymd); +Date ConvertYMDToDate(Year year, Month month, Day day); Date ConvertIntDate(uint date); diff --git a/main_gui.c b/main_gui.c index f9f81c299..3b105e351 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1004,7 +1004,7 @@ static void ToolbarScenDateBackward(Window *w) HandleButtonClick(w, 6); InvalidateWidget(w, 5); - if (_date > MinDate) SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1)); + if (_date > MinDate) SetDate(ConvertYMDToDate(_cur_year - 1, 0, 1)); } _left_button_clicked = false; } @@ -1016,7 +1016,7 @@ static void ToolbarScenDateForward(Window *w) HandleButtonClick(w, 7); InvalidateWidget(w, 5); - if (_date < MaxDate) SetDate(ConvertYMDToDay(_cur_year + 1, 0, 1)); + if (_date < MaxDate) SetDate(ConvertYMDToDate(_cur_year + 1, 0, 1)); } _left_button_clicked = false; } diff --git a/misc_gui.c b/misc_gui.c index 67fff0289..0036fc969 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -1675,11 +1675,11 @@ extern void EnginesMonthlyLoop(void); static int32 ClickChangeDateCheat(int32 p1, int32 p2) { YearMonthDay ymd; - ConvertDayToYMD(&ymd, _date); + ConvertDateToYMD(_date, &ymd); if ((BASE_YEAR + ymd.year == MIN_YEAR && p2 == -1) || (BASE_YEAR + ymd.year == MAX_YEAR && p2 == 1)) return _cur_year; - SetDate(ConvertYMDToDay(_cur_year + p2, ymd.month, ymd.day)); + SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day)); EnginesMonthlyLoop(); SetWindowDirty(FindWindowById(WC_STATUS_BAR, 0)); return _cur_year; diff --git a/roadveh_gui.c b/roadveh_gui.c index 3acfce898..f4364fb97 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -33,7 +33,7 @@ void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) const Engine *e = GetEngine(engine_number); bool refittable = (_engine_info[engine_number].refit_mask != 0); YearMonthDay ymd; - ConvertDayToYMD(&ymd, e->intro_date); + ConvertDateToYMD(e->intro_date, &ymd); /* Purchase cost - Max speed */ SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5); diff --git a/ship_gui.c b/ship_gui.c index 49572d7ec..33731bc82 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -53,7 +53,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number) /* Design date - Life length */ e = GetEngine(engine_number); - ConvertDayToYMD(&ymd, e->intro_date); + ConvertDateToYMD(e->intro_date, &ymd); SetDParam(0, BASE_YEAR + ymd.year); SetDParam(1, e->lifelength); DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0); @@ -331,7 +331,7 @@ static char *FormatYmdString(char *buff, uint16 number) const char *src; YearMonthDay ymd; - ConvertDayToYMD(&ymd, number); + ConvertDateToYMD(number, &ymd); for (src = GetStringPtr(ymd.day + STR_01AC_1ST - 1); (*buff++ = *src++) != '\0';) {} buff[-1] = ' '; @@ -347,7 +347,7 @@ static char *FormatMonthAndYear(char *buff, uint16 number) const char *src; YearMonthDay ymd; - ConvertDayToYMD(&ymd, number); + ConvertDateToYMD(number, &ymd); for (src = GetStringPtr(STR_MONTH_JAN + ymd.month); (*buff++ = *src++) != '\0';) {} buff[-1] = ' '; @@ -359,7 +359,7 @@ static char *FormatTinyDate(char *buff, uint16 number) { YearMonthDay ymd; - ConvertDayToYMD(&ymd, number); + ConvertDateToYMD(number, &ymd); buff += sprintf(buff, " %02i-%02i-%04i", ymd.day, ymd.month + 1, BASE_YEAR + ymd.year); return buff; diff --git a/subsidy_gui.c b/subsidy_gui.c index edb6ede75..daba50675 100644 --- a/subsidy_gui.c +++ b/subsidy_gui.c @@ -84,7 +84,7 @@ static void DrawSubsidiesWindow(const Window *w) DrawWindowWidgets(w); - ConvertDayToYMD(&ymd, _date); + ConvertDateToYMD(_date, &ymd); y = 15; x = 1; diff --git a/train_gui.c b/train_gui.c index b00d31185..cd238de5e 100644 --- a/train_gui.c +++ b/train_gui.c @@ -34,7 +34,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number) const Engine *e = GetEngine(engine_number); int multihead = (rvi->flags&RVI_MULTIHEAD?1:0); YearMonthDay ymd; - ConvertDayToYMD(&ymd, e->intro_date); + ConvertDateToYMD(e->intro_date, &ymd); /* Purchase Cost - Engine weight */ SetDParam(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5); |