3 Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef DAYNIGHTRATIO_HEADER
21 #define DAYNIGHTRATIO_HEADER
23 inline u32 time_to_daynight_ratio(u32 time_of_day)
25 s32 t = time_of_day%24000;
26 if(t < 4500 || t >= 19500)
28 else if(t < 4750 || t >= 19250)
30 else if(t < 5000 || t >= 19000)
32 else if(t < 5250 || t >= 18750)
34 else if(t < 5500 || t >= 18500)
36 else if(t < 5750 || t >= 18250)