Author: sveinung
Date: Tue Oct 27 16:54:42 2015
New Revision: 30239

URL: http://svn.gna.org/viewcvs/freeciv?rev=30239&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 get what is being
researched is handled in srv_ready().

See patch #6483

Modified:
    branches/S2_6/server/settings.c
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/settings.c?rev=30239&r1=30238&r2=30239&view=diff
==============================================================================
--- branches/S2_6/server/settings.c     (original)
+++ branches/S2_6/server/settings.c     Tue Oct 27 16:54:42 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: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=30239&r1=30238&r2=30239&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Tue Oct 27 16:54:42 2015
@@ -3003,6 +3003,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