Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12754) CVS: Show Future Targets assert - tilespec.c:42
Home

[Freeciv-Dev] (PR#12754) CVS: Show Future Targets assert - tilespec.c:42

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: yautja@xxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12754) CVS: Show Future Targets assert - tilespec.c:4227: get_building_sprite
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sun, 10 Apr 2005 07:53:48 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [yautja@xxxxxxxxxxxxxxx - Sun Apr 10 07:21:12 2005]:
> 
> Happens in the city production and work list editor when you click on 
> the Show Future Targets checkbox.
> 
> Linux GTK2 client
> 
> civclient: tilespec.c:4227: get_building_sprite: Assertion `0' failed.
> Abort

Here is a patch. It seems that condition check is wrong. I got these
from tech_exists() and improvement_exists().


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.288
diff -u -u -r1.288 tilespec.c
--- client/tilespec.c   10 Apr 2005 03:17:25 -0000      1.288
+++ client/tilespec.c   10 Apr 2005 14:52:45 -0000
@@ -4211,7 +4211,7 @@
 **************************************************************************/
 struct sprite *get_tech_sprite(const struct tileset *t, Tech_Type_id tech)
 {
-  if (tech <= 0 || tech >= game.num_tech_types) {
+  if (tech < 0 || tech >= game.num_tech_types) {
     assert(0);
     return NULL;
   }
@@ -4223,7 +4223,7 @@
 **************************************************************************/
 struct sprite *get_building_sprite(const struct tileset *t, Impr_Type_id b)
 {
-  if (b <= 0 || b >= game.num_impr_types) {
+  if (b < 0 || b >= B_LAST || b >= game.num_impr_types) {
     assert(0);
     return NULL;
   }

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