… | |
… | |
76 | if (!(fp = fopen (buf, "r"))) |
76 | if (!(fp = fopen (buf, "r"))) |
77 | { |
77 | { |
78 | LOG (llevDebug, "Could not open %s for reading\n", buf); |
78 | LOG (llevDebug, "Could not open %s for reading\n", buf); |
79 | return; |
79 | return; |
80 | } |
80 | } |
|
|
81 | |
81 | while (fgets (buf, MAX_BUF, fp) != NULL) |
82 | while (fgets (buf, MAX_BUF, fp)) |
82 | { |
83 | { |
83 | map = get_linked_map (); |
84 | map = get_linked_map (); |
84 | /* scanf doesn't work all that great on strings, so we break |
85 | /* scanf doesn't work all that great on strings, so we break |
85 | * out that manually. strdup is used for tmpname, since other |
86 | * out that manually. strdup is used for tmpname, since other |
86 | * routines will try to free that pointer. |
87 | * routines will try to free that pointer. |
… | |
… | |
95 | /* Lock is left over from the lock items - we just toss it now. |
96 | /* Lock is left over from the lock items - we just toss it now. |
96 | * We use it twice - second one is from encounter, but as we |
97 | * We use it twice - second one is from encounter, but as we |
97 | * don't care about the value, this works fine |
98 | * don't care about the value, this works fine |
98 | */ |
99 | */ |
99 | sscanf (cp1, "%d:%d:%d:%hd:%d:%d\n", &map->reset_time, &lock, &lock, &map->difficulty, &do_los, &darkness); |
100 | sscanf (cp1, "%d:%d:%d:%hd:%d:%d\n", &map->reset_time, &lock, &lock, &map->difficulty, &do_los, &darkness); |
100 | |
|
|
101 | |
101 | |
102 | map->in_memory = MAP_SWAPPED; |
102 | map->in_memory = MAP_SWAPPED; |
103 | map->darkness = darkness; |
103 | map->darkness = darkness; |
104 | |
104 | |
105 | /* When the reset time is saved out, it is adjusted so that |
105 | /* When the reset time is saved out, it is adjusted so that |
… | |
… | |
111 | * but easy enough to do some sanity checking here. |
111 | * but easy enough to do some sanity checking here. |
112 | */ |
112 | */ |
113 | map->reset_time += sec; |
113 | map->reset_time += sec; |
114 | if (map->reset_time > (uint32) (sec + MAP_MAXRESET)) |
114 | if (map->reset_time > (uint32) (sec + MAP_MAXRESET)) |
115 | map->reset_time = 0; |
115 | map->reset_time = 0; |
116 | |
|
|
117 | } |
116 | } |
118 | |
117 | |
119 | fclose (fp); |
118 | fclose (fp); |
120 | } |
119 | } |
121 | |
120 | |