Author: cazfi
Date: Fri Dec 18 09:30:25 2015
New Revision: 31066

URL: http://svn.gna.org/viewcvs/freeciv?rev=31066&view=rev
Log:
Added server setting 'animals' to control amount of animals.

Requested by Jacob Nevins <jtn>

See patch #6484

Modified:
    branches/S2_6/common/map.c
    branches/S2_6/common/map.h
    branches/S2_6/common/map_types.h
    branches/S2_6/server/animals.c
    branches/S2_6/server/settings.c

Modified: branches/S2_6/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.c?rev=31066&r1=31065&r2=31066&view=diff
==============================================================================
--- branches/S2_6/common/map.c  (original)
+++ branches/S2_6/common/map.c  Fri Dec 18 09:30:25 2015
@@ -175,6 +175,7 @@
     game.map.server.riches = MAP_DEFAULT_RICHES;
     game.map.server.huts = MAP_DEFAULT_HUTS;
     game.map.server.huts_absolute = -1;
+    game.map.server.animals = MAP_DEFAULT_ANIMALS;
     game.map.server.landpercent = MAP_DEFAULT_LANDMASS;
     game.map.server.wetness = MAP_DEFAULT_WETNESS;
     game.map.server.steepness = MAP_DEFAULT_STEEPNESS;

Modified: branches/S2_6/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.h?rev=31066&r1=31065&r2=31066&view=diff
==============================================================================
--- branches/S2_6/common/map.h  (original)
+++ branches/S2_6/common/map.h  Fri Dec 18 09:30:25 2015
@@ -529,6 +529,10 @@
 #define MAP_MIN_HUTS             0
 #define MAP_MAX_HUTS             500
 
+#define MAP_DEFAULT_ANIMALS      20
+#define MAP_MIN_ANIMALS          0
+#define MAP_MAX_ANIMALS          500
+
 #define MAP_DEFAULT_MAPSIZE     MAPSIZE_FULLSIZE
 
 /* Size of the map in thousands of tiles. If MAP_MAX_SIZE is increased, 

Modified: branches/S2_6/common/map_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map_types.h?rev=31066&r1=31065&r2=31066&view=diff
==============================================================================
--- branches/S2_6/common/map_types.h    (original)
+++ branches/S2_6/common/map_types.h    Fri Dec 18 09:30:25 2015
@@ -82,6 +82,7 @@
       int riches;
       int huts;
       int huts_absolute; /* For compatibility conversion from pre-2.6 
savegames */
+      int animals;
       int landpercent;
       enum map_generator generator;
       enum map_startpos startpos;

Modified: branches/S2_6/server/animals.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/animals.c?rev=31066&r1=31065&r2=31066&view=diff
==============================================================================
--- branches/S2_6/server/animals.c      (original)
+++ branches/S2_6/server/animals.c      Fri Dec 18 09:30:25 2015
@@ -94,6 +94,10 @@
   struct research *presearch;
   int i;
 
+  if (game.map.server.animals <= 0) {
+    return;
+  }
+
   anination = pick_a_nation(NULL, FALSE, TRUE, ANIMAL_BARBARIAN);
 
   if (anination == NO_NATION_SELECTED) {
@@ -144,7 +148,7 @@
    * about invalid team. */
   send_research_info(presearch, NULL);
 
-  for (i = 0; i < game.map.xsize * game.map.ysize / 50; i++) {
+  for (i = 0; i < game.map.xsize * game.map.ysize * game.map.server.animals / 
1000; i++) {
     place_animal(plr);
   }
 }

Modified: branches/S2_6/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/settings.c?rev=31066&r1=31065&r2=31066&view=diff
==============================================================================
--- branches/S2_6/server/settings.c     (original)
+++ branches/S2_6/server/settings.c     Fri Dec 18 09:30:25 2015
@@ -1567,6 +1567,15 @@
              "tile extras that may be investigated by units."),
           huts_help, NULL, huts_action,
           MAP_MIN_HUTS, MAP_MAX_HUTS, MAP_DEFAULT_HUTS)
+
+  GEN_INT("animals", game.map.server.animals,
+          SSET_MAP_ADD, SSET_GEOLOGY, SSET_VITAL, SSET_TO_CLIENT,
+          N_("Amount of animals"),
+          N_("Amount of animals initially created to terrains "
+             "defined for them in the ruleset. "
+             "The server variable's scale is animals per "
+             "thousand tiles."), NULL, NULL, NULL,
+          MAP_MIN_ANIMALS, MAP_MAX_ANIMALS, MAP_DEFAULT_ANIMALS)
 
   /* Options affecting numbers of players and AI players.  These only
    * affect the start of the game and can not be adjusted after that.


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

Reply via email to