Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
[Freeciv-Dev] arctic railroads are sometimes broken (PR#52)
Home

[Freeciv-Dev] arctic railroads are sometimes broken (PR#52)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] arctic railroads are sometimes broken (PR#52)
From: jjm@xxxxxxxxxxxx
Date: Mon, 12 Jul 1999 22:51:47 -0700 (PDT)

Full_Name: Jeff Mallatt
Version: 1.8.1
OS: Linux
Submission from: (NULL) (199.103.194.36)


When in the far arctic (map y==0, near the maximum x location), I upgraded a
road to a railroad, and that square's "roadness" went away.  What I mean is,
normally when you middle-click, you see "Infrastructure: Road/Railroad", but
after I did the upgrade, what I saw was "Infrastructure: Railroad".  This is
not valid -- railroad implies road.

I posted a save file which demonstrates this:
  ftp://dumuzi.codewell.com/pub/prj/freeciv/arctic_corner_rail_bug.sav.gz
Connect as "Caesar", and watch the Engineers near Megalopolis as they first
build a road, then have them build a railroad right there.  When they are
done building the railroad, the square is no longer a "road", and movement
through it is not free (as it should be if it is a railroad).

The following is a patch which seems to fix the problem.

Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.38
diff -u -r1.38 settlers.c
--- settlers.c  1999/07/11 13:03:38     1.38
+++ settlers.c  1999/07/13 05:42:18
@@ -627,11 +627,13 @@
 {
   int x, y, m;
   struct tile *ptile;
+  enum tile_special_type spe_sav;
   x = pcity->x + i - 2; y = pcity->y + j - 2;
   ptile = map_get_tile(x, y);
   if (ptile->terrain != T_OCEAN &&
       get_invention(pplayer, A_RAILROAD) == TECH_KNOWN &&
       !(ptile->special&S_RAILROAD)) {
+/* The following seems to break railroads when y==0 and x is near the max...
     if (ptile->special&S_ROAD) {
       ptile->special|=S_RAILROAD;
       m = city_tile_value(pcity, i, j, 0, 0);
@@ -643,6 +645,12 @@
       map_clear_special(x, y, S_ROAD | S_RAILROAD);
       return(m);
     }
+... so I replaced it with this (jjm): */
+    spe_sav = ptile->special;
+    ptile->special|=(S_ROAD | S_RAILROAD);
+    m = city_tile_value(pcity, i, j, 0, 0);
+    ptile->special = spe_sav;
+    return(m);
   } else return(-1);
 /* bonuses for adjacent railroad tiles */
 }



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