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

Comparing deliantra/server/common/image.C (file contents):
Revision 1.8 by root, Thu Dec 14 22:45:40 2006 UTC vs.
Revision 1.11 by root, Wed Jan 10 19:52:43 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
3 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
6 7
7 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
111static int 112static int
112compar (const struct bmappair *a, const struct bmappair *b) 113compar (const struct bmappair *a, const struct bmappair *b)
113{ 114{
114 return strcmp (a->name, b->name); 115 return strcmp (a->name, b->name);
115} 116}
117
116static int 118static int
117compar_smooth (const struct smoothing *a, const struct smoothing *b) 119compar_smooth (const struct smoothing *a, const struct smoothing *b)
118{ 120{
119 if (a->id < b->id) 121 if (a->id < b->id)
120 return -1; 122 return -1;
121 if (b->id < a->id) 123 if (b->id < a->id)
122 return 1; 124 return 1;
123 return 0; 125 return 0;
124} 126}
125 127
126
127/* 128/*
128 * Returns the matching color in the coloralias if found, 129 * Returns the matching color in the coloralias if found,
129 * 0 otherwise. Note that 0 will actually be black, so there is no 130 * 0 otherwise. Note that 0 will actually be black, so there is no
130 * way the calling function can tell if an error occurred or not 131 * way the calling function can tell if an error occurred or not
131 */ 132 */
132
133static uint8 133static uint8
134find_color (const char *name) 134find_color (const char *name)
135{ 135{
136 uint8 i; 136 uint8 i;
137 137
143} 143}
144 144
145/* This reads the lib/faces file, getting color and visibility information. 145/* This reads the lib/faces file, getting color and visibility information.
146 * it is called by ReadBmapNames. 146 * it is called by ReadBmapNames.
147 */ 147 */
148
149static void 148static void
150ReadFaceData (void) 149ReadFaceData (void)
151{ 150{
152 char buf[MAX_BUF], *cp; 151 char buf[MAX_BUF], *cp;
153 New_Face *on_face = NULL; 152 New_Face *on_face = NULL;
154 FILE *fp; 153 FILE *fp;
155 154
156 sprintf (buf, "%s/faces", settings.datadir); 155 sprintf (buf, "%s/faces", settings.datadir);
157 LOG (llevDebug, "Reading faces from %s...", buf); 156 LOG (llevDebug, "Reading faces from %s...\n", buf);
158 if ((fp = fopen (buf, "r")) == NULL) 157 if ((fp = fopen (buf, "r")) == NULL)
159 { 158 {
160 LOG (llevError, "Cannot open faces file %s: %s\n", buf, strerror (errno)); 159 LOG (llevError, "Cannot open faces file %s: %s\n", buf, strerror (errno));
161 exit (-1); 160 exit (-1);
162 } 161 }
216 on_face->magicmap |= FACE_FLOOR; 215 on_face->magicmap |= FACE_FLOOR;
217 } 216 }
218 else 217 else
219 LOG (llevDebug, "Got unknown line in faces file: %s\n", buf); 218 LOG (llevDebug, "Got unknown line in faces file: %s\n", buf);
220 } 219 }
220
221 LOG (llevDebug, "done\n"); 221 LOG (llevDebug, "done\n");
222 fclose (fp); 222 fclose (fp);
223} 223}
224 224
225/* This reads the bmaps file to get all the bitmap names and 225/* This reads the bmaps file to get all the bitmap names and
226 * stuff. It only needs to be done once, because it is player 226 * stuff. It only needs to be done once, because it is player
227 * independent (ie, what display the person is on will not make a 227 * independent (ie, what display the person is on will not make a
228 * difference.) 228 * difference.)
229 */ 229 */
230
231void 230void
232ReadBmapNames (void) 231ReadBmapNames (void)
233{ 232{
234 char buf[MAX_BUF], *p, *q; 233 char buf[MAX_BUF], *p, *q;
235 FILE *fp; 234 FILE *fp;
236 int value, nrofbmaps = 0, i; 235 int value, nrofbmaps = 0, i;
237 size_t l; 236 size_t l;
238 237
239 bmaps_checksum = 0; 238 bmaps_checksum = 0;
240 sprintf (buf, "%s/bmaps", settings.datadir); 239 sprintf (buf, "%s/bmaps", settings.datadir);
241 LOG (llevDebug, "Reading bmaps from %s...", buf); 240 LOG (llevDebug, "Reading bmaps from %s...\n", buf);
242 if ((fp = fopen (buf, "r")) == NULL) 241 if ((fp = fopen (buf, "r")) == NULL)
243 { 242 {
244 LOG (llevError, "Cannot open bmaps file %s: %s\n", buf, strerror (errno)); 243 LOG (llevError, "Cannot open bmaps file %s: %s\n", buf, strerror (errno));
245 exit (-1); 244 exit (-1);
246 } 245 }
387 FILE *fp; 386 FILE *fp;
388 int smoothcount = 0; 387 int smoothcount = 0;
389 388
390 bmaps_checksum = 0; 389 bmaps_checksum = 0;
391 sprintf (buf, "%s/smooth", settings.datadir); 390 sprintf (buf, "%s/smooth", settings.datadir);
392 LOG (llevDebug, "Reading smooth from %s...", buf); 391 LOG (llevDebug, "Reading smooth from %s...\n", buf);
393 if ((fp = fopen (buf, "r")) == NULL) 392 if ((fp = fopen (buf, "r")) == NULL)
394 { 393 {
395 LOG (llevError, "Cannot open smooth file %s: %s\n", strerror (errno)); 394 LOG (llevError, "Cannot open smooth file %s: %s\n", strerror (errno));
396 exit (-1); 395 exit (-1);
397 } 396 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines