<URL: http://bugs.freeciv.org/Ticket/Display.html?id=38372 >

2007/3/18 Marko Lindqvist:
>
> 1: Treaty: The White Horde can't have tech Asian Architecture

 Per's patch updated for S2_2.

 Function to check if tech is ever available for player has been
renamed as player_invention_is_ready() ??
 Unless someone has can tell me good reason for that, I'll rename it
again (Old name tech_is_available() was bad, but new one is IMO even
worse) There's buildings related function
can_player_build_improvement_later()  With similar logic this function
could be can_player_research_later()


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advdiplomacy.c freeciv/ai/advdiplomacy.c
--- freeciv/ai/advdiplomacy.c   2008-04-06 12:11:53.000000000 +0300
+++ freeciv/ai/advdiplomacy.c   2008-06-13 19:38:58.000000000 +0300
@@ -127,7 +127,8 @@
   int bulbs, tech_want, worth;
   enum tech_state state = player_invention_state(pplayer, tech);
 
-  if (TECH_KNOWN == state) {
+  if (TECH_KNOWN == state
+      || ! player_invention_is_ready(pplayer, tech)) {
     return 0;
   }
   bulbs = total_bulbs_required_for_goal(pplayer, tech) * 3;
@@ -185,7 +186,7 @@
   (the taker should evaluate it normally, but giver should never give that)
 **********************************************************************/
 static int compute_tech_sell_price(struct player* giver, struct player* taker,
-                               int tech_id, bool* is_dangerous)
+                                   int tech_id, bool* is_dangerous)
 {
     int worth;
     
@@ -982,7 +983,8 @@
 
   advance_index_iterate(A_FIRST, tech) {
     if (player_invention_state(player1, tech) == TECH_KNOWN) {
-      if (player_invention_state(player2, tech) != TECH_KNOWN) {
+      if (player_invention_state(player2, tech) != TECH_KNOWN
+          && player_invention_is_ready(player2, tech)) {
         worth[tech] = -compute_tech_sell_price(player1, player2, tech,
                                               &is_dangerous);
        if (is_dangerous) {
@@ -993,7 +995,8 @@
         worth[tech] = 0;
       }
     } else {
-      if (player_invention_state(player2, tech) == TECH_KNOWN) {
+      if (player_invention_state(player2, tech) == TECH_KNOWN
+          && player_invention_is_ready(player1, tech)) {
         worth[tech] = compute_tech_sell_price(player2, player1, tech,
                                              &is_dangerous);
        if (is_dangerous) {
@@ -1045,10 +1048,12 @@
   if (players_on_same_team(pplayer, aplayer)) {
     advance_index_iterate(A_FIRST, index) {
       if ((player_invention_state(pplayer, index) != TECH_KNOWN)
-          && (player_invention_state(aplayer, index) == TECH_KNOWN)) {
+          && (player_invention_state(aplayer, index) == TECH_KNOWN)
+          && player_invention_is_ready(pplayer, index)) {
        ai_diplomacy_suggest(aplayer, pplayer, CLAUSE_ADVANCE, index);
       } else if ((player_invention_state(pplayer, index) == TECH_KNOWN)
-          && (player_invention_state(aplayer, index) != TECH_KNOWN)) {
+                 && (player_invention_state(aplayer, index) != TECH_KNOWN)
+                 && player_invention_is_ready(aplayer, index)) {
         ai_diplomacy_suggest(pplayer, aplayer, CLAUSE_ADVANCE, index);
       }
     } advance_index_iterate_end;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to