Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] Re: (PR#14968) Wrong number of turns displayed for movemen
Home

[Freeciv-Dev] Re: (PR#14968) Wrong number of turns displayed for movemen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: guillaume.melquiond@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14968) Wrong number of turns displayed for movement
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 24 Dec 2005 15:37:39 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Guillaume Melquiond wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14968 >
> 
> Due to a patch committed on December 23th, the number of turns needed
> to move a unit is incorrectly displayed in the GTK2 client. To
> reproduce, start a game, select one of your units, and move your
> cursor around the map. The client will correctly draw the shortest
> path to reach this destination, but the turn count will be completely
> random.

A stupid mistake, though it's odd that gcc wouldn't report an error here.

-jason

Index: tilespec.c
===================================================================
--- tilespec.c  (revision 11381)
+++ tilespec.c  (working copy)
@@ -3860,12 +3860,12 @@
     return 0;
   }
   if (ptile && ptile == get_line_dest()) {
-    int length;
-    int units = length % NUM_TILES_DIGITS;
-    int tens = (length / 10) % NUM_TILES_DIGITS;
+    int length, units, tens;
 
     goto_get_turns(NULL, &length);
-    if (length >= 100) {
+    units = length % NUM_TILES_DIGITS;
+    tens = (length / 10) % NUM_TILES_DIGITS;
+    if (length < 0 || length >= 100) {
       static bool reported = FALSE;
 
       if (!reported) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#14968) Wrong number of turns displayed for movement, Jason Short <=