[freeciv-data] Freeciv Patch: Controls on access to specified techs.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
OK, here is the patch that modpack designers have been hoping for. The
attached .diff allows the rulesets to control players' access to various
portions of the tech tree, allowing a partition of the tree between your
various nations/races/species/whatevers. It operates by means of flags,
so that it has no effect whatsoever on existing rulesets.
Note: The patch is a "cvs diff -u" based on the CVS version as of
24-December-2000. It will not work with Freeciv 11.4.
Although Freeciv will compile and run if you apply this patch and not
the "initial techs" patch that I sent out last night, you will need that
"initial techs" patch in order to design a ruleset that enjoys the full
benefits of this one.
The patch provides two new flags for techs -
TF_NON_RESEARCHABLE, /* Tech is of a nature that cannot be researched
*/
TF_NON_TRANSFERABLE, /* Tech is of a nature that cannot be transferred
*/
By specifying these tags for various techs you can prevent a player from
getting inappropriate techs, and thus enforce disjoint sets of
units/improvements/wonders between different classes of nations. The
basic ruleset design strategy is to create some "base" techs, mark them
as non-researchable and non-transferable, grant them to specific sets of
nations at the start of the game using the mechanism in my "initial
techs" patch, and then use those "base" techs as pre-reqs for
units/improvements/wonders that should only be built by nations within
the appropriate set.
For example, the maintainers of the Middle Earth modpack might want to
create a base tech called "Elf Lore", mark it with both of the new
flags, grant it to the Vanyar, Noldor, and Teleri nations at the start
of the game (using my previous patch), and then make "Elf Lore" a direct
prerequisite for the tech that allows the unit type "Elven Archers".
When properly done, this will keep Humans and Dwarves from ever
acquiring that tech, and thus keep them from building the "Elven
Archers" unit type. (In this example the direct prerequisite tech will
also need to be marked as non-transferable.)
For flexibility, the control is specified by two separate flags, which
can be used either together or independently -
The TF_NON_RESEARCHABLE flag prevents:
o Selecting the tech for research (whether randomly or deliberately).
o Selecting the tech for a long-range research goal.
o Obtaining the tech as a bonus from obtaining some other tech (e.g.,
Philosophy in the standard ruleset).
The TF_NON_TRANSFERABLE flag prevents:
o Obtaining the tech from a hut.
o Obtaining the tech from the Great Library.
o Obtaining the tech as part of a treaty.
o Obtaining the tech by theft.
o Obtaining the tech by capturing a city.
Note: Please let me know if I have forgotten any other mechanisms for
obtaining a new tech.
Notice that if a tech is granted to a nation initially (per my previous
patch), that nation will receive it even if one or both of these new
flags is set. (If both flags are set for a tech, initial grants will be
the *only* way that that tech can be obtained in the game.)
For situations where you are allowed to choose a tech and one of these
flags makes certain choices illegal, those choices should not even
appear on the GUI displays. (Please let me know if I missed any spots.)
To specify the flags, add a line similar to one of the following to the
record for the tech in techs.ruleset -
flags = "Non_Researchable"
or
flags = "Non_Transferable"
or
flags = "Non_Researchable", "Non_Transferable"
You can flag as many techs as you wish, though you need to make sure all
nations have *something* that they can research.
The CVS version of techs.ruleset already has a flags field for all the
techs. For older rulesets, you can simply add the flag field to those
techs that need it; when using this patch you will not get an error for
techs that do not have a flags field. (Note to modpack maintainers:
you will need to update your techs.ruleset for the next release of
Freeciv anyway, because some formerly hard-coded features, such as the
ability to build fortresses and railroads, have now been moved to these
flag fields. )
You can also use these new flags in conjunction with the other flags
that have been added to the CVS version.
I have done some basic testing, but it does not look like I will be able
to test each possible circumstance where the flags apply within any
bounded amount of time, so I am releasing the patch now in hopes that
others will use it and help me trap anything I missed. If time allows,
I will create a test modpack to let you try out the new features.
However, these features are already badly needed by the Middle Earth
modpack maintainers, so if they have time to do an update, that might
provide the most robust test kit for this patch (and a lot of fun for us
to playtest, too).
I made changes to the GTK, XAW, and MUI clients (though frankly I
haven't figured out what the MUI client is yet). I did not change the
BeOS client, because I could not find where the tech lists were actually
built. (Is all the Be code actually in CVS?)
I have done the basic testing with both GTK and XAW, and am continuing
with more extensive testing under GTK.
Special thanks to whoever set up the basic flags mechanism for techs,
since that enormously simplified what I was trying to do. Ditto for
whoever set up the LXR source browser, which probably reduced my time
investment to 1/10 or 1/20 of what this would have taken otherwise.
Thank you for supporting Freeciv,
Bobby Bryant
Austin, Texas
-- Attached file included as plaintext by Listar --
-- File: controlled_techs.diff
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.62
diff -u -r1.62 dialogs.c
--- dialogs.c 2000/08/31 13:32:40 1.62
+++ dialogs.c 2000/12/24 18:30:23
@@ -736,11 +736,11 @@
gchar *row[1];
for(i=A_FIRST; i<game.num_tech_types; i++) {
- if(get_invention(pvictim, i)==TECH_KNOWN &&
+ if(get_invention(pvictim, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
(get_invention(pplayer, i)==TECH_UNKNOWN ||
get_invention(pplayer, i)==TECH_REACHABLE)) {
-
- row[0] = advances[i].name;
+ row[0] = advances[i].name;
gtk_clist_append(GTK_CLIST(spy_advances_list), row);
advance_type[j++] = i;
}
Index: client/gui-gtk/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/diplodlg.c,v
retrieving revision 1.22
diff -u -r1.22 diplodlg.c
--- diplodlg.c 2000/10/21 05:18:33 1.22
+++ diplodlg.c 2000/12/24 18:30:26
@@ -206,6 +206,7 @@
for(i=1, flag=0; i<game.num_tech_types; i++) {
if(get_invention(plr0, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
(get_invention(plr1, i)==TECH_UNKNOWN ||
get_invention(plr1, i)==TECH_REACHABLE))
{
Index: client/gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.31
diff -u -r1.31 repodlgs.c
--- repodlgs.c 2000/12/02 18:39:32 1.31
+++ repodlgs.c 2000/12/24 18:30:30
@@ -440,7 +440,8 @@
hist=0;
if (game.player_ptr->research.researching!=A_NONE) {
for(i=A_FIRST; i<game.num_tech_types; i++) {
- if(get_invention(game.player_ptr, i)!=TECH_REACHABLE)
+ if(get_invention(game.player_ptr, i)!=TECH_REACHABLE
+ || tech_flag(i, TF_NON_RESEARCHABLE) )
continue;
if (i==game.player_ptr->research.researching)
@@ -503,6 +504,7 @@
hist=0;
for(i=A_FIRST; i<game.num_tech_types; i++) {
if(get_invention(game.player_ptr, i) != TECH_KNOWN &&
+ !tech_flag(i, TF_NON_RESEARCHABLE) &&
advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
tech_goal_turns(game.player_ptr, i) < 11) {
if (i==game.player_ptr->ai.tech_goal)
Index: client/gui-mui/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/dialogs.c,v
retrieving revision 1.27
diff -u -r1.27 dialogs.c
--- dialogs.c 2000/09/08 16:36:38 1.27
+++ dialogs.c 2000/12/24 18:30:37
@@ -362,7 +362,10 @@
int any_tech = FALSE;
for(i=A_FIRST; i<game.num_tech_types; i++)
{
- if(get_invention(pvictim, i)==TECH_KNOWN && (get_invention(pplayer,
i)==TECH_UNKNOWN || get_invention(pplayer, i)==TECH_REACHABLE))
+ if(get_invention(pvictim, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
+ (get_invention(pplayer, i)==TECH_UNKNOWN ||
+ get_invention(pplayer, i)==TECH_REACHABLE))
{
DoMethod(listview, MUIM_NList_InsertSingle,
i+100,MUIV_NList_Insert_Bottom);
any_tech = TRUE;
Index: client/gui-mui/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/diplodlg.c,v
retrieving revision 1.8
diff -u -r1.8 diplodlg.c
--- diplodlg.c 2000/10/21 05:18:34 1.8
+++ diplodlg.c 2000/12/24 18:30:39
@@ -258,7 +258,10 @@
for(i=1, flag=0; i<game.num_tech_types; i++)
{
- if(get_invention(plr0, i)==TECH_KNOWN && (get_invention(plr1,
i)==TECH_UNKNOWN || get_invention(plr1, i)==TECH_REACHABLE))
+ if(get_invention(plr0, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
+ (get_invention(plr1, i)==TECH_UNKNOWN ||
+ get_invention(plr1, i)==TECH_REACHABLE))
{
entry = MUI_MakeObject(MUIO_Menuitem,advances[i].name,NULL,0,0);
set(entry,MUIA_UserData,i);
Index: client/gui-mui/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/repodlgs.c,v
retrieving revision 1.12
diff -u -r1.12 repodlgs.c
--- repodlgs.c 2000/09/08 01:53:26 1.12
+++ repodlgs.c 2000/12/24 18:30:43
@@ -234,7 +234,8 @@
{
for (i = A_FIRST, j = 0; i < game.num_tech_types; i++)
{
- if (get_invention(game.player_ptr, i) != TECH_REACHABLE)
+ if (get_invention(game.player_ptr, i) != TECH_REACHABLE
+ || tech_flag(i, TF_NON_RESEARCHABLE) )
continue;
j++;
}
@@ -245,7 +246,8 @@
{
for (i = A_FIRST, j = 0; i < game.num_tech_types; i++)
{
- if (get_invention(game.player_ptr, i) != TECH_REACHABLE)
+ if (get_invention(game.player_ptr, i) != TECH_REACHABLE
+ || tech_flag(i, TF_NON_RESEARCHABLE) )
continue;
if (i == game.player_ptr->research.researching)
science_research_active = j;
@@ -262,6 +264,7 @@
for (i = A_FIRST, j = 0; i < game.num_tech_types; i++)
{
if (get_invention(game.player_ptr, i) != TECH_KNOWN &&
+ !tech_flag(i, TF_NON_RESEARCHABLE) &&
advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
tech_goal_turns(game.player_ptr, i) < 11)
j++;
@@ -281,6 +284,7 @@
for (i = A_FIRST; i < game.num_tech_types; i++)
{
if (get_invention(game.player_ptr, i) != TECH_KNOWN &&
+ !tech_flag(i, TF_NON_RESEARCHABLE) &&
advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
tech_goal_turns(game.player_ptr, i) < 11)
{
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.52
diff -u -r1.52 dialogs.c
--- dialogs.c 2000/08/31 13:32:43 1.52
+++ dialogs.c 2000/12/24 18:30:51
@@ -760,10 +760,10 @@
if (pvictim) { /* you don't want to know what lag can do -- Syela */
for(i=A_FIRST; i<game.num_tech_types; i++) {
- if(get_invention(pvictim, i)==TECH_KNOWN &&
+ if(get_invention(pvictim, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
(get_invention(pplayer, i)==TECH_UNKNOWN ||
get_invention(pplayer, i)==TECH_REACHABLE)) {
-
advances_can_steal[j] = advances[i].name;
advance_type[j++] = i;
}
Index: client/gui-xaw/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/diplodlg.c,v
retrieving revision 1.22
diff -u -r1.22 diplodlg.c
--- diplodlg.c 2000/10/21 05:18:34 1.22
+++ diplodlg.c 2000/12/24 18:30:54
@@ -243,6 +243,7 @@
for(i=A_FIRST, flag=0; i<game.num_tech_types; i++) {
if(get_invention(plr0, i)==TECH_KNOWN &&
+ !tech_flag(i, TF_NON_TRANSFERABLE) &&
(get_invention(plr1, i)==TECH_UNKNOWN ||
get_invention(plr1, i)==TECH_REACHABLE)) {
Widget entry=
Index: client/gui-xaw/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/repodlgs.c,v
retrieving revision 1.25
diff -u -r1.25 repodlgs.c
--- repodlgs.c 2000/09/25 21:11:03 1.25
+++ repodlgs.c 2000/12/24 18:30:58
@@ -338,7 +338,8 @@
for(i=A_FIRST, flag=0; i<game.num_tech_types; i++)
- if(get_invention(game.player_ptr, i)==TECH_REACHABLE) {
+ if(get_invention(game.player_ptr, i)==TECH_REACHABLE
+ && !tech_flag(i, TF_NON_RESEARCHABLE) ) {
Widget entry=
XtVaCreateManagedWidget(advances[i].name, smeBSBObjectClass,
popupmenu, NULL);
@@ -352,6 +353,7 @@
for(i=A_FIRST, flag=0; i<game.num_tech_types; i++)
if(get_invention(game.player_ptr, i) != TECH_KNOWN &&
+ !tech_flag(i, TF_NON_RESEARCHABLE) &&
advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
tech_goal_turns(game.player_ptr, i) < 11) {
Widget entry=
@@ -550,7 +552,8 @@
NULL);
for(i=A_FIRST, flag=0; i<game.num_tech_types; i++)
- if(get_invention(game.player_ptr, i)==TECH_REACHABLE) {
+ if(get_invention(game.player_ptr, i)==TECH_REACHABLE
+ && !tech_flag(i, TF_NON_RESEARCHABLE) ) {
Widget entry=
XtVaCreateManagedWidget(advances[i].name, smeBSBObjectClass,
popupmenu, NULL);
@@ -571,6 +574,7 @@
for(i=A_FIRST, flag=0; i<game.num_tech_types; i++)
if(get_invention(game.player_ptr, i) != TECH_KNOWN &&
+ !tech_flag(i, TF_NON_RESEARCHABLE) &&
advances[i].req[0] != A_LAST && advances[i].req[1] != A_LAST &&
tech_goal_turns(game.player_ptr, i) < 11) {
Widget entry=
Index: common/tech.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v
retrieving revision 1.25
diff -u -r1.25 tech.c
--- tech.c 2000/09/11 06:40:38 1.25
+++ tech.c 2000/12/24 18:31:00
@@ -28,7 +28,8 @@
static const 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",
+ "Non_Researchable", "Non_Transferable"
};
/* Note that these strings must correspond with the enums in tech_flag_id,
in common/tech.h */
@@ -110,13 +111,15 @@
/**************************************************************************
-...don't use this function directly, call get_next_tech instead.
+Recursive function - don't call this function directly,
+ call it via get_next_tech instead.
**************************************************************************/
static int get_next_tech_rec(struct player *plr, int goal)
{
int sub_goal;
- if (!tech_exists(goal) || get_invention(plr, goal) == TECH_KNOWN)
- return 0;
+ if (!tech_exists(goal) || get_invention(plr, goal) == TECH_KNOWN ||
+ tech_flag(goal, TF_NON_RESEARCHABLE) )
+ return A_NONE;
if (get_invention(plr, goal) == TECH_REACHABLE)
return goal;
sub_goal = get_next_tech_rec(plr, advances[goal].req[0]);
@@ -136,7 +139,8 @@
int get_next_tech(struct player *plr, int goal)
{
if (goal == A_NONE || !tech_exists(goal) ||
- get_invention(plr, goal) == TECH_KNOWN)
+ get_invention(plr, goal) == TECH_KNOWN ||
+ tech_flag(goal, TF_NON_RESEARCHABLE) )
return A_NONE;
return (get_next_tech_rec(plr, goal));
}
Index: common/tech.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.h,v
retrieving revision 1.19
diff -u -r1.19 tech.h
--- tech.h 2000/05/31 13:35:15 1.19
+++ tech.h 2000/12/24 18:31:00
@@ -51,6 +51,8 @@
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_NON_RESEARCHABLE, /* Tech is of a nature that cannot be researched */
+ TF_NON_TRANSFERABLE, /* Tech is of a nature that cannot be transfered */
TF_LAST
};
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.176
diff -u -r1.176 plrhand.c
--- plrhand.c 2000/12/22 00:36:48 1.176
+++ plrhand.c 2000/12/24 18:31:07
@@ -102,7 +102,7 @@
}
/**************************************************************************
-...
+Grant techs acquired by the Great Library or equivalent:
**************************************************************************/
static void great_library(struct player *pplayer)
{
@@ -113,7 +113,8 @@
if (pplayer->player_no==find_city_wonder(B_GREAT)->owner) {
for (i=0;i<game.num_tech_types;i++) {
if (get_invention(pplayer, i)!=TECH_KNOWN
- && game.global_advances[i]>=2) {
+ && game.global_advances[i]>=2
+ && !tech_flag(i,TF_NON_TRANSFERABLE) ) {
notify_player_ex(pplayer, -1, -1, E_TECH_GAIN,
_("Game: %s acquired from The Great Library!"),
advances[i].name);
@@ -258,7 +259,7 @@
advances[plr->research.researching].name,
advances[plr->ai.tech_goal].name);
} else {
- choose_random_tech(plr);
+ choose_random_researchable_tech(plr);
if (plr->research.researching!=A_NONE && tech_found != A_NONE)
notify_player(plr,
_("Game: Learned %s. Scientists choose to research %s."),
@@ -368,9 +369,10 @@
/**************************************************************************
-...
+Choose a random tech from among those reachable by this player, excluding any
+that bear the indicated flag:
**************************************************************************/
-void choose_random_tech(struct player *plr)
+void choose_random_tech(struct player *plr, enum tech_flag_id exclude_flag)
{
int researchable=0;
int i;
@@ -379,7 +381,8 @@
plr->research.researched = 0;
update_research(plr);
for (i=0;i<game.num_tech_types;i++)
- if (get_invention(plr, i)==TECH_REACHABLE)
+ if (get_invention(plr, i)==TECH_REACHABLE
+ && !tech_flag(i,exclude_flag) )
researchable++;
if (researchable==0) {
plr->research.researching=A_NONE;
@@ -388,7 +391,8 @@
choosen=myrand(researchable)+1;
for (i=0;i<game.num_tech_types;i++)
- if (get_invention(plr, i)==TECH_REACHABLE) {
+ if (get_invention(plr, i)==TECH_REACHABLE
+ && !tech_flag(i,exclude_flag) ) {
choosen--;
if (!choosen) break;
}
@@ -396,6 +400,24 @@
}
/**************************************************************************
+Choose a random tech from among those reachable by this player, excluding any
+with the TF_NOT_RESEARCHABLE flag:
+**************************************************************************/
+void choose_random_researchable_tech(struct player *plr)
+{
+ choose_random_tech(plr, TF_NON_RESEARCHABLE);
+}
+
+/**************************************************************************
+Choose a random tech from among those reachable by this player, excluding any
+with the TF_NOT_TRANSFERABLE flag:
+**************************************************************************/
+void choose_random_transferable_tech(struct player *plr)
+{
+ choose_random_tech(plr, TF_NON_TRANSFERABLE);
+}
+
+/**************************************************************************
...
**************************************************************************/
void choose_tech(struct player *plr, int tech)
@@ -403,7 +425,8 @@
if (plr->research.researching==tech)
return;
update_research(plr);
- if (get_invention(plr, tech)!=TECH_REACHABLE) { /* can't research this */
+ if (get_invention(plr, tech)!=TECH_REACHABLE /* can't research this */
+ || tech_flag(tech, TF_NON_RESEARCHABLE) ) {
return;
}
if (!plr->got_tech && plr->research.changed_from == -1) {
@@ -437,7 +460,7 @@
plr->research.researchpoints=1;
for (i=0;i<tech;i++) {
- choose_random_tech(plr); /* could be choose_goal_tech -- Syela */
+ choose_random_researchable_tech(plr); /* could be choose_goal_tech --
Syela */
set_invention(plr, plr->research.researching, TECH_KNOWN);
}
choose_goal_tech(plr);
Index: server/plrhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.h,v
retrieving revision 1.35
diff -u -r1.35 plrhand.h
--- plrhand.h 2000/12/20 15:16:22 1.35
+++ plrhand.h 2000/12/24 18:31:07
@@ -71,7 +71,9 @@
void tech_researched(struct player* plr);
int update_tech(struct player *plr, int bulbs);
void init_tech(struct player *plr, int tech);
-void choose_random_tech(struct player *plr);
+void choose_random_tech(struct player *plr, enum tech_flag_id exclude_flag);
+void choose_random_researchable_tech(struct player *plr);
+void choose_random_transferable_tech(struct player *plr);
void choose_tech(struct player *plr, int tech);
void choose_tech_goal(struct player *plr, int tech);
int choose_goal_tech(struct player *plr);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.68
diff -u -r1.68 ruleset.c
--- ruleset.c 2000/11/10 19:47:26 1.68
+++ ruleset.c 2000/12/24 18:31:17
@@ -496,7 +496,10 @@
if (ival==TF_LAST) {
freelog(LOG_ERROR, "for advance_type \"%s\": bad flag name \"%s\"
(%s)",
a->name, sval, filename);
+ } else {
+ freelog(LOG_VERBOSE, "advance %s has flag `%s'", a->name, sval);
}
+
a->flags |= (1<<ival);
}
free(slist);
Index: server/unitfunc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unitfunc.c,v
retrieving revision 1.214
diff -u -r1.214 unitfunc.c
--- unitfunc.c 2000/12/20 16:53:00 1.214
+++ unitfunc.c 2000/12/24 18:31:32
@@ -593,7 +593,8 @@
count = 0;
for (index = A_FIRST; index < game.num_tech_types; index++) {
if ((get_invention (pplayer, index) != TECH_KNOWN) &&
- (get_invention (cplayer, index) == TECH_KNOWN)) {
+ (get_invention (cplayer, index) == TECH_KNOWN) &&
+ !tech_flag(index, TF_NON_TRANSFERABLE) ) {
count++;
}
}
@@ -624,7 +625,8 @@
which = myrand (count);
for (index = A_FIRST; index < game.num_tech_types; index++) {
if ((get_invention (pplayer, index) != TECH_KNOWN) &&
- (get_invention (cplayer, index) == TECH_KNOWN)) {
+ (get_invention (cplayer, index) == TECH_KNOWN) &&
+ !tech_flag(index, TF_NON_TRANSFERABLE) ) {
if (which > 0) {
which--;
} else {
@@ -641,7 +643,8 @@
* If not available, say so, deduct movement cost and return.
*/
if ((get_invention (pplayer, technology) != TECH_KNOWN) &&
- (get_invention (cplayer, technology) == TECH_KNOWN)) {
+ (get_invention (cplayer, technology) == TECH_KNOWN) &&
+ !tech_flag(technology, TF_NON_TRANSFERABLE) ) {
target = technology;
freelog (LOG_DEBUG, "steal-tech: specified target technology: %d (%s)",
target, advances[target].name);
@@ -2632,8 +2635,9 @@
int i;
int j=0;
for (i=0;i<game.num_tech_types;i++) {
- if (get_invention(pplayer, i)!=TECH_KNOWN &&
- get_invention(target, i)== TECH_KNOWN) {
+ if (!tech_flag(i,TF_NON_TRANSFERABLE)
+ && get_invention(pplayer, i)!=TECH_KNOWN
+ && get_invention(target, i)== TECH_KNOWN) {
j++;
}
}
@@ -2656,8 +2660,9 @@
}
j=myrand(j)+1;
for (i=0;i<game.num_tech_types;i++) {
- if (get_invention(pplayer, i)!=TECH_KNOWN &&
- get_invention(target, i)== TECH_KNOWN)
+ if (!tech_flag(i,TF_NON_TRANSFERABLE)
+ && get_invention(pplayer, i)!=TECH_KNOWN
+ && get_invention(target, i)== TECH_KNOWN)
j--;
if (!j) break;
}
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.168
diff -u -r1.168 unithand.c
--- unithand.c 2000/12/07 12:01:34 1.168
+++ unithand.c 2000/12/24 18:31:38
@@ -719,7 +719,7 @@
res_ed = pplayer->research.researched;
res_ing = pplayer->research.researching;
- choose_random_tech(pplayer);
+ choose_random_transferable_tech(pplayer);
new_tech = pplayer->research.researching;
pplayer->research.researched = res_ed;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freeciv-data] Freeciv Patch: Controls on access to specified techs.,
Bobby D. Bryant <=
|
|