--- deliantra/server/include/tod.h 2006/08/29 08:01:36 1.2
+++ deliantra/server/include/tod.h 2007/11/08 19:43:25 1.13
@@ -1,67 +1,70 @@
/*
- * static char *rcsid_tod_h =
- * "$Id$";
+ * This file is part of Deliantra, the Roguelike Realtime MMORPG.
+ *
+ * Copyright (©) 2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
+ * Copyright (©) 2003-2006,2007 Mark Wedel & Crossfire Development Team
+ * Copyright (©) 2000,2007 Tim Rightnour
+ * Copyright (©) 1992,2007 Frank Tore Johansen
+ *
+ * Deliantra is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * The authors can be reached via e-mail to
*/
-/*
- CrossFire, A Multiplayer game for X-windows
-
- Copyright (C) 2003-2006 Mark Wedel & Crossfire Development Team
- Copyright (C) 2000 Tim Rightnour
- Copyright (C) 1992 Frank Tore Johansen
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+#ifndef TOD_H_
+#define TOD_H_
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+#define TICK (MAX_TIME * 1e-6)
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#define TICK2TIME(tick) (tstamp (tick) * TICK)
+#define TIME2TICK(time) tstamp ((time) / TICK)
- The authors can be reached via e-mail at crossfire-devel@real-time.com
-*/
-
-#ifndef _TOD_H_
-#define _TOD_H_
-
-#define PTICKS_PER_CLOCK 1500
+#define RUNTIME_PER_HOUR 180.
+#define TICKS_PER_HOUR int (RUNTIME_PER_HOUR / MAX_TIME * 1e6)
/* game time */
#define HOURS_PER_DAY 28
-#define DAYS_PER_WEEK 7
-#define WEEKS_PER_MONTH 5
+#define DAYS_PER_WEEK 7
+#define WEEKS_PER_MONTH 5
#define MONTHS_PER_YEAR 17
/* convenience */
-#define WEEKS_PER_YEAR (WEEKS_PER_MONTH*MONTHS_PER_YEAR)
-#define DAYS_PER_MONTH (DAYS_PER_WEEK*WEEKS_PER_MONTH)
-#define DAYS_PER_YEAR (DAYS_PER_MONTH*MONTHS_PER_YEAR)
-#define HOURS_PER_WEEK (HOURS_PER_DAY*DAYS_PER_WEEK)
-#define HOURS_PER_MONTH (HOURS_PER_WEEK*WEEKS_PER_MONTH)
-#define HOURS_PER_YEAR (HOURS_PER_MONTH*MONTHS_PER_YEAR)
+#define WEEKS_PER_YEAR (WEEKS_PER_MONTH * MONTHS_PER_YEAR)
+#define DAYS_PER_MONTH (DAYS_PER_WEEK * WEEKS_PER_MONTH)
+#define DAYS_PER_YEAR (DAYS_PER_MONTH * MONTHS_PER_YEAR)
+#define HOURS_PER_WEEK (HOURS_PER_DAY * DAYS_PER_WEEK)
+#define HOURS_PER_MONTH (HOURS_PER_WEEK * WEEKS_PER_MONTH)
+#define HOURS_PER_YEAR (HOURS_PER_MONTH * MONTHS_PER_YEAR)
#define LUNAR_DAYS DAYS_PER_MONTH
-typedef struct _timeofday {
- int year;
- int month;
- int day;
- int dayofweek;
- int hour;
- int minute;
- int weekofmonth;
- int season;
-} timeofday_t;
+struct timeofday_t
+{
+ int year;
+ int month;
+ int day;
+ int dayofweek;
+ int hour;
+ int minute;
+ int weekofmonth;
+ int season;
+};
/* from common/time.c */
-extern void get_tod(timeofday_t *tod);
+extern void get_tod (timeofday_t *tod);
+#if 0
/* weather stuff */
#define POLAR_BASE_TEMP 0 /* C */
@@ -136,5 +139,7 @@
int elevmax; /* elevation min/max */
int season; /* 0=any or 1-5 */
} weather_grow_t;
+#endif
+
+#endif
-#endif /* _TOD_H_ */