diff client/gui-gtk/menu.c client/gui-gtk/menu.c --- client/gui-gtk/menu.c Fri Apr 28 15:40:03 2000 +++ client/gui-gtk/menu.c Fri Apr 28 15:40:42 2000 @@ -956,7 +956,7 @@ (get_tile_type(tinfo->irrigation_result))->terrain_name); } else if ((map_get_tile(punit->x,punit->y)->special&S_IRRIGATION) && - player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) + player_knows_infrastructure_tech(game.player_ptr, TF_FARMLAND)) { sz_strlcpy (irrtext, _("Build Farmland")); } diff client/gui-mui/gui_main.c client/gui-mui/gui_main.c --- client/gui-mui/gui_main.c Fri Apr 28 15:41:58 2000 +++ client/gui-mui/gui_main.c Fri Apr 28 15:42:08 2000 @@ -1205,7 +1205,7 @@ sprintf(irrtext, chgfmt, (get_tile_type(tinfo->irrigation_result))->terrain_name); } else if ((map_get_tile(punit->x, punit->y)->special & S_IRRIGATION) && - player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) + player_knows_infrastructure_tech(game.player_ptr, TF_FARMLAND)) { strcpy(irrtext, "Build Farmland"); } diff client/gui-mui/mapclass.c client/gui-mui/mapclass.c --- client/gui-mui/mapclass.c Fri Apr 28 15:41:40 2000 +++ client/gui-mui/mapclass.c Fri Apr 28 15:42:19 2000 @@ -1876,7 +1876,7 @@ { static char irrtext[64]; if ((map_get_tile(punit->x, punit->y)->special & S_IRRIGATION) && - player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) + player_knows_infrastructure_tech(game.player_ptr, TF_FARMLAND)) { strcpy(irrtext, "Build Farmland"); } diff client/gui-xaw/menu.c client/gui-xaw/menu.c --- client/gui-xaw/menu.c Fri Apr 28 15:41:10 2000 +++ client/gui-xaw/menu.c Fri Apr 28 15:41:03 2000 @@ -351,7 +351,8 @@ (get_tile_type(tinfo->irrigation_result))->terrain_name); } else if ((map_get_tile(punit->x,punit->y)->special&S_IRRIGATION) && - player_knows_techs_with_flag(game.player_ptr, TF_FARMLAND)) { + player_knows_infrastructure_tech(game.player_ptr, TF_FARMLAND)) +{ menu_entry_rename(MENU_ORDER, MENU_ORDER_IRRIGATE, TEXT_ORDER_IRRIGATE_FARMLAND, NULL); } else { diff common/city.c common/city.c --- common/city.c Fri Apr 28 15:35:21 2000 +++ common/city.c Fri Apr 28 15:37:07 2000 @@ -794,7 +794,7 @@ f += type->irrigation_food_incr; if (((spec_t & S_FARMLAND) || (city_auto_water && - player_knows_techs_with_flag(city_owner(pcity), TF_FARMLAND))) && + player_knows_infrastructure_tech(city_owner(pcity), TF_FARMLAND))) && city_got_building(pcity, B_SUPERMARKET)) { f += (f * terrain_control.farmland_supermarket_food_bonus) / 100; } diff common/player.c common/player.c --- common/player.c Fri Apr 28 15:35:36 2000 +++ common/player.c Fri Apr 28 15:36:51 2000 @@ -269,6 +269,14 @@ return count; } + +int player_knows_infrastructure_tech(struct player *pplayer, int flag) +{ + if(tech_flag(A_NONE,flag)) + return 1; + return player_knows_techs_with_flag(pplayer,flag); +} + /************************************************************************** The following limits a player's rates to those that are acceptable for the present form of government. If a rate exceeds maxrate for this government, diff common/player.h common/player.h --- common/player.h Fri Apr 28 15:35:45 2000 +++ common/player.h Fri Apr 28 15:36:55 2000 @@ -169,6 +169,7 @@ int player_knows_improvement_tech(struct player *pplayer, Impr_Type_id id); int player_knows_techs_with_flag(struct player *pplayer, int flag); +int player_knows_infrastructure_tech( struct player *pplayer, int flag ); void player_limit_to_government_rates(struct player *pplayer); diff common/tech.c common/tech.c --- common/tech.c Fri Apr 28 15:35:55 2000 +++ common/tech.c Fri Apr 28 15:36:29 2000 @@ -28,7 +28,8 @@ static char *flag_names[] = { "Bonus_Tech","Boat_Fast","Bridge","Railroad","Fortress", - "Population_Pollution_Inc","Trade_Revenue_Reduce","Airbase","Farmland" + "Population_Pollution_Inc","Trade_Revenue_Reduce","Airbase","Farmland", + "Road","Mine","Irrigation" }; diff common/tech.h common/tech.h --- common/tech.h Fri Apr 28 15:36:02 2000 +++ common/tech.h Fri Apr 28 15:36:34 2000 @@ -51,6 +51,9 @@ reduces the initial revenue by cumulative factors of 2/3 */ TF_AIRBASE, /* "Airbase" unit types can build Airbases */ TF_FARMLAND, /* "Settler" unit types can build farmland */ + TF_ROAD, /* "Settler" unit types can build roads */ + TF_MINE, /* "Settler" unit types can build mines */ + TF_IRRIGATION, /* "Settler" unit types can irrigate */ TF_LAST }; diff common/unit.c common/unit.c --- common/unit.c Fri Apr 28 15:36:10 2000 +++ common/unit.c Fri Apr 28 15:36:20 2000 @@ -821,9 +821,9 @@ if (activity == ACTIVITY_ROAD || activity == ACTIVITY_IRRIGATE || (activity == ACTIVITY_RAILROAD - && player_knows_techs_with_flag(pplayer, TF_RAILROAD)) + && player_knows_infrastructure_tech(pplayer, TF_RAILROAD)) || (activity == ACTIVITY_FORTRESS - && player_knows_techs_with_flag(pplayer, TF_FORTRESS))) + && player_knows_infrastructure_tech(pplayer, TF_FORTRESS))) return 1; return 0; @@ -952,8 +952,9 @@ return terrain_control.may_road && unit_flag(punit->type, F_SETTLERS) && !(ptile->special&S_ROAD) && type->road_time && + player_knows_infrastructure_tech(pplayer, TF_ROAD) && ((ptile->terrain!=T_RIVER && !(ptile->special&S_RIVER)) || - player_knows_techs_with_flag(pplayer, TF_BRIDGE)); + player_knows_infrastructure_tech(pplayer, TF_BRIDGE)); case ACTIVITY_MINE: /* Don't allow it if someone else is irrigating this tile. @@ -961,7 +962,8 @@ if (terrain_control.may_mine && unit_flag(punit->type, F_SETTLERS) && ( (ptile->terrain==type->mining_result && - !(ptile->special&S_MINE)) || + !(ptile->special&S_MINE) && + player_knows_infrastructure_tech(pplayer, TF_MINE)) || (ptile->terrain!=type->mining_result && type->mining_result!=T_LAST && (ptile->terrain!=T_OCEAN || @@ -982,9 +984,10 @@ unit_flag(punit->type, F_SETTLERS) && (!(ptile->special&S_IRRIGATION) || (!(ptile->special&S_FARMLAND) && - player_knows_techs_with_flag(pplayer, TF_FARMLAND))) && + player_knows_infrastructure_tech(pplayer, TF_FARMLAND))) && ( (ptile->terrain==type->irrigation_result && - is_water_adjacent_to_tile(punit->x, punit->y)) || + is_water_adjacent_to_tile(punit->x, punit->y) && + player_knows_infrastructure_tech(pplayer, TF_IRRIGATION)) || (ptile->terrain!=type->irrigation_result && type->irrigation_result!=T_LAST && (ptile->terrain!=T_OCEAN || @@ -1008,12 +1011,12 @@ case ACTIVITY_FORTRESS: return unit_flag(punit->type, F_SETTLERS) && - player_knows_techs_with_flag(pplayer, TF_FORTRESS) && + player_knows_infrastructure_tech(pplayer, TF_FORTRESS) && !(ptile->special&S_FORTRESS) && ptile->terrain!=T_OCEAN; case ACTIVITY_AIRBASE: return unit_flag(punit->type, F_AIRBASE) && - player_knows_techs_with_flag(pplayer, TF_AIRBASE) && + player_knows_infrastructure_tech(pplayer, TF_AIRBASE) && !(ptile->special&S_AIRBASE) && ptile->terrain!=T_OCEAN; case ACTIVITY_SENTRY: @@ -1026,9 +1029,9 @@ ((ptile->special&S_ROAD) || (punit->connecting && (type->road_time && ((ptile->terrain!=T_RIVER && !(ptile->special&S_RIVER)) - || player_knows_techs_with_flag(pplayer, TF_BRIDGE))))) + || player_knows_infrastructure_tech(pplayer, TF_BRIDGE))))) && !(ptile->special&S_RAILROAD) && - player_knows_techs_with_flag(pplayer, TF_RAILROAD); + player_knows_infrastructure_tech(pplayer, TF_RAILROAD); case ACTIVITY_PILLAGE: { diff data/civ1/techs.ruleset data/civ1/techs.ruleset --- data/civ1/techs.ruleset Fri Apr 28 15:33:45 2000 +++ data/civ1/techs.ruleset Fri Apr 28 15:34:10 2000 @@ -38,8 +38,11 @@ ; "Railroad" = "Settler" unit types can build rail roads ; "Farmland" = "Settler" unit types can build farmland ; "Fortress" = "Settler" unit types can build fortress +; "Road" = "Settler" unit types can build roads +; "Mine" = "Settler" unit types can build mines +; "Irrigation" = "Settler" unit types can irrigate ; "Population_Pollution_Inc" = Increase the pollution factor created by -; popultaion by one +; population by one ; "Trade_Revenue_Reduce" = When known by the player establishing a trade ; route reduces the initial revenue by cumulative ; factors of 2/3 @@ -573,3 +576,5 @@ req2 = "None" flags = "" +[t_special] +start_infras = "Road","Irrigation","Mine" diff data/civ2/techs.ruleset data/civ2/techs.ruleset --- data/civ2/techs.ruleset Fri Apr 28 15:33:51 2000 +++ data/civ2/techs.ruleset Fri Apr 28 15:34:05 2000 @@ -38,8 +38,11 @@ ; "Railroad" = "Settler" unit types can build rail roads ; "Farmland" = "Settler" unit types can build farmland ; "Fortress" = "Settler" unit types can build fortress +; "Road" = "Settler" unit types can build roads +; "Mine" = "Settler" unit types can build mines +; "Irrigation" = "Settler" unit types can irrigate ; "Population_Pollution_Inc" = Increase the pollution factor created by -; popultaion by one +; population by one ; "Trade_Revenue_Reduce" = When known by the player establishing a trade ; route reduces the initial revenue by cumulative ; factors of 2/3 @@ -573,3 +576,5 @@ req2 = "None" flags = "" +[t_special] +start_infras = "Road","Irrigation","Mine" diff data/default/techs.ruleset data/default/techs.ruleset --- data/default/techs.ruleset Fri Apr 28 15:33:35 2000 +++ data/default/techs.ruleset Fri Apr 28 15:34:19 2000 @@ -38,8 +38,11 @@ ; "Railroad" = "Settler" unit types can build rail roads ; "Farmland" = "Settler" unit types can build farmland ; "Fortress" = "Settler" unit types can build fortress +; "Road" = "Settler" unit types can build roads +; "Mine" = "Settler" unit types can build mines +; "Irrigation" = "Settler" unit types can irrigate ; "Population_Pollution_Inc" = Increase the pollution factor created by -; popultaion by one +; population by one ; "Trade_Revenue_Reduce" = When known by the player establishing a trade ; route reduces the initial revenue by cumulative ; factors of 2/3 @@ -573,3 +576,5 @@ req2 = "None" flags = "" +[t_special] +start_infras = "Road","Irrigation","Mine" diff server/citytools.c server/citytools.c --- server/citytools.c Fri Apr 28 15:39:06 2000 +++ server/citytools.c Fri Apr 28 15:37:49 2000 @@ -322,7 +322,7 @@ values[B_GRANARY]=pcity->food_surplus*50; } if (can_build_improvement(pcity, B_SUPERMARKET) && - player_knows_techs_with_flag(plr, TF_FARMLAND)) + player_knows_infrastructure_tech(plr, TF_FARMLAND)) values[B_SUPERMARKET]=pcity->size*55; if (can_build_improvement(pcity, B_AQUEDUCT) @@ -1058,8 +1058,8 @@ send_city_info(0, pnewcity); if (terrain_control.may_road && - (player_knows_techs_with_flag (pplayer, TF_RAILROAD)) && - (!player_knows_techs_with_flag (cplayer, TF_RAILROAD)) && + (player_knows_infrastructure_tech(pplayer, TF_RAILROAD)) && + (!player_knows_infrastructure_tech(cplayer, TF_RAILROAD)) && (!(map_get_special (pnewcity->x, pnewcity->y) & S_RAILROAD))) { notify_player (pplayer, _("Game: The people in %s are stunned by your" diff server/ruleset.c server/ruleset.c --- server/ruleset.c Fri Apr 28 15:38:42 2000 +++ server/ruleset.c Fri Apr 28 15:38:07 2000 @@ -64,6 +64,8 @@ static void send_ruleset_governments(struct player *dest); static void send_ruleset_nations(struct player *dest); static void send_ruleset_cities(struct player *dest); +static void set_ruleset_tech_flag( struct advance *a, + char *filename, char **slist, int nval ); /************************************************************************** Do initial section_file_load on a ruleset file. @@ -368,9 +370,10 @@ struct section_file file; char *filename, *datafile_options; char **sec; + char **slist; struct advance *a; int num_techs; /* number of techs in the ruleset (means without A_NONE)*/ - int i; + int i, nval; filename = openload_ruleset_file(&file, ruleset_subdir, "techs"); datafile_options = check_ruleset_capabilities(&file, "+1.9", filename); @@ -408,8 +411,6 @@ a = &advances[A_FIRST]; for( i=0; ireq[0] = lookup_tech(&file, sec[i], "req1", 0, filename, a->name); a->req[1] = lookup_tech(&file, sec[i], "req2", 0, filename, a->name); @@ -427,27 +428,15 @@ a->req[1] = A_NONE; } - a->flags = 0; - slist = secfile_lookup_str_vec(&file, &nval, "%s.flags", sec[i]); - for(j=0; jname, sval, filename); - } - a->flags |= (1<helptext = lookup_helptext(&file, sec[i]); a++; } + slist = secfile_lookup_str_vec(&file, &nval, "t_special.start_infras" ); + set_ruleset_tech_flag( &advances[A_NONE], filename, slist, nval ); /* Some more consistency checking: Non-removed techs depending on removed techs is too @@ -476,6 +465,33 @@ section_file_check_unused(&file, filename); section_file_free(&file); } + + + +static void set_ruleset_tech_flag( struct advance *a, + char *filename, char **slist, + int nval ) +{ + char *sval; + int j, ival; + + a->flags = 0; + + for(j=0; jname, sval, filename); + } + a->flags |= (1<terrain==type->irrigation_result && (ptile->special&S_IRRIGATION) && !(ptile->special&S_FARMLAND) && - player_knows_techs_with_flag(pplayer, TF_FARMLAND) && + player_knows_infrastructure_tech(pplayer, TF_FARMLAND) && !(ptile->special&S_MINE) && !(ptile->city) && (is_wet(pplayer,x,y) || is_wet(pplayer,x,y-1) || is_wet(pplayer,x,y+1) || is_wet(pplayer,x-1,y) || is_wet(pplayer,x+1,y)))) { @@ -653,7 +653,7 @@ ptile = map_get_tile(x, y); if (ptile->terrain != T_OCEAN && (((ptile->terrain != T_RIVER) && !(ptile->special&S_RIVER)) || - player_knows_techs_with_flag(pplayer, TF_BRIDGE)) && + player_knows_infrastructure_tech(pplayer, TF_BRIDGE)) && !(ptile->special&S_ROAD)) { ptile->special|=S_ROAD; /* have to do this to avoid reset_move_costs -- Syela */ m = city_tile_value(pcity, i, j, 0, 0); @@ -671,7 +671,7 @@ x = pcity->x + i - 2; y = pcity->y + j - 2; ptile = map_get_tile(x, y); if (ptile->terrain != T_OCEAN && - player_knows_techs_with_flag(pplayer, TF_RAILROAD) && + player_knows_infrastructure_tech(pplayer, TF_RAILROAD) && !(ptile->special&S_RAILROAD)) { spe_sav = ptile->special; ptile->special|=(S_ROAD | S_RAILROAD); diff server/unithand.c server/unithand.c --- server/unithand.c Fri Apr 28 15:38:32 2000 +++ server/unithand.c Fri Apr 28 15:38:22 2000 @@ -422,7 +422,7 @@ send_remove_unit(0, req->unit_id); if (terrain_control.may_road) { map_set_special(punit->x, punit->y, S_ROAD); - if (player_knows_techs_with_flag(pplayer, TF_RAILROAD)) + if (player_knows_infrastructure_tech(pplayer, TF_RAILROAD)) map_set_special(punit->x, punit->y, S_RAILROAD); } send_tile_info(0, punit->x, punit->y); @@ -754,7 +754,7 @@ if (is_ok_city_spot(punit->x, punit->y)) { if (terrain_control.may_road) { map_set_special(punit->x, punit->y, S_ROAD); - if (player_knows_techs_with_flag(pplayer, TF_RAILROAD)) + if (player_knows_infrastructure_tech(pplayer, TF_RAILROAD)) map_set_special(punit->x, punit->y, S_RAILROAD); } send_tile_info(0, punit->x, punit->y);