ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/style.C
(Generate patch)

Comparing deliantra/server/random_maps/style.C (file contents):
Revision 1.22 by root, Sat Jan 27 02:19:37 2007 UTC vs.
Revision 1.23 by root, Wed Feb 14 01:33:24 2007 UTC

60 int entries = 0, entry_size = 0; 60 int entries = 0, entry_size = 0;
61 char name[NAME_MAX + 1], **rn = NULL; 61 char name[NAME_MAX + 1], **rn = NULL;
62 struct stat sb; 62 struct stat sb;
63 63
64 dp = opendir (dir); 64 dp = opendir (dir);
65 if (dp == NULL) 65 if (!dp)
66 return -1; 66 return -1;
67 67
68 while ((d = readdir (dp)) != NULL) 68 while ((d = readdir (dp)))
69 { 69 {
70 sprintf (name, "%s/%s", dir, d->d_name); 70 sprintf (name, "%s/%s", dir, d->d_name);
71 if (skip_dirs) 71 if (skip_dirs)
72 { 72 {
73 stat (name, &sb); 73 stat (name, &sb);
74 if (S_ISDIR (sb.st_mode)) 74 if (S_ISDIR (sb.st_mode))
75 {
76 continue; 75 continue;
77 }
78 } 76 }
79 77
80 if (entries == entry_size) 78 if (entries == entry_size)
81 { 79 {
82 entry_size += 10; 80 entry_size += 10;
108 sprintf (style_file_path, "%s/%s", dirname, stylename); 106 sprintf (style_file_path, "%s/%s", dirname, stylename);
109 else /* otherwise, just use the dirname. We'll pick a random stylefile. */ 107 else /* otherwise, just use the dirname. We'll pick a random stylefile. */
110 sprintf (style_file_path, "%s", dirname); 108 sprintf (style_file_path, "%s", dirname);
111 109
112 /* is what we were given a directory, or a file? */ 110 /* is what we were given a directory, or a file? */
113 sprintf (style_file_full_path, "%s/maps%s", settings.datadir, style_file_path); 111 sprintf (style_file_full_path, "%s/maps%s.map", settings.datadir, style_file_path);
114 112
115 if (stat (style_file_full_path, &file_stat) == 0 && !S_ISDIR (file_stat.st_mode)) 113 if (stat (style_file_full_path, &file_stat) == 0 && !S_ISDIR (file_stat.st_mode))
116 style_map = maptile::find_sync (style_file_path); 114 style_map = maptile::find_sync (style_file_path);
117 115
118 if (!style_map) /* maybe we were given a directory! */ 116 if (!style_map) /* maybe we were given a directory! */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines