/*
-Minetest-c55
-Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DAYNIGHTRATIO_HEADER
-#define DAYNIGHTRATIO_HEADER
+#pragma once
inline u32 time_to_daynight_ratio(float time_of_day, bool smooth)
{
return values[i][1];
}
return 1000;
- } else {
- for(u32 i=0; i<sizeof(values)/sizeof(*values); i++){
- if(values[i][0] <= t)
+ }
+
+ for (u32 i=0; i < sizeof(values) / sizeof(*values); i++) {
+ if (values[i][0] <= t)
continue;
- if(i == 0)
+ if (i == 0)
return values[i][1];
float td0 = values[i][0] - values[i-1][0];
float f = (t - values[i-1][0]) / td0;
return f * values[i][1] + (1.0 - f) * values[i-1][1];
}
return 1000;
- }
-}
-
-#endif
+}