Skip to content

Commit

Permalink
further calendar extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
wito committed Jul 2, 2014
1 parent 40dbac3 commit 3ebb006
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ class calendar

// Season and year lenght stuff

static int year_turns() { return DAYS(year_length()); }
static int year_length() { return season_length() * 4; }
static int season_length();

int day_of_year() {
return day + season_length() * season;
}
int turn_of_year() { return turn_number % year_turns(); }
int day_of_year() { return day + season_length() * season; }

// Print-friendly stuff
std::string print_time(bool just_hour = false) const;
Expand Down
2 changes: 1 addition & 1 deletion src/weather_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ w_point weather_generator::get_weather(double x, double y, calendar t) {
double P(Pressure.noise(x, y, z / 3) * 70);

// temperature variation
const double now((t.day_of_year() + dayFraction) / (double)calendar::year_length()); // Add the minutes to the day and return the current time as a decimal [0-1]
const double now((double)t.turn_of_year() / (double)calendar::year_turns()); // [0,1)
const double ctn(cos(tau * now));
const double mod_t = 0; // TODO: make this depend on latitude and altitude?
const double current_t = this->base_t + mod_t; // Current baseline temperature. Degrees Celsius.
Expand Down

0 comments on commit 3ebb006

Please sign in to comment.