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

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

Requested by Jacob Nevins <jtn>

See patch #6484

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

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=31065&r1=31064&r2=31065&view=diff
==============================================================================
--- trunk/common/map.c  (original)
+++ trunk/common/map.c  Fri Dec 18 09:30:18 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: trunk/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.h?rev=31065&r1=31064&r2=31065&view=diff
==============================================================================
--- trunk/common/map.h  (original)
+++ trunk/common/map.h  Fri Dec 18 09:30:18 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: trunk/common/map_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map_types.h?rev=31065&r1=31064&r2=31065&view=diff
==============================================================================
--- trunk/common/map_types.h    (original)
+++ trunk/common/map_types.h    Fri Dec 18 09:30:18 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: trunk/server/animals.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/animals.c?rev=31065&r1=31064&r2=31065&view=diff
==============================================================================
--- trunk/server/animals.c      (original)
+++ trunk/server/animals.c      Fri Dec 18 09:30:18 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: trunk/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/settings.c?rev=31065&r1=31064&r2=31065&view=diff
==============================================================================
--- trunk/server/settings.c     (original)
+++ trunk/server/settings.c     Fri Dec 18 09:30:18 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