Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12726) Bug: is_isometric is backwards in hex tilespec
Home

[Freeciv-Dev] (PR#12726) Bug: is_isometric is backwards in hex tilespec

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: yobbobandana@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12726) Bug: is_isometric is backwards in hex tilespec
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Apr 2005 16:43:45 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Wed Apr 06 15:58:33 2005]:
> 
> Yobbo Bandana wrote:
> > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12726 >
> > 
> > The is_isometric value for a hex tileset (specified in
> > [hextileset].tilespec) isn't handled properly. 0 and 1
> > have been swapped.
> > 
> > "is_hex = 1
> > is_isometric = 1"
> > works for plain hex tilesets (should be iso-hex)
> > 
> > "is_hex = 1
> > is_isometric = 0"
> > works for iso-hex tilesets (should be plain hex)
> > 
> > is_isometric works normally for non-hex tilesets :).
> > 
> > Note that this has already been compensated for in the
> > isophex tileset... it has is_isometric = 0.
> 
> Yes, this is also backwards in the topology parameter.  When I wrote the 
> code I didn't see why one hex form should be considered isometric while 
> the other is not (but now I do).

I think what I mean is it's not the tilesets that are backwards, it's
the core code.  This patch reverses it.

This is based on the idea that the hex tiles that allow you to move
sideways but not up-and-down have wasted vertical space, whereas the
ones that allow you to move up-and-down but not sideways have wasted
horizontal space.  This means the former are more isometric in nature. 
The latter (as used by Wesnoth, for instance) are more "square" and
better suited to an overhead view.  Of course either tile shape may be
used with either view if you really want to.

Note that isophex therefore uses the supposedly non-isometric hex tiles,
although it has a more or less isometric view (not a very accurate one
though).

-jason

Index: client/connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.31
diff -u -r1.31 connectdlg_common.c
--- client/connectdlg_common.c  11 Mar 2005 17:11:25 -0000      1.31
+++ client/connectdlg_common.c  6 Apr 2005 23:41:10 -0000
@@ -366,7 +366,7 @@
   my_snprintf(buf, sizeof(buf), "/set topology %d",
              (TF_WRAPX
               | ((tileset_is_isometric(tileset)
-                  && tileset_hex_height(tileset) == 0) ? TF_ISO : 0)
+                  && tileset_hex_width(tileset) == 0) ? TF_ISO : 0)
               | ((tileset_hex_width(tileset) != 0
                   || tileset_hex_height(tileset) != 0) ? TF_HEX : 0)));
   send_chat(buf);
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.228
diff -u -r1.228 capstr.c
--- common/capstr.c     28 Mar 2005 17:14:57 -0000      1.228
+++ common/capstr.c     6 Apr 2005 23:41:11 -0000
@@ -82,7 +82,7 @@
  *     as long as possible.  We want to maintain network compatibility with
  *     the stable branch for as long as possible.
  */
-#define CAPABILITY "+Freeciv.Devel.2004.Mar.28"
+#define CAPABILITY "+Freeciv.Devel.2005.Apr.6"
 
 void init_our_capability(void)
 {
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.213
diff -u -r1.213 map.c
--- common/map.c        16 Mar 2005 19:37:48 -0000      1.213
+++ common/map.c        6 Apr 2005 23:41:12 -0000
@@ -599,23 +599,23 @@
 
   if (topo_has_flag(TF_HEX)) {
     if (topo_has_flag(TF_ISO)) {
-      /* Iso-hex: you can't move NE or SW. */
-      if ((dx < 0 && dy > 0)
-         || (dx > 0 && dy < 0)) {
+      /* Iso-hex: you can't move SE or NW. */
+      if ((dx > 0 && dy > 0)
+         || (dx < 0 && dy < 0)) {
        /* Diagonal moves in this direction aren't allowed, so it will take
         * the full number of moves. */
-        return absdx + absdy;
+       return absdx + absdy;
       } else {
        /* Diagonal moves in this direction *are* allowed. */
         return MAX(absdx, absdy);
       }
     } else {
-      /* Hex: you can't move SE or NW. */
-      if ((dx > 0 && dy > 0)
-         || (dx < 0 && dy < 0)) {
+      /* Hex: you can't move NE or SW. */
+      if ((dx < 0 && dy > 0)
+         || (dx > 0 && dy < 0)) {
        /* Diagonal moves in this direction aren't allowed, so it will take
         * the full number of moves. */
-       return absdx + absdy;
+        return absdx + absdy;
       } else {
        /* Diagonal moves in this direction *are* allowed. */
         return MAX(absdx, absdy);
@@ -1689,12 +1689,12 @@
   switch (dir) {
   case DIR8_SOUTHEAST:
   case DIR8_NORTHWEST:
-    /* These directions are invalid in hex topologies. */
-    return !(topo_has_flag(TF_HEX) && !topo_has_flag(TF_ISO));
-  case DIR8_NORTHEAST:
-  case DIR8_SOUTHWEST:
     /* These directions are invalid in iso-hex topologies. */
     return !(topo_has_flag(TF_HEX) && topo_has_flag(TF_ISO));
+  case DIR8_NORTHEAST:
+  case DIR8_SOUTHWEST:
+    /* These directions are invalid in hex topologies. */
+    return !(topo_has_flag(TF_HEX) && !topo_has_flag(TF_ISO));
   case DIR8_NORTH:
   case DIR8_EAST:
   case DIR8_SOUTH:
@@ -1721,12 +1721,12 @@
     return TRUE;
   case DIR8_SOUTHEAST:
   case DIR8_NORTHWEST:
-    /* These directions are cardinal in iso-hex topologies. */
-    return topo_has_flag(TF_HEX) && topo_has_flag(TF_ISO);
-  case DIR8_NORTHEAST:
-  case DIR8_SOUTHWEST:
     /* These directions are cardinal in hexagonal topologies. */
     return topo_has_flag(TF_HEX) && !topo_has_flag(TF_ISO);
+  case DIR8_NORTHEAST:
+  case DIR8_SOUTHWEST:
+    /* These directions are cardinal in iso-hexagonal topologies. */
+    return topo_has_flag(TF_HEX) && topo_has_flag(TF_ISO);
   }
   return FALSE;
 }
Index: server/settings.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.c,v
retrieving revision 1.20
diff -u -r1.20 settings.c
--- server/settings.c   21 Mar 2005 13:05:21 -0000      1.20
+++ server/settings.c   6 Apr 2005 23:41:12 -0000
@@ -235,11 +235,11 @@
             "     |_|_|_|_|_|             /\\/\\/\\/\\/\\/ \n"
             "                             \\/\\/\\/\\/\\/  \n"
             "Hex tiles:                 Iso-hex:\n"
-            "  /\\/\\/\\/\\/\\/\\               _   _   _   _   _       \n"
-            "  | | | | | | |             / \\_/ \\_/ \\_/ \\_/ \\      \n"
-            "  \\/\\/\\/\\/\\/\\/\\             \\_/ \\_/ \\_/ \\_/ \\_/  \n"
-            "   | | | | | | |            / \\_/ \\_/ \\_/ \\_/ \\      \n"
-            "   \\/\\/\\/\\/\\/\\/             \\_/ \\_/ \\_/ \\_/ \\_/    \n"
+            "  _   _   _   _   _         /\\/\\/\\/\\/\\/\\       \n"
+            " / \\_/ \\_/ \\_/ \\_/ \\        | | | | | | |            \n"
+            " \\_/ \\_/ \\_/ \\_/ \\_/        \\/\\/\\/\\/\\/\\/\\     \n"
+            " / \\_/ \\_/ \\_/ \\_/ \\         | | | | | | |           \n"
+            " \\_/ \\_/ \\_/ \\_/ \\_/         \\/\\/\\/\\/\\/\\/      \n"
           ), NULL,
          MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO)
 

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