diff --git a/src/economy.c b/src/economy.c index 19223daa1..fc27a1c5d 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2360,16 +2360,12 @@ static void breedtrees(unit * u, int raw) { int n, i, skill, planted = 0; const resource_type *rtype; - static int gamecookie = -1; - static int current_season; + int current_season; region *r = u->region; - - if (gamecookie != global.cookie) { - gamedate date; - get_gamedate(turn, &date); - current_season = date.season; - gamecookie = global.cookie; - } + gamedate date; + + get_gamedate(turn, &date); + current_season = date.season; /* Bäume züchten geht nur im Frühling */ if (current_season != SEASON_SPRING) { diff --git a/src/kernel/teleport.c b/src/kernel/teleport.c index 00d568a22..8d9b696a5 100644 --- a/src/kernel/teleport.c +++ b/src/kernel/teleport.c @@ -181,22 +181,17 @@ bool is_astral(const region * r) plane *get_astralplane(void) { - static plane *astralspace; - static int rule_astralplane = -1; - static int gamecookie = -1; - if (rule_astralplane < 0) { - rule_astralplane = - get_param_int(global.parameters, "modules.astralspace", 1); - } + plane *astralspace = 0; + int rule_astralplane = + get_param_int(global.parameters, "modules.astralspace", 1); + if (!rule_astralplane) { return NULL; } - if (gamecookie != global.cookie) { + if (!astralspace) { astralspace = getplanebyname("Astralraum"); - gamecookie = global.cookie; } - - if (astralspace == NULL) { + if (!astralspace) { astralspace = create_new_plane(1, "Astralraum", TE_CENTER_X - 500, TE_CENTER_X + 500, TE_CENTER_Y - 500, TE_CENTER_Y + 500, 0); diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 493a3a66f..a72745eea 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -850,17 +850,13 @@ void leave_building(unit * u) bool can_leave(unit * u) { - static int gamecookie = -1; - static int rule_leave = -1; + int rule_leave; if (!u->building) { return true; } - if (rule_leave < 0 || gamecookie != global.cookie) { - gamecookie = global.cookie; - rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0); - } + rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0); if (rule_leave!=0 && u->building && u == building_owner(u->building)) { return false; diff --git a/src/laws.c b/src/laws.c index 15c5404b4..2da0a1a51 100755 --- a/src/laws.c +++ b/src/laws.c @@ -117,13 +117,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. static bool RemoveNMRNewbie(void) { - static int value = -1; - static int gamecookie = -1; - - if (value < 0 || gamecookie != global.cookie) { - value = get_param_int(global.parameters, "nmr.removenewbie", 0); - gamecookie = global.cookie; - } + int value = get_param_int(global.parameters, "nmr.removenewbie", 0); return value!=0; } diff --git a/src/report.c b/src/report.c index f157a75f4..5431f93df 100644 --- a/src/report.c +++ b/src/report.c @@ -2054,19 +2054,14 @@ const char *charset) char *bufp; bool utf8 = _strcmpl(charset, "utf8") == 0 || _strcmpl(charset, "utf-8") == 0; size_t size; - - /* static variables can cope with writing for different turns */ - static int thisseason = -1; - static int nextseason = -1; - static int gamecookie = -1; - if (gamecookie != global.cookie) { - gamedate date; - get_gamedate(turn + 1, &date); - thisseason = date.season; - get_gamedate(turn + 2, &date); - nextseason = date.season; - gamecookie = global.cookie; - } + int thisseason; + int nextseason; + gamedate date; + + get_gamedate(turn + 1, &date); + thisseason = date.season; + get_gamedate(turn + 2, &date); + nextseason = date.season; if (F == NULL) { perror(filename);