Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] Re: (PR#15408) ai_select_tech can return A_UNSET in choice
Home

[Freeciv-Dev] Re: (PR#15408) ai_select_tech can return A_UNSET in choice

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#15408) ai_select_tech can return A_UNSET in choice
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Feb 2006 21:13:47 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Sat, Feb 04, 2006 at 08:54:35PM -0800, Mike Kaufman wrote:
> 
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=15408 >
> 
> On Sat, Feb 04, 2006 at 08:03:37PM -0800, Mike Kaufman wrote:
> > 
> > It seems I was wrong, this bug occurs because the player has researched all
> > techs, and is on Future Tech 1. At that point, want equals 0 for all techs
> > so values[] are all <= 0.
> 
> and here is a patch.

and that patch was very bad.

-mike

Index: ai/aitech.c
===================================================================
--- ai/aitech.c (revision 11503)
+++ ai/aitech.c (working copy)
@@ -69,6 +69,22 @@
   goal_values[A_UNSET] = -1;
   goal_values[A_NONE] = -1;
 
+  /* if we are researching future techs, then simply continue with that. 
+   * we don't need to do anything below. */
+  if (is_future_tech(get_player_research(pplayer)->researching)) {
+    if (choice) {
+      choice->choice = get_player_research(pplayer)->researching;
+      choice->want = 1;
+      choice->current_want = 1;
+    }
+    if (goal) {
+      goal->choice = A_UNSET; /* gotta be this apparently */
+      goal->want = 1;
+      goal->current_want = 1;
+    }
+    return;
+  }  
+
   /* Fill in values for the techs: want of the tech 
    * + average want of those we will discover en route */
   tech_type_iterate(i) {

[Prev in Thread] Current Thread [Next in Thread]