(svn r5918) -Cleanup: rename ConvertDayToYMD/ConvertYMDToDay as they really convert a Date to/from a YearMonthDay.
authorrubidium
Tue, 15 Aug 2006 16:49:48 +0000
changeset 4288 60398d0e64ee
parent 4287 27182ee2e707
child 4289 ff1b2b915cab
(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.
aircraft_gui.c
date.c
date.h
main_gui.c
misc_gui.c
roadveh_gui.c
ship_gui.c
strings.c
subsidy_gui.c
train_gui.c
--- a/aircraft_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/aircraft_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -36,7 +36,7 @@
 	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);
--- a/date.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/date.c	Tue Aug 15 16:49:48 2006 +0000
@@ -23,7 +23,7 @@
 	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 @@
 };
 
 
-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 @@
  * @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 @@
 	/* 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 @@
 	}
 
 	/* check if we entered a new month? */
-	ConvertDayToYMD(&ymd, _date);
+	ConvertDateToYMD(_date, &ymd);
 	if (ymd.month == _cur_month) return;
 	_cur_month = ymd.month;
 
--- a/date.h	Tue Aug 15 15:27:30 2006 +0000
+++ b/date.h	Tue Aug 15 16:49:48 2006 +0000
@@ -30,6 +30,6 @@
 
 
 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);
--- a/main_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/main_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -1004,7 +1004,7 @@
 		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 @@
 		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;
 }
--- a/misc_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/misc_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -1675,11 +1675,11 @@
 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;
--- a/roadveh_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/roadveh_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -33,7 +33,7 @@
 	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);
--- a/ship_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/ship_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -53,7 +53,7 @@
 
 	/* 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);
--- a/strings.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/strings.c	Tue Aug 15 16:49:48 2006 +0000
@@ -331,7 +331,7 @@
 	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 @@
 	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 @@
 {
 	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;
--- a/subsidy_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/subsidy_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -84,7 +84,7 @@
 
 	DrawWindowWidgets(w);
 
-	ConvertDayToYMD(&ymd, _date);
+	ConvertDateToYMD(_date, &ymd);
 
 	y = 15;
 	x = 1;
--- a/train_gui.c	Tue Aug 15 15:27:30 2006 +0000
+++ b/train_gui.c	Tue Aug 15 16:49:48 2006 +0000
@@ -34,7 +34,7 @@
 	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);