diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/ai/aicity.c freeciv-1.12.0m/ai/aicity.c --- freeciv-1.12.0/ai/aicity.c Thu May 31 09:02:54 2001 +++ freeciv-1.12.0m/ai/aicity.c Fri Aug 31 19:30:21 2001 @@ -141,13 +141,16 @@ j = improvement_types[i].tech_req; if (get_invention(pplayer, j) != TECH_KNOWN) pplayer->ai.tech_want[j] += values[i]; + /* if it is a bonus tech double it's value since it give a free tech */ + if(!game.global_advances[j] && tech_flag(j,TF_BONUS_TECH)) + pplayer->ai.tech_want[j] *= 2; + /* this probably isn't right -- Syela */ + /* since it assumes that the next tech is as valuable as the + current -- JJCogliati */ + } } /* tired of researching pottery when we need to learn Republic!! -- Syela */ - /* was A_PHILOSOPHY: */ - if (!game.global_advances[game.rtech.get_bonus_tech]) - pplayer->ai.tech_want[game.rtech.get_bonus_tech] *= 2; - /* this probably isn't right -- Syela */ city_list_iterate(pplayer->cities, pcity) pcity->ai.building_want[B_MAGELLAN] = values[B_MAGELLAN]; diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/client/packhand.c freeciv-1.12.0m/client/packhand.c --- freeciv-1.12.0/client/packhand.c Tue Jul 31 13:04:06 2001 +++ freeciv-1.12.0m/client/packhand.c Fri Aug 31 19:05:17 2001 @@ -1506,7 +1506,6 @@ game.sewer_size = packet->sewer_size; game.add_to_size_limit = packet->add_to_size_limit; - game.rtech.get_bonus_tech = packet->rtech.get_bonus_tech; game.rtech.cathedral_plus = packet->rtech.cathedral_plus; game.rtech.cathedral_minus = packet->rtech.cathedral_minus; game.rtech.colosseum_plus = packet->rtech.colosseum_plus; diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/common/capstr.c freeciv-1.12.0m/common/capstr.c --- freeciv-1.12.0/common/capstr.c Fri Jun 29 13:39:04 2001 +++ freeciv-1.12.0m/common/capstr.c Sat Sep 1 18:49:09 2001 @@ -70,7 +70,7 @@ * are not directly related to the capability strings discussed here.) */ -#define CAPABILITY "+1.11.6 conn_info" +#define CAPABILITY "+1.11.6 conn_info new_bonus_tech" /* "+1.11.6" is protocol for 1.11.6 beta release. diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/common/game.h freeciv-1.12.0m/common/game.h --- freeciv-1.12.0/common/game.h Mon Jul 2 08:28:03 2001 +++ freeciv-1.12.0m/common/game.h Fri Aug 31 18:58:02 2001 @@ -147,7 +147,6 @@ } ruleset; int firepower_factor; /* See README.rulesets */ struct { - int get_bonus_tech; /* eg Philosophy */ int cathedral_plus; /* eg Theology */ int cathedral_minus; /* eg Communism */ int colosseum_plus; /* eg Electricity */ diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/common/packets.c freeciv-1.12.0m/common/packets.c --- freeciv-1.12.0/common/packets.c Fri Jun 29 13:39:04 2001 +++ freeciv-1.12.0m/common/packets.c Sat Sep 1 19:15:38 2001 @@ -2689,7 +2689,10 @@ cptr=put_uint8(cptr, packet->sewer_size); cptr=put_uint8(cptr, packet->add_to_size_limit); - cptr=put_uint8(cptr, packet->rtech.get_bonus_tech); + /* when removing the new_bonus_tech capability remove the following 3 lines*/ + if(pc && !has_capability("new_bonus_tech",pc->capability)){ + cptr=put_uint8(cptr, packet->rtech.get_bonus_tech); + } cptr=put_uint8(cptr, packet->rtech.cathedral_plus); cptr=put_uint8(cptr, packet->rtech.cathedral_minus); cptr=put_uint8(cptr, packet->rtech.colosseum_plus); @@ -2730,7 +2733,10 @@ iget_uint8(&iter, &packet->sewer_size); iget_uint8(&iter, &packet->add_to_size_limit); - iget_uint8(&iter, &packet->rtech.get_bonus_tech); + /* when removing the new_bonus_tech capability remove the following 3 lines*/ + if (pc && !has_capability("new_bonus_tech",pc->capability)){ + iget_uint8(&iter, &packet->rtech.get_bonus_tech); + } iget_uint8(&iter, &packet->rtech.cathedral_plus); iget_uint8(&iter, &packet->rtech.cathedral_minus); iget_uint8(&iter, &packet->rtech.colosseum_plus); diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/common/packets.h freeciv-1.12.0m/common/packets.h --- freeciv-1.12.0/common/packets.h Fri Jun 29 13:39:05 2001 +++ freeciv-1.12.0m/common/packets.h Sat Sep 1 19:11:09 2001 @@ -549,6 +549,7 @@ int num_impr_types; int num_tech_types; struct { + /* when removing the new_bonus_tech capability remove the following line*/ int get_bonus_tech; int cathedral_plus; int cathedral_minus; diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/common/tech.h freeciv-1.12.0m/common/tech.h --- freeciv-1.12.0/common/tech.h Thu Mar 29 17:08:38 2001 +++ freeciv-1.12.0m/common/tech.h Thu Sep 6 12:40:40 2001 @@ -40,8 +40,7 @@ */ enum tech_flag_id { - TF_BONUS_TECH, /* player gets extra tech if rearched first - Note: currently only one tech with this flag is supported */ + TF_BONUS_TECH, /* player gets extra tech if rearched first */ TF_BOAT_FAST, /* all sea units get one extra move point */ TF_BRIDGE, /* "Settler" unit types can build bridges over rivers */ TF_RAILROAD, /* "Settler" unit types can build rail roads */ @@ -67,6 +66,7 @@ int req[2]; unsigned int flags; char *helptext; + char *first_message; /*Message displayed to the first player to get a tech */ }; int get_invention(struct player *plr, int tech); diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/data/default/techs.ruleset freeciv-1.12.0m/data/default/techs.ruleset --- freeciv-1.12.0/data/default/techs.ruleset Thu Mar 29 17:08:39 2001 +++ freeciv-1.12.0m/data/default/techs.ruleset Thu Sep 6 13:06:23 2001 @@ -24,6 +24,7 @@ ; req1, req2 = advances required before researching this one ; flags = special flag strings ; helptext = optional help text string (set units ruleset for examples) +; first_message = Text seen when a player is the first to discover an advance. ; ; Special values for req1 and req2 are "None" (first section below) ; and "Never" (never available). If only one tech is required, @@ -32,7 +33,6 @@ ; Following flag strings are possible ; ; "Bonus_Tech" = player gets extra tech if rearched first -; Note: currently only one tech with this flag is supported ; "Boat_Fast" = all sea units get one extra move point ; "Bridge" = "Settler" unit types can build bridges over rivers ; "Railroad" = "Settler" unit types can build rail roads @@ -145,7 +145,7 @@ name = _("Computers") req1 = "Mass Production" req2 = "Miniaturization" -flags = "" +flags = "Bonus_Tech" [advance_conscription] name = _("Conscription") @@ -254,6 +254,7 @@ req1 = "Invention" req2 = "Iron Working" flags = "" +first_message = _("Game: Nations tremble in fear of your new weapons.") [advance_horseback_riding] name = _("Horseback Riding") @@ -404,6 +405,8 @@ req1 = "Mysticism" req2 = "Literacy" flags = "Bonus_Tech" +first_message = _("Game: Great philosophers from all the world join \ +your civilization; you get an immediate advance.") [advance_physics] name = _("Physics") diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/server/plrhand.c freeciv-1.12.0m/server/plrhand.c --- freeciv-1.12.0/server/plrhand.c Sat Jul 21 10:31:17 2001 +++ freeciv-1.12.0m/server/plrhand.c Thu Sep 6 13:26:34 2001 @@ -211,7 +211,7 @@ char saving_bulbs) { int i; - int philohack=0; + int bonus_tech_hack=0; int was_first=0; int saved_bulbs; int wonder; @@ -249,8 +249,8 @@ } } - if (tech_found==game.rtech.get_bonus_tech && was_first) - philohack=1; + if (tech_flag(tech_found,TF_BONUS_TECH) && was_first) + bonus_tech_hack=1; set_invention(plr, tech_found, TECH_KNOWN); update_research(plr); @@ -297,10 +297,12 @@ if(saving_bulbs) plr->research.researched=saved_bulbs; } - - if (philohack) { - notify_player(plr, _("Game: Great philosophers from all the world join " - "your civilization; you get an immediate advance.")); + + if (was_first && advances[tech_found].first_message != NULL) { + notify_player(plr,"%s",advances[tech_found].first_message); + } + + if (bonus_tech_hack) { tech_researched(plr); } } diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/server/ruleset.c freeciv-1.12.0m/server/ruleset.c --- freeciv-1.12.0/server/ruleset.c Sat Jul 21 12:31:57 2001 +++ freeciv-1.12.0m/server/ruleset.c Thu Sep 6 13:35:40 2001 @@ -358,13 +358,13 @@ } /************************************************************************** - Lookup optional helptext, returning allocated memory or NULL. + Lookup optional string, returning allocated memory or NULL. **************************************************************************/ -static char *lookup_helptext(struct section_file *file, char *prefix) +static char *lookup_string(struct section_file *file, char *prefix,char *suffix) { char *sval; - sval = secfile_lookup_str_default(file, NULL, "%s.helptext", prefix); + sval = secfile_lookup_str_default(file, NULL, "%s.%s", prefix,suffix); if (sval) { sval = skip_leading_spaces(sval); if (strlen(sval)) { @@ -373,6 +373,15 @@ } return NULL; } + + +/************************************************************************** + Lookup optional helptext, returning allocated memory or NULL. +**************************************************************************/ +static char *lookup_helptext(struct section_file *file, char *prefix) +{ + return lookup_string(file,prefix,"helptext"); +} /************************************************************************** Look up a terrain name in the tile_types array and return its index. @@ -502,7 +511,9 @@ free(slist); a->helptext = lookup_helptext(file, sec[i]); - + + a->first_message = lookup_string(file, sec[i], "first_message"); + a++; } @@ -526,10 +537,6 @@ } } - /* Should be removed and use the flag directly in the future - to allow more bonus techs -- sb */ - game.rtech.get_bonus_tech = find_tech_by_flag(0,TF_BONUS_TECH); - free(sec); section_file_check_unused(file, filename); section_file_free(file); @@ -1665,7 +1672,8 @@ packet.sewer_size = game.sewer_size; packet.add_to_size_limit = game.add_to_size_limit; - packet.rtech.get_bonus_tech = game.rtech.get_bonus_tech; + /* when removing the new_bonus_tech capability remove the following line*/ + packet.rtech.get_bonus_tech = find_tech_by_flag(0,TF_BONUS_TECH); packet.rtech.cathedral_plus = game.rtech.cathedral_plus; packet.rtech.cathedral_minus = game.rtech.cathedral_minus; packet.rtech.colosseum_plus = game.rtech.colosseum_plus; diff -ur --exclude-from=freeciv-1.12.0m/diff_ignore freeciv-1.12.0/server/rulesout.c freeciv-1.12.0m/server/rulesout.c --- freeciv-1.12.0/server/rulesout.c Thu Aug 31 07:32:49 2000 +++ freeciv-1.12.0m/server/rulesout.c Fri Aug 31 19:02:00 2001 @@ -160,7 +160,6 @@ } /* building special techs (not yet generalised) */ - /* note game.rtech.get_bonus_tech is just cached value from tech flag */ if (itech == game.rtech.cathedral_plus) { my_snprintf(buf, sizeof(buf), "special: %s +1", improvement_types[B_CATHEDRAL].name);