Author: cazfi
Date: Sun Jan 24 14:20:52 2016
New Revision: 31572

URL: http://svn.gna.org/viewcvs/freeciv?rev=31572&view=rev
Log:
Use river outlet sprites for all directions that are cardinal in hex tilesets.
Since some current tilesets have been made on the assumption that some
outlet sprites are not loaded or used, those specific sprites are optional
for now.

Reported by GriffonSpade

See patch #6351

Modified:
    branches/S2_5/client/tilespec.c

Modified: branches/S2_5/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/tilespec.c?rev=31572&r1=31571&r2=31572&view=diff
==============================================================================
--- branches/S2_5/client/tilespec.c     (original)
+++ branches/S2_5/client/tilespec.c     Sun Jan 24 14:20:52 2016
@@ -201,7 +201,7 @@
 struct river_sprites {
   struct sprite
     *spec[MAX_INDEX_CARDINAL],
-    *outlet[4];                /* indexed by enum direction4 */
+    *outlet[MAX_INDEX_CARDINAL];
 };
 
 struct named_sprites {
@@ -2108,7 +2108,7 @@
     int value = (idx >> i) & 1;
 
     cat_snprintf(c, sizeof(c), "%s%d",
-                dir_get_tileset_name(t->cardinal_tileset_dirs[i]), value);
+                 dir_get_tileset_name(t->cardinal_tileset_dirs[i]), value);
   }
 
   return c;
@@ -2864,7 +2864,6 @@
                                struct river_sprites *store, const char 
*tag_pfx)
 {
   int i;
-  const char dir_char[] = "nsew";
   char buffer[512];
 
   for (i = 0; i < t->num_index_cardinal; i++) {
@@ -2876,12 +2875,19 @@
     }
   }
 
-  for (i = 0; i < 4; i++) {
-    fc_snprintf(buffer, sizeof(buffer), "%s_outlet_%c",
-                tag_pfx, dir_char[i]);
+  for (i = 0; i < t->num_cardinal_tileset_dirs; i++) {
+    fc_snprintf(buffer, sizeof(buffer), "%s_outlet_%s",
+                tag_pfx, dir_get_tileset_name(t->cardinal_tileset_dirs[i]));
     store->outlet[i] = load_sprite(t, buffer);
     if (store->outlet[i] == NULL) {
-      return FALSE;
+      if (t->cardinal_tileset_dirs[i] == DIR8_NORTHWEST
+          || t->cardinal_tileset_dirs[i] == DIR8_NORTHEAST
+          || t->cardinal_tileset_dirs[i] == DIR8_SOUTHEAST
+          || t->cardinal_tileset_dirs[i] == DIR8_SOUTHWEST) {
+        log_debug("Missing \"%s\", support for this is deprecated.", buffer);
+      } else {
+        return FALSE;
+      }
     }
   }
 
@@ -4935,14 +4941,16 @@
     if (NULL != pterrain) {
       if (draw_terrain && !solid_bg
           && terrain_type_terrain_class(pterrain) == TC_OCEAN) {
-       for (dir = 0; dir < 4; dir++) {
-          int didx = DIR4_TO_DIR8[dir];
+       for (dir = 0; dir < t->num_cardinal_tileset_dirs; dir++) {
+          int didx = t->cardinal_tileset_dirs[dir];
 
           road_type_list_iterate(t->rivers, priver) {
             int idx = road_index(priver);
 
             if (BV_ISSET(troad_near[didx], idx)) {
-              ADD_SPRITE_SIMPLE(t->sprites.roads[idx].u.rivers.outlet[dir]);
+              if (t->sprites.roads[idx].u.rivers.outlet[dir] != NULL) {
+                ADD_SPRITE_SIMPLE(t->sprites.roads[idx].u.rivers.outlet[dir]);
+              }
               break;
             }
           } road_type_list_iterate_end;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to