mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Modernize src/c* src/d* and src/e* files (#6263)
* Modernize src/c* src/d* and src/e* files * default operator * redundant init * delete default constructors on CraftDefinition childs (never used) * fix some missing init values * const ref fix reported by clang-tidy * ranged-based for loops * simple conditions & returns * empty stl function instead of size * emplace_back stl function instead of push_back + construct temp obj * auto for some iterators * code style fixes * c++ stl headers instead of C stl headers (stdio.h -> cstdio)
This commit is contained in:
parent
921151d97a
commit
13e995b811
25 changed files with 298 additions and 343 deletions
|
@ -50,16 +50,17 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue