Complete.Org: Mailing Lists: Archives: freeciv-ai: July 2002:
[freeciv-ai] [patch] small fix to settlers.c
Home

[freeciv-ai] [patch] small fix to settlers.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] [patch] small fix to settlers.c
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 15 Jul 2002 22:51:34 +0000 (GMT)

Taken out from another patch. Please read and comment if you think
something is amiss.

Yours
Per

Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.138
diff -u -r1.138 settlers.c
--- server/settlers.c   2002/04/04 03:51:05     1.138
+++ server/settlers.c   2002/07/15 22:41:55
@@ -1535,6 +1535,10 @@
   virtualunit.x = pcity->x;
   virtualunit.y = pcity->y;
   virtualunit.type = best_role_unit(pcity, F_CITIES);
+  if (virtualunit.type == U_LAST) {
+    freelog(LOG_DEBUG, "No F_CITIES role unit available");
+    return;
+  }
   virtualunit.moves_left = unit_type(&virtualunit)->move_rate;
   virtualunit.hp = unit_type(&virtualunit)->hp;
   want = evaluate_city_building(&virtualunit, &gx, &gy, &ferryboat);
@@ -1568,6 +1572,10 @@
   virtualunit.x = pcity->x;
   virtualunit.y = pcity->y;
   virtualunit.type = best_role_unit(pcity, F_SETTLERS);
+  if (virtualunit.type == U_LAST) {
+    freelog(LOG_DEBUG, "No F_SETTLERS role unit available");
+    return;
+  }
   virtualunit.moves_left = unit_type(&virtualunit)->move_rate;
   virtualunit.hp = unit_type(&virtualunit)->hp;
   want = evaluate_improvements(&virtualunit, &best_act, &gx, &gy);



[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] [patch] small fix to settlers.c, Per I. Mathisen <=