<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39413 >

Should be SSET_GAME_INIT category, it is now with the other init
options that cannot be changed later. That seems to be the guidelines
in the code, but it is confusing since endyear and startyear don't
appear beside each other.

Known bug: since startyear sets game.info.year at the start of the
game, 'server options' during play shows the current year as
startyear.

Index: server/settings.c
===================================================================
--- server/settings.c	(revision 13006)
+++ server/settings.c	(arbetskopia)
@@ -161,6 +161,19 @@
 }
 
 /*************************************************************************
+  Verify that a given startyear is valid.
+*************************************************************************/
+static bool startyear_callback(int value, const char **error_string)
+{
+  if (value > game.info.end_year) {
+    /* Tried to set startyear later than endyear */
+    *error_string = _("Cannot set startyear later than endyear.");
+    return FALSE;
+  }
+  return TRUE;
+}
+
+/*************************************************************************
   Verify that a given maxplayers string is valid.
 *************************************************************************/
 static bool maxplayers_callback(int value, const char **error_string)
@@ -482,6 +495,13 @@
              "the ruleset, a big value for techlevel can make the next "
              "techs really expensive."), NULL,
 	  GAME_MIN_TECHLEVEL, GAME_MAX_TECHLEVEL, GAME_DEFAULT_TECHLEVEL)
+	  
+  GEN_INT("startyear", game.info.year,
+	  SSET_GAME_INIT, SSET_SOCIOLOGY, SSET_VITAL, SSET_TO_CLIENT,
+	  N_("Year the game begins"),
+	  N_("The game will begin at the given year."),
+	  startyear_callback,
+	  GAME_MIN_START_YEAR, GAME_MAX_START_YEAR, GAME_DEFAULT_START_YEAR)
 
   GEN_INT("sciencebox", game.info.sciencebox,
 	  SSET_RULES, SSET_SCIENCE, SSET_SITUATIONAL, SSET_TO_CLIENT,
Index: server/report.c
===================================================================
--- server/report.c	(revision 13006)
+++ server/report.c	(arbetskopia)
@@ -935,7 +935,7 @@
   }
 
   if (!fp) {
-    if (game.info.year == GAME_START_YEAR) {
+    if (game.info.turn == 0) {
       oper = SL_CREATE;
     } else {
       fp = fopen(logname, "r");
Index: server/maphand.c
===================================================================
--- server/maphand.c	(revision 13006)
+++ server/maphand.c	(arbetskopia)
@@ -980,7 +980,7 @@
     }
   }
 
-  plrtile->last_updated = GAME_START_YEAR;
+  plrtile->last_updated = GAME_MIN_YEAR;
   vision_layer_iterate(v) {
     plrtile->own_seen[v] = plrtile->seen_count[v];
   } vision_layer_iterate_end;
Index: common/game.c
===================================================================
--- common/game.c	(revision 13006)
+++ common/game.c	(arbetskopia)
@@ -193,7 +193,7 @@
   game.info.tcptimeout    = GAME_DEFAULT_TCPTIMEOUT;
   game.info.netwait       = GAME_DEFAULT_NETWAIT;
   game.info.end_year      = GAME_DEFAULT_END_YEAR;
-  game.info.year          = GAME_START_YEAR;
+  game.info.year          = GAME_DEFAULT_START_YEAR;
   game.info.turn          = 0;
   game.info.min_players   = GAME_DEFAULT_MIN_PLAYERS;
   game.info.max_players   = GAME_DEFAULT_MAX_PLAYERS;
Index: common/game.h
===================================================================
--- common/game.h	(revision 13006)
+++ common/game.h	(arbetskopia)
@@ -175,9 +175,9 @@
 
 #define GAME_DEFAULT_ANGRYCITIZEN TRUE
 
-#define GAME_DEFAULT_END_YEAR    5000
-#define GAME_MIN_END_YEAR        GAME_START_YEAR
-#define GAME_MAX_END_YEAR        5000
+#define GAME_DEFAULT_END_YEAR    GAME_MAX_YEAR
+#define GAME_MIN_END_YEAR        GAME_MIN_YEAR
+#define GAME_MAX_END_YEAR        GAME_MAX_YEAR
 
 #define GAME_DEFAULT_MIN_PLAYERS     1
 #define GAME_MIN_MIN_PLAYERS         1
@@ -328,10 +328,10 @@
 #define GAME_MIN_BARBARIANRATE       0
 #define GAME_MAX_BARBARIANRATE       4
 
-#define GAME_DEFAULT_ONSETBARBARIAN  (GAME_START_YEAR+ \
-				      ((GAME_DEFAULT_END_YEAR-(GAME_START_YEAR))/3))
-#define GAME_MIN_ONSETBARBARIAN      GAME_START_YEAR
-#define GAME_MAX_ONSETBARBARIAN      GAME_MAX_END_YEAR
+#define GAME_DEFAULT_ONSETBARBARIAN  (GAME_DEFAULT_START_YEAR+ \
+				      ((GAME_DEFAULT_END_YEAR-(GAME_DEFAULT_START_YEAR))/3))
+#define GAME_MIN_ONSETBARBARIAN      GAME_MIN_YEAR
+#define GAME_MAX_ONSETBARBARIAN      GAME_MAX_YEAR
 
 #define GAME_DEFAULT_OCCUPYCHANCE    0
 #define GAME_MIN_OCCUPYCHANCE        0
@@ -363,6 +363,11 @@
 #define GAME_MIN_REVOLUTION_LENGTH 0
 #define GAME_MAX_REVOLUTION_LENGTH 10
 
-#define GAME_START_YEAR -4000
+#define GAME_DEFAULT_START_YEAR GAME_MIN_YEAR
+#define GAME_MIN_START_YEAR GAME_MIN_YEAR
+#define GAME_MAX_START_YEAR GAME_MAX_YEAR
 
+#define GAME_MIN_YEAR -4000
+#define GAME_MAX_YEAR 5000
+
 #endif  /* FC__GAME_H */
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to