? pim Index: client/packhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v retrieving revision 1.53 diff -u -u -2 -r1.53 packhand.c --- packhand.c 1999/03/07 10:35:55 1.53 +++ packhand.c 1999/03/12 13:44:21 @@ -1002,5 +1002,5 @@ b->obsolete_by = p->obsolete_by; b->variant = p->variant; - + b->build_req = p->build_req; } Index: common/city.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.c,v retrieving revision 1.35 diff -u -u -2 -r1.35 city.c --- city.c 1999/02/18 23:00:16 1.35 +++ city.c 1999/03/12 13:44:23 @@ -796,9 +796,9 @@ /**************************************************************** -... + Check if we satisfy the requirements to build the improvement *****************************************************************/ - int could_build_improvement(struct city *pcity, enum improvement_type_id id) { /* modularized so the AI can choose the tech it wants -- Syela */ + int build_req=get_improvement_type(id)->build_req; if (!improvement_exists(id)) return 0; @@ -808,15 +808,5 @@ city_got_building(pcity, B_NUCLEAR)) && (id==B_POWER || id==B_HYDRO || id==B_NUCLEAR)) return 0; - if (id==B_RESEARCH && !city_got_building(pcity, B_UNIVERSITY)) - return 0; - if (id==B_UNIVERSITY && !city_got_building(pcity, B_LIBRARY)) - return 0; - if (id==B_STOCK && !city_got_building(pcity, B_BANK)) - return 0; - if (id == B_SEWER && !city_got_building(pcity, B_AQUEDUCT)) - return 0; - if (id==B_BANK && !city_got_building(pcity, B_MARKETPLACE)) - return 0; - if (id==B_MFG && !city_got_building(pcity, B_FACTORY)) + if ((build_req != B_LAST) && (!city_got_building(pcity,build_req))) return 0; if ((id==B_HARBOUR || id==B_COASTAL || id == B_OFFSHORE || id == B_PORT) && !is_terrain_near_tile(pcity->x, pcity->y, T_OCEAN)) Index: common/city.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.h,v retrieving revision 1.29 diff -u -u -2 -r1.29 city.h --- city.h 1999/03/01 08:15:27 1.29 +++ city.h 1999/03/12 13:44:23 @@ -43,4 +43,5 @@ int obsolete_by; int variant; + int build_req; }; Index: common/packets.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v retrieving revision 1.34 diff -u -u -2 -r1.34 packets.c --- packets.c 1999/03/05 23:43:35 1.34 +++ packets.c 1999/03/12 13:44:23 @@ -1682,4 +1682,5 @@ cptr=put_int8(cptr, packet->obsolete_by); cptr=put_int8(cptr, packet->variant); + cptr=put_int8(cptr, packet->build_req); cptr=put_string(cptr, packet->name); put_int16(buffer, cptr-buffer); @@ -1708,4 +1709,5 @@ cptr=get_int8(cptr, &packet->obsolete_by); cptr=get_int8(cptr, &packet->variant); + cptr=get_int8(cptr, &packet->build_req); cptr=get_string(cptr, packet->name); Index: common/packets.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v retrieving revision 1.23 diff -u -u -2 -r1.23 packets.h --- packets.h 1999/03/05 23:43:36 1.23 +++ packets.h 1999/03/12 13:44:23 @@ -448,4 +448,5 @@ int obsolete_by; int variant; + int build_req; }; Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.38 diff -u -u -2 -r1.38 shared.h --- shared.h 1999/03/05 23:43:37 1.38 +++ shared.h 1999/03/12 13:44:23 @@ -73,5 +73,5 @@ /* The default string is really simple */ -#define CAPABILITY "+1.8pre2" +#define CAPABILITY "+1.8pre2 +build_req" #define CITY_NAMES_FONT "10x20" Index: data/default/buildings.ruleset =================================================================== RCS file: /home/freeciv/CVS/freeciv/data/default/buildings.ruleset,v retrieving revision 1.2 diff -u -u -2 -r1.2 buildings.ruleset --- buildings.ruleset 1999/02/20 05:13:20 1.2 +++ buildings.ruleset 1999/03/12 13:44:23 @@ -25,89 +25,90 @@ ; Variant: controls hardwired effects options, unique to each ; building; 0 means default effect. +; build_req: building required for improvement -b={ "name", "is_wonder", "tech_requirement", "build_cost", "shield_upkeep", "variant", "obsolete_by" +b={ "name", "is_wonder", "tech_requirement", "build_cost", "shield_upkeep", "variant", "obsolete_by", "build_requirement" ; City Improvements: -; Name, is_wonder, tech_required, bcost, upk, var, obsolete_by: +; Name, is_wonder, tech_required, bcost, upk, var, obsoleted, build_req: -"Airport", 0, "Radio", 160, 3, 0, "None" -"Aqueduct", 0, "Construction", 80, 2, 0, "None" -"Bank", 0, "Banking", 120, 3, 0, "None" -"Barracks", 0, "None", 40, 1, 0, "Gunpowder" -"Barracks II", 0, "Gunpowder", 40, 1, 0, "Mobile Warfare" -"Barracks III", 0, "Mobile Warfare", 40, 1, 0, "None" -"Cathedral", 0, "Monotheism", 120, 3, 0, "None" -"City Walls", 0, "Masonry", 80, 0, 0, "None" -"Coastal Defense", 0, "Metallurgy", 80, 1, 0, "None" -"Colosseum", 0, "Construction", 100, 4, 0, "None" -"Courthouse", 0, "Code of Laws", 80, 1, 0, "None" -"Factory", 0, "Industrialization", 200, 4, 0, "None" -"Granary", 0, "Pottery", 60, 1, 0, "None" -"Harbour", 0, "Seafaring", 60, 1, 0, "None" -"Hydro Plant", 0, "Electronics", 240, 4, 0, "None" -"Library", 0, "Writing", 80, 1, 0, "None" -"Marketplace", 0, "Currency", 80, 1, 0, "None" -"Mass Transit", 0, "Mass Production", 160, 4, 0, "None" -"Mfg. Plant", 0, "Robotics", 320, 6, 0, "None" -"Nuclear Plant", 0, "Nuclear Power", 160, 2, 0, "None" -"Offshore Platform", 0, "Miniaturization", 160, 3, 0, "None" -"Palace", 0, "Masonry", 100, 0, 0, "None" -"Police Station", 0, "Communism", 60, 2, 0, "None" -"Port Facility", 0, "Amphibious Warfare", 80, 3, 0, "None" -"Power Plant", 0, "Refining", 160, 4, 0, "None" -"Recycling Center", 0, "Recycling", 200, 2, 0, "None" -"Research Lab", 0, "Computers", 160, 3, 0, "None" -"SAM Battery", 0, "Rocketry", 100, 2, 0, "None" -"SDI Defense", 0, "Laser", 200, 4, 0, "None" -"Sewer System", 0, "Sanitation", 120, 2, 0, "None" +"Airport", 0, "Radio", 160, 3, 0, "None", 0 +"Aqueduct", 0, "Construction", 80, 2, 0, "None", 0 +"Bank", 0, "Banking", 120, 3, 0, "None", 17 +"Barracks", 0, "None", 40, 1, 0, "Gunpowder", 0 +"Barracks II", 0, "Gunpowder", 40, 1, 0, "Mobile Warfare",0 +"Barracks III", 0, "Mobile Warfare", 40, 1, 0, "None", 0 +"Cathedral", 0, "Monotheism", 120, 3, 0, "None", 0 +"City Walls", 0, "Masonry", 80, 0, 0, "None", 0 +"Coastal Defense", 0, "Metallurgy", 80, 1, 0, "None", 0 +"Colosseum", 0, "Construction", 100, 4, 0, "None", 0 +"Courthouse", 0, "Code of Laws", 80, 1, 0, "None", 0 +"Factory", 0, "Industrialization", 200, 4, 0, "None", 0 +"Granary", 0, "Pottery", 60, 1, 0, "None", 0 +"Harbour", 0, "Seafaring", 60, 1, 0, "None", 0 +"Hydro Plant", 0, "Electronics", 240, 4, 0, "None", 12 +"Library", 0, "Writing", 80, 1, 0, "None", 0 +"Marketplace", 0, "Currency", 80, 1, 0, "None", 0 +"Mass Transit", 0, "Mass Production", 160, 4, 0, "None", 0 +"Mfg. Plant", 0, "Robotics", 320, 6, 0, "None", 12 +"Nuclear Plant", 0, "Nuclear Power", 160, 2, 0, "None", 12 +"Offshore Platform", 0, "Miniaturization", 160, 3, 0, "None", 0 +"Palace", 0, "Masonry", 100, 0, 0, "None", 0 +"Police Station", 0, "Communism", 60, 2, 0, "None", 0 +"Port Facility", 0, "Amphibious Warfare", 80, 3, 0, "None", 0 +"Power Plant", 0, "Refining", 160, 4, 0, "None", 12 +"Recycling Center", 0, "Recycling", 200, 2, 0, "None", 0 +"Research Lab", 0, "Computers", 160, 3, 0, "None", 39 +"SAM Battery", 0, "Rocketry", 100, 2, 0, "None", 0 +"SDI Defense", 0, "Laser", 200, 4, 0, "None", 0 +"Sewer System", 0, "Sanitation", 120, 2, 0, "None", 2 ;"Solar Plant", 0, "Environmentalism", 320, 4, 0, "None" -"Solar Plant", 0, "Never", 320, 4, 0, "None" +"Solar Plant", 0, "Never", 320, 4, 0, "None", 0 -"Space Component", 0, "Plastics", 160, 0, 0, "None" -"Space Module", 0, "Superconductors", 320, 0, 0, "None" -"Space Structural", 0, "Space Flight", 80, 0, 0, "None" - -"Stock Exchange", 0, "Economics", 160, 4, 0, "None" -"Super Highways", 0, "Automobile", 160, 3, 0, "None" -"Supermarket", 0, "Refrigeration", 120, 3, 0, "None" -"Temple", 0, "Ceremonial Burial", 40, 1, 0, "None" -"University", 0, "University", 160, 3, 0, "None" +"Space Component", 0, "Plastics", 160, 0, 0, "None", 0 +"Space Module", 0, "Superconductors", 320, 0, 0, "None", 0 +"Space Structural", 0, "Space Flight", 80, 0, 0, "None", 0 + +"Stock Exchange", 0, "Economics", 160, 4, 0, "None", 17 +"Super Highways", 0, "Automobile", 160, 3, 0, "None", 0 +"Supermarket", 0, "Refrigeration", 120, 3, 0, "None", 0 +"Temple", 0, "Ceremonial Burial", 40, 1, 0, "None", 0 +"University", 0, "University", 160, 3, 0, "None", 16 ; Wonders: -; Name, is_wonder, tech_required, bcost, upk, var, obsolete_by: +; Name, is_wonder, tech_required, bcost, upk, var, obsolete_by, build_req: -"Apollo Program", 1, "Space Flight", 600, 0, 0, "None" -"A.Smith's Trading Co.", 1, "Economics", 400, 0, 0, "None" -"Colossus", 1, "Bronze Working", 200, 0, 0, "Flight" -"Copernicus' Observatory", 1, "Astronomy", 300, 0, 0, "None" -"Cure For Cancer", 1, "Genetic Engineering", 600, 0, 0, "None" -"Darwin's Voyage", 1, "Railroad", 300, 0, 0, "None" -"Eiffel Tower", 1, "Never", 300, 0, 0, "None" -"Great Library", 1, "Literacy", 300, 0, 0, "Electricity" -"Great Wall", 1, "Masonry", 300, 0, 0, "Metallurgy" -"Hanging Gardens", 1, "Pottery", 200, 0, 0, "Railroad" -"Hoover Dam", 1, "Electronics", 600, 0, 0, "None" -"Isaac Newton's College", 1, "Theory of Gravity", 400, 0, 0, "None" -"J.S. Bach's Cathedral", 1, "Theology", 400, 0, 0, "None" -"King Richard's Crusade", 1, "Engineering", 300, 0, 0, "Industrialization" -"Leonardo's Workshop", 1, "Invention", 400, 0, 0, "Automobile" -"Lighthouse", 1, "Map Making", 200, 0, 0, "Magnetism" -"Magellan's Expedition", 1, "Navigation", 400, 0, 0, "None" -"Manhattan Project", 1, "Nuclear Fission", 600, 0, 0, "None" -"Marco Polo's Embassy", 1, "Never", 200, 0, 0, "Communism" -"Michelangelo's Chapel", 1, "Monotheism", 400, 0, 0, "None" -"Oracle", 1, "Mysticism", 300, 0, 0, "Theology" -"Pyramids", 1, "Masonry", 200, 0, 0, "None" -"SETI Program", 1, "Computers", 600, 0, 0, "None" -"Shakespeare's Theatre", 1, "Medicine", 300, 0, 0, "None" -"Statue of Liberty", 1, "Democracy", 400, 0, 0, "None" -"Sun Tzu's War Academy", 1, "Feudalism", 300, 0, 0, "Mobile Warfare" -"United Nations", 1, "Communism", 600, 0, 0, "None" -"Women's Suffrage", 1, "Industrialization", 600, 0, 0, "None" +"Apollo Program", 1, "Space Flight", 600, 0, 0, "None",0 +"A.Smith's Trading Co.", 1, "Economics", 400, 0, 0, "None",0 +"Colossus", 1, "Bronze Working", 200, 0, 0, "Flight",0 +"Copernicus' Observatory", 1, "Astronomy", 300, 0, 0, "None",0 +"Cure For Cancer", 1, "Genetic Engineering", 600, 0, 0, "None",0 +"Darwin's Voyage", 1, "Railroad", 300, 0, 0, "None",0 +"Eiffel Tower", 1, "Never", 300, 0, 0, "None",0 +"Great Library", 1, "Literacy", 300, 0, 0, "Electricity",0 +"Great Wall", 1, "Masonry", 300, 0, 0, "Metallurgy",0 +"Hanging Gardens", 1, "Pottery", 200, 0, 0, "Railroad",0 +"Hoover Dam", 1, "Electronics", 600, 0, 0, "None",0 +"Isaac Newton's College", 1, "Theory of Gravity", 400, 0, 0, "None",0 +"J.S. Bach's Cathedral", 1, "Theology", 400, 0, 0, "None",0 +"King Richard's Crusade", 1, "Engineering", 300, 0, 0, "Industrialization",0 +"Leonardo's Workshop", 1, "Invention", 400, 0, 0, "Automobile",0 +"Lighthouse", 1, "Map Making", 200, 0, 0, "Magnetism",0 +"Magellan's Expedition", 1, "Navigation", 400, 0, 0, "None",0 +"Manhattan Project", 1, "Nuclear Fission", 600, 0, 0, "None",0 +"Marco Polo's Embassy", 1, "Never", 200, 0, 0, "Communism",0 +"Michelangelo's Chapel", 1, "Monotheism", 400, 0, 0, "None",0 +"Oracle", 1, "Mysticism", 300, 0, 0, "Theology",0 +"Pyramids", 1, "Masonry", 200, 0, 0, "None",0 +"SETI Program", 1, "Computers", 600, 0, 0, "None",0 +"Shakespeare's Theatre", 1, "Medicine", 300, 0, 0, "None",0 +"Statue of Liberty", 1, "Democracy", 400, 0, 0, "None",0 +"Sun Tzu's War Academy", 1, "Feudalism", 300, 0, 0, "Mobile Warfare",0 +"United Nations", 1, "Communism", 600, 0, 0, "None",0 +"Women's Suffrage", 1, "Industrialization", 600, 0, 0, "None",0 ; Special: ; Name, is_wonder, tech_required, bcost, upk, var, obsolete_by: -"Capitalization", 0, "The Corporation", 999, 0, 0, "None" +"Capitalization", 0, "The Corporation", 999, 0, 0, "None",0 } Index: server/ruleset.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v retrieving revision 1.2 diff -u -u -2 -r1.2 ruleset.c --- ruleset.c 1999/02/10 18:26:56 1.2 +++ ruleset.c 1999/03/12 13:44:23 @@ -480,5 +480,5 @@ char *filename, *datafile_options; char prefix[64]; - int i, j; + int i, j, k; struct improvement_type *b; @@ -505,4 +505,9 @@ b->shield_upkeep = secfile_lookup_int(&file, "%s.shield_upkeep", prefix); b->variant = secfile_lookup_int(&file, "%s.variant", prefix); + k = secfile_lookup_int(&file, "%s.build_requirement", prefix); + if ( k == 0 ) + b->build_req = B_LAST; + else + b->build_req = k; } @@ -615,4 +620,5 @@ packet.obsolete_by = b->obsolete_by; packet.variant = b->variant; + packet.build_req = b->build_req; for(to=0; to