1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_image_c = |
|
|
4 | * "$Id: image.C,v 1.6 2006/09/10 16:00:23 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
|
|
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
6 | Copyright (C) 1992 Frank Tore Johansen |
12 | |
7 | |
13 | 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 |
14 | 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 |
… | |
… | |
22 | |
17 | |
23 | You should have received a copy of the GNU General Public License |
18 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
19 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
21 | |
27 | The maintainer of this code can be reached at crossfire-devel@real-time.com |
22 | The maintainer of this code can be reached at <crossfire@schmorp.de> |
28 | */ |
23 | */ |
29 | |
24 | |
30 | |
25 | |
31 | #include <global.h> |
26 | #include <global.h> |
32 | #include <stdio.h> |
27 | #include <stdio.h> |
… | |
… | |
158 | char buf[MAX_BUF], *cp; |
153 | char buf[MAX_BUF], *cp; |
159 | New_Face *on_face = NULL; |
154 | New_Face *on_face = NULL; |
160 | FILE *fp; |
155 | FILE *fp; |
161 | |
156 | |
162 | sprintf (buf, "%s/faces", settings.datadir); |
157 | sprintf (buf, "%s/faces", settings.datadir); |
163 | LOG (llevDebug, "Reading faces from %s...", buf); |
158 | LOG (llevDebug, "Reading faces from %s...\n", buf); |
164 | if ((fp = fopen (buf, "r")) == NULL) |
159 | if ((fp = fopen (buf, "r")) == NULL) |
165 | { |
160 | { |
166 | LOG (llevError, "Cannot open faces file %s: %s\n", buf, strerror (errno)); |
161 | LOG (llevError, "Cannot open faces file %s: %s\n", buf, strerror (errno)); |
167 | exit (-1); |
162 | exit (-1); |
168 | } |
163 | } |
… | |
… | |
242 | int value, nrofbmaps = 0, i; |
237 | int value, nrofbmaps = 0, i; |
243 | size_t l; |
238 | size_t l; |
244 | |
239 | |
245 | bmaps_checksum = 0; |
240 | bmaps_checksum = 0; |
246 | sprintf (buf, "%s/bmaps", settings.datadir); |
241 | sprintf (buf, "%s/bmaps", settings.datadir); |
247 | LOG (llevDebug, "Reading bmaps from %s...", buf); |
242 | LOG (llevDebug, "Reading bmaps from %s...\n", buf); |
248 | if ((fp = fopen (buf, "r")) == NULL) |
243 | if ((fp = fopen (buf, "r")) == NULL) |
249 | { |
244 | { |
250 | LOG (llevError, "Cannot open bmaps file %s: %s\n", buf, strerror (errno)); |
245 | LOG (llevError, "Cannot open bmaps file %s: %s\n", buf, strerror (errno)); |
251 | exit (-1); |
246 | exit (-1); |
252 | } |
247 | } |
… | |
… | |
270 | { |
265 | { |
271 | LOG (llevDebug, "Warning, syntax error: %s\n", buf); |
266 | LOG (llevDebug, "Warning, syntax error: %s\n", buf); |
272 | continue; |
267 | continue; |
273 | } |
268 | } |
274 | value = atoi (p); |
269 | value = atoi (p); |
275 | xbm[nroffiles].name = strdup_local (q); |
270 | xbm[nroffiles].name = strdup (q); |
276 | |
271 | |
277 | /* We need to calculate the checksum of the bmaps file |
272 | /* We need to calculate the checksum of the bmaps file |
278 | * name->number mapping to send to the client. This does not |
273 | * name->number mapping to send to the client. This does not |
279 | * need to match what sum or other utility may come up with - |
274 | * need to match what sum or other utility may come up with - |
280 | * as long as we get the same results on the same real file |
275 | * as long as we get the same results on the same real file |
… | |
… | |
393 | FILE *fp; |
388 | FILE *fp; |
394 | int smoothcount = 0; |
389 | int smoothcount = 0; |
395 | |
390 | |
396 | bmaps_checksum = 0; |
391 | bmaps_checksum = 0; |
397 | sprintf (buf, "%s/smooth", settings.datadir); |
392 | sprintf (buf, "%s/smooth", settings.datadir); |
398 | LOG (llevDebug, "Reading smooth from %s...", buf); |
393 | LOG (llevDebug, "Reading smooth from %s...\n", buf); |
399 | if ((fp = fopen (buf, "r")) == NULL) |
394 | if ((fp = fopen (buf, "r")) == NULL) |
400 | { |
395 | { |
401 | LOG (llevError, "Cannot open smooth file %s: %s\n", strerror (errno)); |
396 | LOG (llevError, "Cannot open smooth file %s: %s\n", strerror (errno)); |
402 | exit (-1); |
397 | exit (-1); |
403 | } |
398 | } |