From e2e602e7ba96adb2b89c35415c649b20789fd875 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 1 Mar 2017 08:28:15 +0100 Subject: [PATCH] fix off-by-one calendar, bug 2288 --- res/core/calendar.xml | 2 +- scripts/tests/e2/e2features.lua | 5 +++++ src/calendar.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/res/core/calendar.xml b/res/core/calendar.xml index 42f83d58b..d96037698 100644 --- a/res/core/calendar.xml +++ b/res/core/calendar.xml @@ -1,5 +1,5 @@ - + diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index de94ea34f..cba363d83 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -10,6 +10,11 @@ function setup() eressea.settings.set("rules.encounters", "0") end +function test_calendar() + assert_equal(get_season(1011), "calendar::winter") + assert_equal(get_season(1012), "calendar::spring") +end + function test_herbalism() -- OBS: herbalism is currently an E2-only skill local r = region.create(0, 0, "plain") diff --git a/src/calendar.c b/src/calendar.c index 2099b6631..d2a70c974 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -18,7 +18,7 @@ int seasons = 0; int first_turn(void) { - return config_get_int("game.start", 1); + return config_get_int("game.start", 0); } const gamedate *get_gamedate(int turn, gamedate * gd)