Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8761) small sprite list
Home

[Freeciv-Dev] (PR#8761) small sprite list

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8761) small sprite list
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 May 2004 11:57:23 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8761 >

Currently there is a "small sprite" list in each specfile.  However this 
is unnecessary and confusing.  This list is only maintained so that all 
of the small sprites may be freed at the end.

In this patch there becomes just one global small sprite list.

jason

? eff
? flags
? data/diff
? data/flags
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.167
diff -u -r1.167 tilespec.c
--- client/tilespec.c   5 May 2004 20:39:15 -0000       1.167
+++ client/tilespec.c   17 May 2004 18:56:03 -0000
@@ -124,11 +124,11 @@
 #define small_sprite_list_iterate_end  LIST_ITERATE_END
 
 static struct specfile_list specfiles;
+static struct small_sprite_list small_sprites;
 
 struct specfile {
   struct Sprite *big_sprite;
   char *file_name;
-  struct small_sprite_list small_sprites;
 };
 
 /* 
@@ -563,7 +563,7 @@
       ss->sf = sf;
       ss->sprite = NULL;
 
-      small_sprite_list_insert(&ss->sf->small_sprites, ss);
+      small_sprite_list_insert(&small_sprites, ss);
 
       if (!duplicates_ok) {
         for (k = 0; k < num_tags; k++) {
@@ -814,6 +814,7 @@
 
   sprite_hash = hash_new(hash_fval_string, hash_fcmp_string);
   specfile_list_init(&specfiles);
+  small_sprite_list_init(&small_sprites);
   for (i = 0; i < num_spec_files; i++) {
     struct specfile *sf = fc_malloc(sizeof(*sf));
 
@@ -821,7 +822,6 @@
     
     sf->big_sprite = NULL;
     sf->file_name = mystrdup(datafilename_required(spec_filenames[i]));
-    small_sprite_list_init(&sf->small_sprites);
     scan_specfile(sf, duplicates_ok);
 
     specfile_list_insert(&specfiles, sf);
@@ -2546,13 +2546,13 @@
   hash_free(sprite_hash);
   sprite_hash = NULL;
 
-  specfile_list_iterate(specfiles, sf) {
-    small_sprite_list_iterate(sf->small_sprites, ss) {
-      small_sprite_list_unlink(&sf->small_sprites, ss);
-      assert(ss->sprite == NULL);
-      free(ss);
-    } small_sprite_list_iterate_end;
+  small_sprite_list_iterate(small_sprites, ss) {
+    small_sprite_list_unlink(&small_sprites, ss);
+    assert(ss->sprite == NULL);
+    free(ss);
+  } small_sprite_list_iterate_end;
 
+  specfile_list_iterate(specfiles, sf) {
     specfile_list_unlink(&specfiles, sf);
     free(sf->file_name);
     if (sf->big_sprite) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8761) small sprite list, Jason Short <=