Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2000:
[Freeciv-Dev] Number of players upped to 126
Home

[Freeciv-Dev] Number of players upped to 126

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Number of players upped to 126
From: Markus Linnala <maage@xxxxxxxxx>
Date: Thu, 24 Feb 2000 09:41:15 +0200
Reply-to: Markus Linnala <maage@xxxxxxxxx>

This patch allows up to 126 players. 

Briefly tested with 44 players and seems to be working. Actually
buffer sizes should be based on something instead of being only
some 2:s exponent.

I think 126 is good value for limit, should not make any
problems with type overflows and leaves 1 place to barbarians.

This needs further testing, but I think this is way to go. 44
players makes interesting AI-games and expose weaknesses at
algorithms.

Guess we need more nations.

-- 
//Markus
------------------------------------------------------------------------
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.49
diff -u -r1.49 game.h
--- game.h      2000/02/15 14:21:09     1.49
+++ game.h      2000/02/24 07:26:21
@@ -189,7 +189,7 @@
 #define GAME_MIN_MIN_PLAYERS         1
 #define GAME_MAX_MIN_PLAYERS         MAX_NUM_PLAYERS
 
-#define GAME_DEFAULT_MAX_PLAYERS     14
+#define GAME_DEFAULT_MAX_PLAYERS     126
 #define GAME_MIN_MAX_PLAYERS         1
 #define GAME_MAX_MAX_PLAYERS         MAX_NUM_PLAYERS
 
Index: common/packets.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v
retrieving revision 1.60
diff -u -r1.60 packets.h
--- packets.h   2000/01/19 16:33:21     1.60
+++ packets.h   2000/02/24 07:26:21
@@ -19,9 +19,9 @@
 #include "spaceship.h"
 #include "worklist.h"
 
-#define MAX_LEN_PACKET    4096
+#define MAX_LEN_PACKET    8192
 #define MAX_LEN_USERNAME    10      /* see below */
-#define MAX_LEN_MSG       1536
+#define MAX_LEN_MSG       8192
 #define MAX_LEN_CAPSTR     512
 
 /* Note that MAX_LEN_USERNAME cannot be expanded, because it
Index: common/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v
retrieving revision 1.76
diff -u -r1.76 shared.h
--- shared.h    2000/01/26 14:39:59     1.76
+++ shared.h    2000/02/24 07:26:21
@@ -25,7 +25,7 @@
 
 #define BROADCAST_EVENT -2
 
-#define MAX_NUM_PLAYERS  14
+#define MAX_NUM_PLAYERS  126
 #define MAX_NUM_ITEMS   200    /* eg, unit_types */
 #define MAX_NUM_TECH_LIST 10
 #define MAX_LEN_NAME     32
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.115
diff -u -r1.115 plrhand.c
--- plrhand.c   2000/02/15 14:09:02     1.115
+++ plrhand.c   2000/02/24 07:26:22
@@ -84,16 +84,18 @@
          ((const struct player_score_entry *)a)->value);
 }
 
-static char *greatness[] = {
+static char *greatness[MAX_NUM_PLAYERS] = {
   N_("Magnificent"),  N_("Glorious"), N_("Great"), N_("Decent"),
   N_("Mediocre"), N_("Hilarious"), N_("Worthless"), N_("Pathetic"),
-  N_("Useless"), "Useless", "Useless", "Useless", "Useless", "Useless"
+  N_("Useless"), 0
 };
 
 static void historian_generic(enum historian_type which_news)
 {
   int i,j=0;
-  char buffer[4096];
+  /* !FIXME, use malloc or something -maage */
+  char buffer[512*MAX_NUM_PLAYERS];
+  char *gr;
   struct player_score_entry *size=
     fc_malloc(sizeof(struct player_score_entry)*game.nplayers);
 
@@ -126,8 +128,10 @@
   qsort(size, j, sizeof(struct player_score_entry), secompare);
   buffer[0]=0;
   for (i=0;i<j;i++) {
+    if (greatness[i])
+      gr = greatness[i];
     cat_snprintf(buffer, sizeof(buffer),
-                _("%2d: The %s %s\n"), i+1, _(greatness[i]),
+                _("%2d: The %s %s\n"), i+1, gr,
                 get_nation_name_plural(game.players[size[i].idx].nation));
   }
   free(size);
@@ -1253,8 +1257,9 @@
 void show_ending(void)
 {
   int i,j=0;
-  char buffer[4096];
-
+  /* !FIXME, use malloc or something -maage */
+  char buffer[512*MAX_NUM_PLAYERS];
+  char *gr;
   struct player_score_entry *size=
     fc_malloc(sizeof(struct player_score_entry)*game.nplayers);
 
@@ -1266,8 +1271,10 @@
   buffer[0]=0;
   for (i=0;i<game.nplayers;i++) {
     if( !is_barbarian(&game.players[size[i].idx]) ) {
+      if (greatness[i])
+       gr = greatness[i];
       cat_snprintf(buffer, sizeof(buffer),
-                  _("%2d: The %s %s scored %d points\n"), j+1, _(greatness[j]),
+                  _("%2d: The %s %s scored %d points\n"), j+1, gr,
                   get_nation_name_plural(game.players[size[i].idx].nation),
                   size[i].value);
       j++;



[Prev in Thread] Current Thread [Next in Thread]