1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.21 2006/09/03 22:45:55 root Exp $"; |
3 | * "$Id: map.C,v 1.22 2006/09/04 11:07:59 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
800 | value = NULL; |
800 | value = NULL; |
801 | break; |
801 | break; |
802 | } |
802 | } |
803 | } |
803 | } |
804 | } |
804 | } |
|
|
805 | |
805 | if (!end) { |
806 | if (!end) { |
806 | LOG(llevError, "Error loading map header - did not find a newline - perhaps file is truncated? Buf=%s\n", |
807 | LOG(llevError, "Error loading map header - did not find a newline - perhaps file is truncated? Buf=%s\n", |
807 | buf); |
808 | buf); |
808 | return 1; |
809 | return 1; |
809 | } |
810 | } |
810 | |
|
|
811 | |
811 | |
812 | /* key is the field name, value is what it should be set |
812 | /* key is the field name, value is what it should be set |
813 | * to. We've already done the work to null terminate key, |
813 | * to. We've already done the work to null terminate key, |
814 | * and strip off any leading spaces for both of these. |
814 | * and strip off any leading spaces for both of these. |
815 | * We have not touched the newline at the end of the line - |
815 | * We have not touched the newline at the end of the line - |
… | |
… | |
974 | LOG(llevError,"Got unknown value in map header: %s %s\n", key, value); |
974 | LOG(llevError,"Got unknown value in map header: %s %s\n", key, value); |
975 | } |
975 | } |
976 | } |
976 | } |
977 | if (!key || strcmp(key,"end")) { |
977 | if (!key || strcmp(key,"end")) { |
978 | LOG(llevError,"Got premature eof on map header!\n"); |
978 | LOG(llevError,"Got premature eof on map header!\n"); |
|
|
979 | abort();//D |
979 | return 1; |
980 | return 1; |
980 | } |
981 | } |
981 | return 0; |
982 | return 0; |
982 | } |
983 | } |
983 | |
984 | |
… | |
… | |
995 | |
996 | |
996 | mapstruct *load_original_map(const char *filename, int flags) { |
997 | mapstruct *load_original_map(const char *filename, int flags) { |
997 | mapstruct *m; |
998 | mapstruct *m; |
998 | char pathname[MAX_BUF]; |
999 | char pathname[MAX_BUF]; |
999 | |
1000 | |
1000 | LOG(llevDebug, "load_original_map: %s (%x)\n", filename,flags); |
|
|
1001 | if (flags & MAP_PLAYER_UNIQUE) |
1001 | if (flags & MAP_PLAYER_UNIQUE) |
1002 | strcpy(pathname, filename); |
1002 | strcpy(pathname, filename); |
1003 | else if (flags & MAP_OVERLAY) |
1003 | else if (flags & MAP_OVERLAY) |
1004 | strcpy(pathname, create_overlay_pathname(filename)); |
1004 | strcpy(pathname, create_overlay_pathname(filename)); |
1005 | else |
1005 | else |
1006 | strcpy(pathname, create_pathname(filename)); |
1006 | strcpy(pathname, create_pathname(filename)); |
|
|
1007 | |
|
|
1008 | LOG(llevDebug, "load_original_map(%x): %s (%s)\n", flags, filename, pathname); |
1007 | |
1009 | |
1008 | object_thawer thawer (pathname); |
1010 | object_thawer thawer (pathname); |
1009 | |
1011 | |
1010 | if (!thawer) |
1012 | if (!thawer) |
1011 | return 0; |
1013 | return 0; |