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

> [cazf...@gmail.com - Sam. Sep. 05 20:21:16 2009]:
> 
> 
>  Can you make an updated patch?
> 
> 
>  - ML

I could...  I made techlevel giving free random techs more, like you
suggested.

Index: server/srv_main.c
===================================================================
--- server/srv_main.c	(révision 15908)
+++ server/srv_main.c	(copie de travail)
@@ -2256,10 +2256,11 @@
       pplayer->economic.gold = game.info.gold;
     } players_iterate_end;
 
+    /* Give nation technologies, as specified in the ruleset. */
     players_iterate(pplayer) {
-      give_initial_techs(pplayer);
+      give_nation_initial_techs(pplayer);
     } players_iterate_end;
-    
+
     players_iterate(pplayer) {
       int i;
       bool free_techs_already_given = FALSE;
@@ -2273,9 +2274,12 @@
       } players_iterate_end;
       
       if (free_techs_already_given) {
-        break;
+        continue;
       }
       
+      /* Give global technologies, as specified in the ruleset. */
+      give_global_initial_techs(pplayer);
+      /* Give random free technologies thanks to the techlevel setting. */
       for (i = 0; i < game.info.tech; i++) {
         give_random_initial_tech(pplayer);
       }
Index: server/barbarian.c
===================================================================
--- server/barbarian.c	(révision 15908)
+++ server/barbarian.c	(copie de travail)
@@ -133,7 +133,8 @@
   barbarians->ai_data.barbarian_type = type;
   set_ai_level_directer(barbarians, game.info.skill_level);
   init_tech(barbarians, TRUE);
-  give_initial_techs(barbarians);
+  give_global_initial_techs(barbarians);
+  give_nation_initial_techs(barbarians);
 
   /* Ensure that we are at war with everyone else */
   players_iterate(pplayer) {
Index: server/edithand.c
===================================================================
--- server/edithand.c	(révision 15908)
+++ server/edithand.c	(copie de travail)
@@ -872,7 +872,8 @@
   pplayer->economic = player_limit_to_max_rates(pplayer);
 
   init_tech(pplayer, TRUE);
-  give_initial_techs(pplayer);
+  give_global_initial_techs(pplayer);
+  give_nation_initial_techs(pplayer);
 
   send_player_info(pplayer, NULL);
   if (tag > 0) {
Index: server/techtools.c
===================================================================
--- server/techtools.c	(révision 15908)
+++ server/techtools.c	(copie de travail)
@@ -598,31 +598,36 @@
 }
 
 /****************************************************************************
-  Gives initial techs to the player
+  Gives global initial techs to the player.  The techs are read from the
+  game ruleset file.
 ****************************************************************************/
-void give_initial_techs(struct player* plr)
+void give_global_initial_techs(struct player *pplayer)
 {
-  struct nation_type *nation = nation_of_player(plr);
   int i;
-  
-  /*
-   * Give game wide initial techs
-   */
+
   for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
     if (game.server.rgame.global_init_techs[i] == A_LAST) {
       break;
     }
-    found_new_tech(plr, game.server.rgame.global_init_techs[i], FALSE, TRUE);
+    found_new_tech(pplayer, game.server.rgame.global_init_techs[i],
+                   FALSE, TRUE);
   }
+}
 
-  /*
-   * Give nation specific initial techs
-   */
+/****************************************************************************
+  Gives nation specific initial techs to the player.  The techs are read
+  from the nation ruleset file.
+****************************************************************************/
+void give_nation_initial_techs(struct player *pplayer)
+{
+  const struct nation_type *nation = nation_of_player(pplayer);
+  int i;
+
   for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
     if (nation->init_techs[i] == A_LAST) {
       break;
     }
-    found_new_tech(plr, nation->init_techs[i], FALSE, TRUE);
+    found_new_tech(pplayer, nation->init_techs[i], FALSE, TRUE);
   }
 }
 
@@ -631,7 +636,7 @@
   Returns the tech. This differs from give_random_free_tech - it doesn't
   apply free cost
 ****************************************************************************/
-Tech_type_id give_random_initial_tech(struct player* pplayer)
+Tech_type_id give_random_initial_tech(struct player *pplayer)
 {
   Tech_type_id tech;
   
Index: server/techtools.h
===================================================================
--- server/techtools.h	(révision 15908)
+++ server/techtools.h	(copie de travail)
@@ -34,7 +34,8 @@
 
 Tech_type_id give_random_free_tech(struct player *pplayer);
 Tech_type_id give_immediate_free_tech(struct player *pplayer);
-void give_initial_techs(struct player* plr);
-Tech_type_id give_random_initial_tech(struct player* pplayer);
+void give_global_initial_techs(struct player *pplayer);
+void give_nation_initial_techs(struct player *pplayer);
+Tech_type_id give_random_initial_tech(struct player *pplayer);
 
 #endif
Index: server/srv_main.c
===================================================================
--- server/srv_main.c	(révision 15892)
+++ server/srv_main.c	(copie de travail)
@@ -2129,10 +2129,11 @@
       pplayer->economic.gold = game.info.gold;
     } players_iterate_end;
 
+    /* Give nation technologies, as specified in the ruleset. */
     players_iterate(pplayer) {
-      give_initial_techs(pplayer);
+      give_nation_initial_techs(pplayer);
     } players_iterate_end;
-    
+
     players_iterate(pplayer) {
       int i;
       bool free_techs_already_given = FALSE;
@@ -2146,9 +2147,12 @@
       } players_iterate_end;
       
       if (free_techs_already_given) {
-        break;
+        continue;
       }
       
+      /* Give global technologies, as specified in the ruleset. */
+      give_global_initial_techs(pplayer);
+      /* Give random free technologies thanks to the techlevel setting. */
       for (i = 0; i < game.info.tech; i++) {
         give_random_initial_tech(pplayer);
       }
Index: server/barbarian.c
===================================================================
--- server/barbarian.c	(révision 15892)
+++ server/barbarian.c	(copie de travail)
@@ -166,7 +166,8 @@
   }
   set_ai_level_directer(barbarians, game.info.skill_level);
   init_tech(barbarians, TRUE);
-  give_initial_techs(barbarians);
+  give_global_initial_techs(barbarians);
+  give_nation_initial_techs(barbarians);
 
   /* Ensure that we are at war with everyone else */
   players_iterate(pplayer) {
Index: server/techtools.c
===================================================================
--- server/techtools.c	(révision 15892)
+++ server/techtools.c	(copie de travail)
@@ -595,31 +595,35 @@
 }
 
 /****************************************************************************
-  Gives initial techs to the player
+  Gives global initial techs to the player.  The techs are read from the
+  game ruleset file.
 ****************************************************************************/
-void give_initial_techs(struct player* plr)
+void give_global_initial_techs(struct player *pplayer)
 {
-  struct nation_type *nation = nation_of_player(plr);
   int i;
-  
-  /*
-   * Give game wide initial techs
-   */
+
   for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
     if (game.rgame.global_init_techs[i] == A_LAST) {
       break;
     }
-    found_new_tech(plr, game.rgame.global_init_techs[i], FALSE, TRUE);
+    found_new_tech(pplayer, game.rgame.global_init_techs[i], FALSE, TRUE);
   }
+}
 
-  /*
-   * Give nation specific initial techs
-   */
+/****************************************************************************
+  Gives nation specific initial techs to the player.  The techs are read
+  from the nation ruleset file.
+****************************************************************************/
+void give_nation_initial_techs(struct player *pplayer)
+{
+  const struct nation_type *nation = nation_of_player(pplayer);
+  int i;
+
   for (i = 0; i < MAX_NUM_TECH_LIST; i++) {
     if (nation->init_techs[i] == A_LAST) {
       break;
     }
-    found_new_tech(plr, nation->init_techs[i], FALSE, TRUE);
+    found_new_tech(pplayer, nation->init_techs[i], FALSE, TRUE);
   }
 }
 
@@ -628,7 +632,7 @@
   Returns the tech. This differs from give_random_free_tech - it doesn't
   apply free cost
 ****************************************************************************/
-Tech_type_id give_random_initial_tech(struct player* pplayer)
+Tech_type_id give_random_initial_tech(struct player *pplayer)
 {
   Tech_type_id tech;
   
Index: server/techtools.h
===================================================================
--- server/techtools.h	(révision 15892)
+++ server/techtools.h	(copie de travail)
@@ -34,7 +34,8 @@
 
 Tech_type_id give_random_free_tech(struct player *pplayer);
 Tech_type_id give_immediate_free_tech(struct player *pplayer);
-void give_initial_techs(struct player* plr);
-Tech_type_id give_random_initial_tech(struct player* pplayer);
+void give_global_initial_techs(struct player *pplayer);
+void give_nation_initial_techs(struct player *pplayer);
+Tech_type_id give_random_initial_tech(struct player *pplayer);
 
 #endif
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to