Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] [Fwd: Re: Re: (PR#18293) Missing building tag crashes scie
Home

[Freeciv-Dev] [Fwd: Re: Re: (PR#18293) Missing building tag crashes scie

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: iainuki@xxxxxxxxx
Subject: [Freeciv-Dev] [Fwd: Re: Re: (PR#18293) Missing building tag crashes science dialog]
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 20 Jul 2006 13:05:35 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:
> On 7/9/06, Marko Lindqvist <cazfi74@xxxxxxxxx> wrote:
>>
>>   You should be able to avoid crash by adding missing b.amusement_park
>> tag in to buildings.spec.
>>
>>   Of course missing tag should not cause silent crash.
> 
> Client should print message about missing tag in startup and science
> dialog should work without buildings graphics.

   There already is LOG_VERBOSE message about missing building tags while
tileset is loaded. Attached patch takes care of the crash.


   - ML


diff -Nurd -X.diff_ignore freeciv/client/reqtree.c freeciv/client/reqtree.c
--- freeciv/client/reqtree.c    2006-07-20 21:39:36.640625000 +0300
+++ freeciv/client/reqtree.c    2006-07-20 22:38:31.015625000 +0300
@@ -179,9 +179,12 @@
           if (preq->source.type == REQ_TECH
              && preq->source.value.tech == node->tech) {
            sprite = get_building_sprite(tileset, impr_type);
-           get_sprite_dimensions(sprite, &swidth, &sheight);
-            max_icon_height = MAX(max_icon_height, sheight);
-            icons_width_sum += swidth + 2;
+            /* Improvement icons are not guaranteed to exist */
+            if (sprite) {
+              get_sprite_dimensions(sprite, &swidth, &sheight);
+              max_icon_height = MAX(max_icon_height, sheight);
+              icons_width_sum += swidth + 2;
+            }
          }
         } requirement_vector_iterate_end;
       } impr_type_iterate_end;
@@ -950,13 +953,16 @@
               if (preq->source.type == REQ_TECH
                  && preq->source.value.tech == node->tech) {
                sprite = get_building_sprite(tileset, impr_type);
-               get_sprite_dimensions(sprite, &swidth, &sheight);
-               canvas_put_sprite_full(pcanvas,
-                                      icon_startx,
-                                      starty + text_h + 4
-                                      + (height - text_h - 4 - sheight) / 2,
-                                      sprite);
-               icon_startx += swidth + 2;
+                /* Improvement icons are not guaranteed to exist */
+                if (sprite) {
+                  get_sprite_dimensions(sprite, &swidth, &sheight);
+                  canvas_put_sprite_full(pcanvas,
+                                         icon_startx,
+                                         starty + text_h + 4
+                                         + (height - text_h - 4 - sheight) / 2,
+                                         sprite);
+                  icon_startx += swidth + 2;
+                }
              }
            } requirement_vector_iterate_end;
           } impr_type_iterate_end;


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