Author: sveinung
Date: Tue Oct 27 16:44:47 2015
New Revision: 30235

URL: http://svn.gna.org/viewcvs/freeciv?rev=30235&view=rev
Log:
Allow changing sciencebox in heavy scenarios

Allow changing the sciencebox setting before the game start in scenarios
that includes players, cities, etc.

The corner case where a change to the sciencebox setting on a heavy
scenario makes a player's amount of bulbs enough to finish his current
research is handled in srv_ready().

See patch #6483

Modified:
    trunk/server/settings.c
    trunk/server/srv_main.c

Modified: trunk/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/settings.c?rev=30235&r1=30234&r2=30235&view=diff
==============================================================================
--- trunk/server/settings.c     (original)
+++ trunk/server/settings.c     Tue Oct 27 16:44:47 2015
@@ -1668,7 +1668,8 @@
          GAME_MIN_TECHLEVEL, GAME_MAX_TECHLEVEL, GAME_DEFAULT_TECHLEVEL)
 
   GEN_INT("sciencebox", game.info.sciencebox,
-         SSET_RULES, SSET_SCIENCE, SSET_SITUATIONAL, SSET_TO_CLIENT,
+          SSET_RULES_SCENARIO, SSET_SCIENCE, SSET_SITUATIONAL,
+          SSET_TO_CLIENT,
          N_("Technology cost multiplier percentage"),
          N_("This affects how quickly players can research new "
             "technology. All tech costs are multiplied by this amount "

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=30235&r1=30234&r2=30235&view=diff
==============================================================================
--- trunk/server/srv_main.c     (original)
+++ trunk/server/srv_main.c     Tue Oct 27 16:44:47 2015
@@ -3099,6 +3099,18 @@
     }
   }
 
+  if (game.scenario.is_scenario && game.scenario.players) {
+    /* This is a heavy scenario. It may include research. The sciencebox
+     * setting may have been changed. A change to the sciencebox setting
+     * may have caused the stored amount of bulbs to be enough to finish
+     * the current research. */
+
+    players_iterate(pplayer) {
+      /* Check for finished research. */
+      update_bulbs(pplayer, 0, TRUE);
+    } players_iterate_end;
+  }
+
   CALL_FUNC_EACH_AI(game_start);
 }
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to