diff -u2NrX freeciv/diff_ignore freeciv/common/game.c freeciv-phased/common/game.c --- freeciv/common/game.c Mon Feb 18 23:06:07 2002 +++ freeciv-phased/common/game.c Thu Feb 21 23:40:42 2002 @@ -710,12 +710,4 @@ game.watchtower_extra_vision=GAME_DEFAULT_WATCHTOWER_EXTRA_VISION, - sz_strlcpy(game.ruleset.techs, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.units, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.buildings, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.terrain, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.governments, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.nations, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.cities, GAME_DEFAULT_RULESET); - sz_strlcpy(game.ruleset.game, GAME_DEFAULT_RULESET); game.firepower_factor = 1; game.num_unit_types = 0; diff -u2NrX freeciv/diff_ignore freeciv/common/game.h freeciv-phased/common/game.h --- freeciv/common/game.h Mon Feb 18 23:06:07 2002 +++ freeciv-phased/common/game.h Fri Feb 22 00:21:00 2002 @@ -149,14 +149,4 @@ int watchtower_vision; - struct { - char techs[MAX_LEN_NAME]; - char units[MAX_LEN_NAME]; - char buildings[MAX_LEN_NAME]; - char terrain[MAX_LEN_NAME]; - char governments[MAX_LEN_NAME]; - char nations[MAX_LEN_NAME]; - char cities[MAX_LEN_NAME]; - char game[MAX_LEN_NAME]; - } ruleset; int firepower_factor; /* See README.rulesets */ struct { @@ -422,5 +412,4 @@ #define GAME_DEFAULT_SAVE_NAME "civgame" -#define GAME_DEFAULT_RULESET "default" #define GAME_DEFAULT_SKILL_LEVEL 3 /* easy */ diff -u2NrX freeciv/diff_ignore freeciv/common/shared.c freeciv-phased/common/shared.c --- freeciv/common/shared.c Sat Feb 16 17:05:08 2002 +++ freeciv-phased/common/shared.c Fri Feb 22 01:05:30 2002 @@ -734,9 +734,6 @@ } - freelog(LOG_ERROR, _("Could not find readable file \"%s\" in data path."), + freelog(LOG_NORMAL, _("Could not find readable file \"%s\" in data path."), filename); - freelog(LOG_ERROR, _("The data path may be set via" - " the environment variable FREECIV_PATH.")); - freelog(LOG_ERROR, _("Current data path is: \"%s\""), datafilename(NULL)); return NULL; @@ -757,4 +754,7 @@ return dname; } else { + freelog(LOG_ERROR, _("The data path may be set via" + " the environment variable FREECIV_PATH.")); + freelog(LOG_ERROR, _("Current data path is: \"%s\""), datafilename(NULL)); freelog(LOG_FATAL, _("The \"%s\" file is required ... aborting!"), filename); diff -u2NrX freeciv/diff_ignore freeciv/data/classic/Makefile.am freeciv-phased/data/classic/Makefile.am --- freeciv/data/classic/Makefile.am Tue Sep 28 15:02:14 1999 +++ freeciv-phased/data/classic/Makefile.am Thu Jan 1 00:00:00 1970 @@ -1,9 +0,0 @@ -## Process this file with automake to produce Makefile.in - -## Override automake so that "make install" puts these in proper place: -pkgdatadir = $(datadir)/@PACKAGE@/classic - -pkgdata_DATA = \ - terrain.ruleset - -EXTRA_DIST = $(pkgdata_DATA) diff -u2NrX freeciv/diff_ignore freeciv/data/classic/terrain.ruleset freeciv-phased/data/classic/terrain.ruleset --- freeciv/data/classic/terrain.ruleset Mon Jul 10 04:42:12 2000 +++ freeciv-phased/data/classic/terrain.ruleset Thu Jan 1 00:00:00 1970 @@ -1,578 +0,0 @@ - -; Modifying this file: -; You should not modify this file except to make bugfixes or -; for other "maintenance". If you want to make custom changes, -; you should create a new datadir subdirectory and copy this file -; into that directory, and then modify that copy. Then use the -; command "set terrain " in the server to have freeciv -; use your new customized file. - -; Note that the freeciv AI may not cope well with anything more -; than minor changes. - -[datafile] -description="Classic tile_type data for Freeciv" -options="1.9" - -[options] -river_style=1 ; 1 means Civ1-style, 2 means Civ2-style -may_road=1 ; 0 means no, 1 means yes -may_irrigate=1 ; 0 means no, 1 means yes -may_mine=1 ; 0 means no, 1 means yes -may_transform=1 ; 0 means no, 1 means yes - -[parameters] - -; number of "land" tiles required to be adjacent to an ocean tile before -; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere) -ocean_reclaim_requirement=9 - -; number of "ocean" tiles required to be adjacent to a land tile before -; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere) -land_channel_requirement=9 - -; special movement costs for rivers: -; 0 - normal movement cost for rivers (matches Civ1) -; 1 - 1/3 movement cost, but only when moving exactly along rivers, -; diagonal moves incur full terrain movement costs (matches Civ2) -; 2 - 1/3 movement cost directly along river, 2/3 for diagonals (this -; is effectively the same as '1', as if you had done the two moves, -; except for differences relating to ZOC, etc.) -; 3 - 1/3 movement cost for any river to river move (classic Freeciv) -river_move_mode=3 - -; percent added to defense if square is Civ2-style river -river_defense_bonus=0 - -; amount added to trade production if square is Civ2-style river -river_trade_incr=0 - -; help text for Civ2-style rivers -river_help_text="" - -; percent added to defense if square has fortress -fortress_defense_bonus=100 - -; percent added to trade production if road and city has superhighways -road_superhighway_trade_bonus=50 - -; percent added to food production if square has railroad -rail_food_bonus=0 - -; percent added to shield production if square has railroad -rail_shield_bonus=50 - -; percent added to trade production if square has railroad -rail_trade_bonus=0 - -; percent added to food production if farmland and city has supermarket -farmland_supermarket_food_bonus=50 - -; percent subtracted from food production if square is polluted -pollution_food_penalty=50 - -; percent subtracted from shield production if square is polluted -pollution_shield_penalty=50 - -; percent subtracted from trade production if square is polluted -pollution_trade_penalty=50 - -; percent subtracted from food production if square has fallout -fallout_food_penalty=50 - -; percent subtracted from shield production if square has fallout -fallout_shield_penalty=50 - -; percent subtracted from trade production if square has fallout -fallout_trade_penalty=50 - -; Below: The individual terrain types, one per section. -; For now, the number of such sections must be kept the same (=12). -; Also, terrains should be in the same order as defined in common/map.h, -; and have similar roles/effects, as some things are still hardwired. -; The actual tag used (the * in [terrain_*]) does not matter, except -; it must be unique for each terrain, and it may be used in debug -; output when reading this file. -; -; Notes: -; -; terrain_name = name as seen by user; if "unused", it is not used -; graphic = preferred base graphics tag in tilespec; must have -; tags with extensions _n0s0e0e0 etc. -; graphic_alt = alternate graphics tag if preferred is not found; -; should be a standard tag if preferred is not; -; otherwise may be "-" -; movement_cost = typically 1 to 3 -; defense_bonus = 10 times actual; typically 10 to 30 (1.0 to 3.0) -; food = normal food production -; shield = normal shield production -; trade = normal trade production -; special_1_name = name of special; if "none", special is not used -; graphic_special_1 = full tilespec tag -; graphic_special_1a = alternate -; food_special_1 = special (1) food production -; shield_special_1 = special (1) shield production -; trade_special_1 = special (1) trade production -; special_2_name = name of special; if "none", special is not used -; graphic_special_2 = full tilespec tag -; graphic_special_2a = alternate -; food_special_2 = special (2) food production -; shield_special_2 = special (2) shield production -; trade_special_2 = special (2) trade production -; road_trade_incr = increment to trade if square has road -; road_time = time to build road; if 0, cannot build road -; irrigation_result = result of irrigation; one of: -; "no" -- cannot irrigate -; "yes" -- can irrigate -; terrain name -- irrigation changes to that terrain -; irrigation_food_incr = increment to food if square is irrigated -; irrigation_time = time to irrigate; if 0, cannot irrigate -; mining_result = result of mining; one of: -; "no" -- cannot mine -; "yes" -- can mine -; terrain name -- mining changes to that terrain -; mining_shield_incr = increment to shields if square is mined -; mining_time = time to mine; if 0, cannot mine -; transform_result = result of transformation; one of: -; "no" -- cannot transform -; terrain name -- transformation changes to that terrain -; transform_time = time to transform; if 0, cannot transform -; helptext = optional help text string; should escape all raw -; newlines so that xgettext parsing works - -[terrain_arctic] -terrain_name = _("Arctic") -graphic = "t.arctic" -graphic_alt = "-" -movement_cost = 2 -defense_bonus = 10 -food = 0 -shield = 0 -trade = 0 -special_1_name = _("Seals") -graphic_special_1 = "ts.seals" -graphic_special_1a = "-" -food_special_1 = 2 -shield_special_1 = 0 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 4 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "Tundra" -transform_time = 24 -helptext = _("\ -Arctic squares are found only in the most northerly or southerly\ - reaches of the world. They are very cold, and hence difficult to\ - work with.\ -") - -[terrain_desert] -terrain_name = _("Desert") -graphic = "t.desert" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 10 -food = 0 -shield = 1 -trade = 0 -special_1_name = _("Oasis") -graphic_special_1 = "ts.oasis" -graphic_special_1a = "-" -food_special_1 = 3 -shield_special_1 = 1 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 1 -road_time = 2 -irrigation_result = "yes" -irrigation_food_incr = 1 -irrigation_time = 5 -mining_result = "yes" -mining_shield_incr = 1 -mining_time = 5 -transform_result = "Plains" -transform_time = 24 -helptext = _("\ -Deserts are regions of extreme dryness, making agriculture and\ - trade very difficult.\ -") - -[terrain_forest] -terrain_name = _("Forest") -graphic = "t.forest" -graphic_alt = "-" -movement_cost = 2 -defense_bonus = 15 -food = 1 -shield = 2 -trade = 0 -special_1_name = _("?animals:Game") -graphic_special_1 = "ts.forest_game" -graphic_special_1a = "-" -food_special_1 = 3 -shield_special_1 = 2 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 4 -irrigation_result = "Plains" -irrigation_food_incr = 0 -irrigation_time = 5 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "Grassland" -transform_time = 24 -helptext = _("\ -Forests are densely wooded, making agriculture somewhat\ - problematic.\ -") - -[terrain_grassland] -terrain_name = _("Grassland") -graphic = "t.grassland" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 10 -food = 2 -shield = 0 -trade = 0 -special_1_name = _("Resources") -graphic_special_1 = "ts.grassland_resources" -graphic_special_1a = "-" -food_special_1 = 2 -shield_special_1 = 1 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 1 -road_time = 2 -irrigation_result = "yes" -irrigation_food_incr = 1 -irrigation_time = 5 -mining_result = "Forest" -mining_shield_incr = 0 -mining_time = 10 -transform_result = "Hills" -transform_time = 24 -helptext = _("\ -Grasslands afford exceptional agricultural opportunities.\ -") - -[terrain_hills] -terrain_name = _("Hills") -graphic = "t.hills" -graphic_alt = "-" -movement_cost = 2 -defense_bonus = 20 -food = 1 -shield = 0 -trade = 0 -special_1_name = _("Coal") -graphic_special_1 = "ts.coal" -graphic_special_1a = "-" -food_special_1 = 1 -shield_special_1 = 2 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 4 -irrigation_result = "yes" -irrigation_food_incr = 1 -irrigation_time = 10 -mining_result = "yes" -mining_shield_incr = 3 -mining_time = 10 -transform_result = "Plains" -transform_time = 24 -helptext = _("\ -In addition to being amenable to agriculture, Hills are frequently\ - rich in resources.\ -") - -[terrain_jungle] -terrain_name = _("Jungle") -graphic = "t.jungle" -graphic_alt = "-" -movement_cost = 2 -defense_bonus = 15 -food = 1 -shield = 0 -trade = 0 -special_1_name = _("Gems") -graphic_special_1 = "ts.gems" -graphic_special_1a = "-" -food_special_1 = 1 -shield_special_1 = 0 -trade_special_1 = 4 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 4 -irrigation_result = "Grassland" -irrigation_food_incr = 0 -irrigation_time = 15 -mining_result = "Forest" -mining_shield_incr = 0 -mining_time = 15 -transform_result = "Plains" -transform_time = 24 -helptext = _("\ -Jungles are densely overgrown, making agriculture somewhat\ - problematic.\ -") - -[terrain_mountains] -terrain_name = _("Mountains") -graphic = "t.mountains" -graphic_alt = "-" -movement_cost = 3 -defense_bonus = 30 -food = 0 -shield = 1 -trade = 0 -special_1_name = _("Gold") -graphic_special_1 = "ts.gold" -graphic_special_1a = "-" -food_special_1 = 0 -shield_special_1 = 1 -trade_special_1 = 5 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 6 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "yes" -mining_shield_incr = 1 -mining_time = 10 -transform_result = "Hills" -transform_time = 24 -helptext = _("\ -Mountains are regions of extreme altitude, making agriculture and\ - trade very difficult.\ -") - -[terrain_ocean] -terrain_name = _("Ocean") -graphic = "t.ocean" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 10 -food = 1 -shield = 0 -trade = 2 -special_1_name = _("Fish") -graphic_special_1 = "ts.fish" -graphic_special_1a = "-" -food_special_1 = 3 -shield_special_1 = 0 -trade_special_1 = 2 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 0 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -helptext = _("\ -Oceans cover much of the world, and only sea units (Triremes and\ - other boats) can travel on them.\ -\n\n\ -Ocean squares can never be polluted or subjected to fallout.\ -") - -[terrain_plains] -terrain_name = _("Plains") -graphic = "t.plains" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 10 -food = 1 -shield = 1 -trade = 0 -special_1_name = _("Horses") -graphic_special_1 = "ts.horses" -graphic_special_1a = "-" -food_special_1 = 3 -shield_special_1 = 1 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 1 -road_time = 2 -irrigation_result = "yes" -irrigation_food_incr = 1 -irrigation_time = 5 -mining_result = "Forest" -mining_shield_incr = 0 -mining_time = 15 -transform_result = "Grassland" -transform_time = 24 -helptext = _("\ -Plains are very broad, sparse regions, which makes trade slightly\ - inconvenient.\ -") - -[terrain_river] -terrain_name = _("River") -graphic = "t.t_river" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 15 -food = 2 -shield = 0 -trade = 1 -special_1_name = _("Resources") -graphic_special_1 = "ts.river_resources" -graphic_special_1a = "-" -food_special_1 = 2 -shield_special_1 = 1 -trade_special_1 = 1 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 2 -irrigation_result = "yes" -irrigation_food_incr = 1 -irrigation_time = 5 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "no" -transform_time = 0 -helptext = _("\ -In addition to providing for fishing, Rivers make for excellent\ - lines of communications and trade.\ -\n\n\ -Roads and railroads can only be built on River squares if your\ - civilization has learned Bridge Building technology.\ -") - -[terrain_swamp] -terrain_name = _("Swamp") -graphic = "t.swamp" -graphic_alt = "-" -movement_cost = 2 -defense_bonus = 15 -food = 1 -shield = 0 -trade = 0 -special_1_name = _("Oil") -graphic_special_1 = "ts.oil" -graphic_special_1a = "-" -food_special_1 = 1 -shield_special_1 = 4 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 4 -irrigation_result = "Grassland" -irrigation_food_incr = 0 -irrigation_time = 15 -mining_result = "Forest" -mining_shield_incr = 0 -mining_time = 15 -transform_result = "Plains" -transform_time = 24 -helptext = _("\ -Swamps suffer from an over-abundance of water, making agriculture\ - somewhat problematic.\ -") - -[terrain_tundra] -terrain_name = _("Tundra") -graphic = "t.tundra" -graphic_alt = "-" -movement_cost = 1 -defense_bonus = 10 -food = 1 -shield = 0 -trade = 0 -special_1_name = _("?animals:Game") -graphic_special_1 = "ts.tundra_game" -graphic_special_1a = "-" -food_special_1 = 3 -shield_special_1 = 0 -trade_special_1 = 0 -special_2_name = "none" -graphic_special_2 = "-" -graphic_special_2a = "-" -food_special_2 = 0 -shield_special_2 = 0 -trade_special_2 = 0 -road_trade_incr = 0 -road_time = 2 -irrigation_result = "no" -irrigation_food_incr = 0 -irrigation_time = 0 -mining_result = "no" -mining_shield_incr = 0 -mining_time = 0 -transform_result = "Desert" -transform_time = 24 -helptext = _("\ -Tundra are broad, cold regions, fit for some agriculture and little\ - else.\ -") diff -u2NrX freeciv/diff_ignore freeciv/server/civserver.c freeciv-phased/server/civserver.c --- freeciv/server/civserver.c Thu Feb 14 15:17:26 2002 +++ freeciv-phased/server/civserver.c Thu Feb 21 23:26:22 2002 @@ -76,4 +76,6 @@ } else if ((option = get_option("--log", argv, &inx, argc))) srvarg.log_filename = option; + else if ((option = get_option("--config", argv, &inx, argc))) + srvarg.rulesetdir = option; else if ((option = get_option("--gamelog", argv, &inx, argc))) srvarg.gamelog_filename = option; @@ -127,4 +129,5 @@ fprintf(stderr, _(" -f, --file FILE\tLoad saved game FILE\n")); fprintf(stderr, _(" -p, --port PORT\tListen for clients on port PORT\n")); + fprintf(stderr, _(" -c, --config DIR\tRead configuration rulesets from DIR\n")); fprintf(stderr, _(" -g, --gamelog FILE\tUse FILE as game logfile\n")); fprintf(stderr, _(" -l, --log FILE\tUse FILE as logfile\n")); diff -u2NrX freeciv/diff_ignore freeciv/server/ruleset.c freeciv-phased/server/ruleset.c --- freeciv/server/ruleset.c Mon Feb 18 00:17:00 2002 +++ freeciv-phased/server/ruleset.c Fri Feb 22 01:06:55 2002 @@ -37,4 +37,5 @@ #include "citytools.h" +#include "srv_main.h" #include "ruleset.h" @@ -45,5 +46,5 @@ static void openload_ruleset_file(struct section_file *file, - char *subdir, char *whichset); + char *whichset); static char *check_ruleset_capabilities(struct section_file *file, char *us_capstr, @@ -85,5 +86,5 @@ static void load_ruleset_nations(struct section_file *file); -static void load_ruleset_game(char *ruleset_subdir); +static void load_ruleset_game(); static void send_ruleset_techs(struct conn_list *dest); @@ -109,9 +110,13 @@ return dfilename; - freelog(LOG_ERROR, _("Trying alternative ruleset filename syntax.")); + freelog(LOG_NORMAL, _("Trying to load file from default ruleset directory instead.")); + my_snprintf(filename1, sizeof(filename1), "default/%s.ruleset", whichset); + dfilename = datafilename(filename1); + if (dfilename) + return dfilename; + freelog(LOG_ERROR, _("Trying alternative ruleset filename syntax.")); my_snprintf(filename2, sizeof(filename2), "%s_%s.ruleset", subdir, whichset); dfilename = datafilename(filename2); - if (dfilename) return dfilename; @@ -122,16 +127,11 @@ /************************************************************************** Do initial section_file_load on a ruleset file. - "subdir" = "default", "civ1", "custom", ... "whichset" = "techs", "units", "buildings", "terrain", ... Calls exit(EXIT_FAILURE) on failure. - This no longer returns the full filename opened; used secfile_filename() - if you want it. **************************************************************************/ - -static void openload_ruleset_file(struct section_file *file, - char *subdir, char *whichset) +static void openload_ruleset_file(struct section_file *file, char *whichset) { char sfilename[512]; - char *dfilename = valid_ruleset_filename(subdir, whichset); + char *dfilename = valid_ruleset_filename(srvarg.rulesetdir, whichset); if (!dfilename) { @@ -2171,7 +2171,7 @@ /************************************************************************** -Load game.ruleset file +Load ruleset file **************************************************************************/ -static void load_ruleset_game(char *ruleset_subdir) +static void load_ruleset_game() { struct section_file file; @@ -2180,5 +2180,5 @@ const char *filename; - openload_ruleset_file(&file, ruleset_subdir, "game"); + openload_ruleset_file(&file, "game"); filename = secfile_filename(&file); datafile_options = check_ruleset_capabilities(&file, "+1.11.1", filename); @@ -2627,23 +2627,23 @@ freelog(LOG_NORMAL, _("Loading rulesets")); - openload_ruleset_file(&techfile, game.ruleset.techs, "techs"); + openload_ruleset_file(&techfile, "techs"); load_tech_names(&techfile); - openload_ruleset_file(&buildfile, game.ruleset.buildings, "buildings"); + openload_ruleset_file(&buildfile, "buildings"); load_building_names(&buildfile); - openload_ruleset_file(&govfile, game.ruleset.governments, "governments"); + openload_ruleset_file(&govfile, "governments"); load_government_names(&govfile); - openload_ruleset_file(&unitfile, game.ruleset.units, "units"); + openload_ruleset_file(&unitfile, "units"); load_unit_names(&unitfile); - openload_ruleset_file(&terrfile, game.ruleset.terrain, "terrain"); + openload_ruleset_file(&terrfile, "terrain"); load_terrain_names(&terrfile); - openload_ruleset_file(&cityfile, game.ruleset.cities, "cities"); + openload_ruleset_file(&cityfile, "cities"); load_citystyle_names(&cityfile); - openload_ruleset_file(&nationfile, game.ruleset.nations, "nations"); + openload_ruleset_file(&nationfile, "nations"); load_nation_names(&nationfile); @@ -2655,5 +2655,5 @@ load_ruleset_buildings(&buildfile); load_ruleset_nations(&nationfile); - load_ruleset_game(game.ruleset.game); + load_ruleset_game(); translate_data_names(); } diff -u2NrX freeciv/diff_ignore freeciv/server/savegame.c freeciv-phased/server/savegame.c --- freeciv/server/savegame.c Mon Feb 18 23:06:07 2002 +++ freeciv-phased/server/savegame.c Fri Feb 22 00:27:27 2002 @@ -1835,22 +1835,13 @@ "game.randseed"); - sz_strlcpy(game.ruleset.techs, - secfile_lookup_str_default(file, "default", "game.ruleset.techs")); - sz_strlcpy(game.ruleset.units, - secfile_lookup_str_default(file, "default", "game.ruleset.units")); - sz_strlcpy(game.ruleset.buildings, - secfile_lookup_str_default(file, "default", - "game.ruleset.buildings")); - sz_strlcpy(game.ruleset.terrain, - secfile_lookup_str_default(file, "classic", - "game.ruleset.terrain")); - sz_strlcpy(game.ruleset.governments, - secfile_lookup_str_default(file, "default", - "game.ruleset.governments")); - sz_strlcpy(game.ruleset.nations, - secfile_lookup_str_default(file, "default", - "game.ruleset.nations")); - sz_strlcpy(game.ruleset.cities, - secfile_lookup_str_default(file, "default", "game.ruleset.cities")); + /* touch to prevent warnings */ + section_file_lookup(file, "game.ruleset.techs"); + section_file_lookup(file, "game.ruleset.units"); + section_file_lookup(file, "game.ruleset.buildings"); + section_file_lookup(file, "game.ruleset.terrain"); + section_file_lookup(file, "game.ruleset.governments"); + section_file_lookup(file, "game.ruleset.nations"); + section_file_lookup(file, "game.ruleset.cities"); + if(game.civstyle == 1) { string = "civ1"; @@ -1859,5 +1850,6 @@ game.civstyle = GAME_DEFAULT_CIVSTYLE; } - sz_strlcpy(game.ruleset.game, + + sz_strlcpy(srvarg.rulesetdir, secfile_lookup_str_default(file, string, "game.ruleset.game")); @@ -2155,12 +2147,12 @@ secfile_insert_int(file, game.onsetbarbarian, "game.onsetbarbs"); secfile_insert_int(file, game.occupychance, "game.occupychance"); - secfile_insert_str(file, game.ruleset.techs, "game.ruleset.techs"); - secfile_insert_str(file, game.ruleset.units, "game.ruleset.units"); - secfile_insert_str(file, game.ruleset.buildings, "game.ruleset.buildings"); - secfile_insert_str(file, game.ruleset.terrain, "game.ruleset.terrain"); - secfile_insert_str(file, game.ruleset.governments, "game.ruleset.governments"); - secfile_insert_str(file, game.ruleset.nations, "game.ruleset.nations"); - secfile_insert_str(file, game.ruleset.cities, "game.ruleset.cities"); - secfile_insert_str(file, game.ruleset.game, "game.ruleset.game"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.techs"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.units"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.buildings"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.terrain"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.governments"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.nations"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.cities"); + secfile_insert_str(file, srvarg.rulesetdir, "game.ruleset.game"); secfile_insert_str(file, game.demography, "game.demography"); secfile_insert_int(file, game.watchtower_vision, "game.watchtower_vision"); diff -u2NrX freeciv/diff_ignore freeciv/server/srv_main.c freeciv-phased/server/srv_main.c --- freeciv/server/srv_main.c Thu Feb 14 15:17:39 2002 +++ freeciv-phased/server/srv_main.c Thu Feb 21 23:38:13 2002 @@ -169,4 +169,5 @@ srvarg.log_filename = NULL; srvarg.gamelog_filename = NULL; + srvarg.rulesetdir = "default"; srvarg.load_filename = NULL; srvarg.script_filename = NULL; @@ -1825,4 +1826,9 @@ read_init_script(NULL,srvarg.script_filename); + if(game.is_new_game) { + load_rulesets(); + /* otherwise rulesets were loaded when savegame was loaded */ + } + freelog(LOG_NORMAL, _("Now accepting new client connections.")); while(server_state==PRE_GAME_STATE) @@ -1830,9 +1836,4 @@ send_server_info_to_metaserver(TRUE, FALSE); - - if(game.is_new_game) { - load_rulesets(); - /* otherwise rulesets were loaded when savegame was loaded */ - } nations_avail = fc_calloc(game.playable_nation_count, sizeof(int)); diff -u2NrX freeciv/diff_ignore freeciv/server/srv_main.h freeciv-phased/server/srv_main.h --- freeciv/server/srv_main.h Thu Feb 14 15:17:39 2002 +++ freeciv-phased/server/srv_main.h Thu Feb 21 23:28:53 2002 @@ -33,4 +33,5 @@ char *log_filename; char *gamelog_filename; + char *rulesetdir; char *load_filename; char *script_filename; diff -u2NrX freeciv/diff_ignore freeciv/server/stdinhand.c freeciv-phased/server/stdinhand.c --- freeciv/server/stdinhand.c Mon Feb 18 23:06:08 2002 +++ freeciv-phased/server/stdinhand.c Thu Feb 21 23:33:19 2002 @@ -136,8 +136,7 @@ }; -/******************************************************************** -Triggers used in settings_s. valid_ruleset() is clumsy because of -the fixed number of arguments and the reject_message - change? - rp -*********************************************************************/ +/* + * Triggers used in settings_s. + */ static int valid_notradesize(int value, char **reject_message); @@ -145,39 +144,4 @@ static int autotoggle(int value, char **reject_message); -static int valid_ruleset(char *whichset, char *subdir, char **reject_message) -{ - static char buffer[MAX_LEN_CONSOLE_LINE]; - - assert(subdir != NULL); - - *reject_message = buffer; - - if (!valid_ruleset_filename(subdir,whichset)) { - my_snprintf(buffer, sizeof(buffer), - _("Invalid ruleset subdirectory, keeping old value.")); - return 0; - } - - buffer[0] = '\0'; - - return 1; -} - -static int valid_techs_ruleset(char *v, char **r_m) - { return valid_ruleset("techs",v,r_m); } -static int valid_governments_ruleset(char *v, char **r_m) - { return valid_ruleset("governments",v,r_m); } -static int valid_units_ruleset(char *v, char **r_m) - { return valid_ruleset("units",v,r_m); } -static int valid_buildings_ruleset(char *v, char **r_m) - { return valid_ruleset("buildings",v,r_m); } -static int valid_terrain_ruleset(char *v, char **r_m) - { return valid_ruleset("terrain",v,r_m); } -static int valid_nations_ruleset(char *v, char **r_m) - { return valid_ruleset("nations",v,r_m); } -static int valid_cities_ruleset(char *v, char **r_m) - { return valid_ruleset("cities",v,r_m); } -static int valid_game_ruleset(char *v, char **r_m) - { return valid_ruleset("game",v,r_m); } static int valid_max_players(int v, char **r_m) { @@ -372,99 +336,4 @@ GAME_MIN_TECHLEVEL, GAME_MAX_TECHLEVEL, GAME_DEFAULT_TECHLEVEL, N_("Number of initial advances per player"), "", NULL, NULL, 0 }, - -/* Various rules: these cannot be changed once the game has started. */ - { "techs", NULL, NULL, valid_techs_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing techs.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"techs.ruleset\". " - "The advances (technologies) present in the game will be " - "initialized from this file. " - "See also README.rulesets."), - game.ruleset.techs, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.techs) }, - - { "governments", NULL, NULL, valid_governments_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing governments.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"governments.ruleset\". " - "The government types available in the game will be " - "initialized from this file. " - "See also README.rulesets."), - game.ruleset.governments, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.governments) }, - - { "units", NULL, NULL, valid_units_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing units.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"units.ruleset\". " - "The unit types present in the game will be " - "initialized from this file. " - "See also README.rulesets."), - game.ruleset.units, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.units) }, - - { "buildings", NULL, NULL, valid_buildings_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing buildings.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"buildings.ruleset\". " - "The building types (City Improvements and Wonders) " - "in the game will be initialized from this file. " - "See also README.rulesets."), - game.ruleset.buildings, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.buildings) }, - - { "terrain", NULL, NULL, valid_terrain_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing terrain.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"terrain.ruleset\". " - "The terrain types present in the game will be " - "initialized from this file. " - "See also README.rulesets."), - game.ruleset.terrain, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.terrain) }, - - { "nations", NULL, NULL, valid_nations_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing nations.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"nations.ruleset\". " - "The nations present in the game will be " - "initialized from this file. " - "See also README.rulesets."), - game.ruleset.nations, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.nations) }, - - { "cities", NULL, NULL, valid_cities_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing cities.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"cities.ruleset\". " - "The file is used to initialize city data (such as city style). " - "See also README.rulesets."), - game.ruleset.cities, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.cities) }, - - { "game", NULL, NULL, valid_game_ruleset, - SSET_RULES, SSET_TO_CLIENT, - 0, 0, 0, - N_("Data subdir containing game.ruleset"), - N_("This should specify a subdirectory of the data directory, " - "containing a file called \"game.ruleset\". " - "The file is used to initialize some miscellanous game rules. " - "See also README.rulesets."), - game.ruleset.game, GAME_DEFAULT_RULESET, - sizeof(game.ruleset.game) }, { "researchcost", &game.researchcost, NULL, NULL,