[Freeciv-Dev] (PR#8798) remove map.fixed_start_positions
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8798 >
Before going on with the scenario improvements, I'd like to remove the
map.fixed_start_positions variable.
Historically this value was put into a scenario. If set, then the start
positions in the scenarios corresponded to nations (via an indexing
method). If not set then the start positions are assigned randomly.
The fixed_start_positions variable was the only way to tell which.
This is no longer needed because start positions now refer to their
nations by name. If a start position has no name or if the name doesn't
correspond to any nation (e.g., if the ruleset is missing this nation)
then that particular start position will be assigned randomly. Thus the
same thing that was done before via a global variable is now handled on
a per-nation basis.
So I removed it. There was only one place where this value was actually
read, and I'm pretty sure this was already buggy. But perhaps I don't
understand it fully. What it seems to me is that:
"If we start a game and there are more players than start positions AND
fixed_start_positions is set, cut some players."
But if a scenario didn't set fixed_start_positions this would break. We
should cut the extra players in all cases. I guess old-style scenarios
were always supposed to specify fixed_start_positions?
jason
? convert.sh
? eff
? flags
? spec.diff
? data/flags
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.166
diff -u -r1.166 map.c
--- common/map.c 19 May 2004 00:49:31 -0000 1.166
+++ common/map.c 22 May 2004 04:10:36 -0000
@@ -195,7 +195,6 @@
map.tiles = NULL;
map.num_continents = 0;
map.num_start_positions = 0;
- map.fixed_start_positions = FALSE;
map.have_specials = FALSE;
map.have_rivers_overlay = FALSE;
map.have_huts = FALSE;
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.185
diff -u -r1.185 map.h
--- common/map.h 19 May 2004 20:11:17 -0000 1.185
+++ common/map.h 22 May 2004 04:10:36 -0000
@@ -132,7 +132,6 @@
bool tinyisles;
bool separatepoles;
int num_start_positions;
- bool fixed_start_positions;
bool have_specials;
bool have_huts;
bool have_rivers_overlay; /* only applies if !have_specials */
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.152
diff -u -r1.152 savegame.c
--- server/savegame.c 19 May 2004 20:11:17 -0000 1.152
+++ server/savegame.c 22 May 2004 04:10:39 -0000
@@ -294,8 +294,6 @@
{
int i=0, pos;
- map.fixed_start_positions = secfile_lookup_bool_default(file, FALSE,
"map.fixed_start_positions");
-
map.start_positions = fc_realloc(map.start_positions,
game.max_players
* sizeof(*map.start_positions));
@@ -407,7 +405,6 @@
map_startpos_load(file);
} else {
map.num_start_positions = 0;
- map.fixed_start_positions = FALSE;
}
/* get 4-bit segments of 16-bit "special" field. */
@@ -477,7 +474,6 @@
secfile_insert_bool(file, game.save_options.save_starts, "game.save_starts");
if (game.save_options.save_starts) {
- secfile_insert_bool(file, map.fixed_start_positions,
"map.fixed_start_positions");
for (i=0; i<map.num_start_positions; i++) {
secfile_insert_int(file, map.start_positions[i].x, "map.r%dsx", i);
secfile_insert_int(file, map.start_positions[i].y, "map.r%dsy", i);
@@ -2239,7 +2235,6 @@
/* aka a "scenario" */
if (has_capability("specials",savefile_options)) {
map_load(file);
- map.fixed_start_positions = TRUE;
return;
}
map_tiles_load(file);
@@ -2248,7 +2243,6 @@
}
if (has_capability("startpos",savefile_options)) {
map_startpos_load(file);
- map.fixed_start_positions = TRUE;
return;
}
return;
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.317
diff -u -r1.317 stdinhand.c
--- server/stdinhand.c 17 May 2004 05:34:53 -0000 1.317
+++ server/stdinhand.c 22 May 2004 04:10:40 -0000
@@ -4468,8 +4468,11 @@
case PRE_GAME_STATE:
/* Sanity check scenario */
if (game.is_new_game && !check) {
- if (map.fixed_start_positions
- && game.max_players > map.num_start_positions) {
+ if (game.max_players > map.num_start_positions) {
+ /* If we load a pre-generated map (i.e., a scenario) it is possible
+ * to increase the number of players beyond the number supported by
+ * the scenario. The solution is a hack: cut the extra players
+ * when the game starts. */
freelog(LOG_VERBOSE, "Reduced maxplayers from %i to %i to fit "
"to the number of start positions.",
game.max_players, map.num_start_positions);
- [Freeciv-Dev] (PR#8798) remove map.fixed_start_positions,
Jason Short <=
|
|