Lines Matching refs:fp
92 FILE *fp; in save_into_file() local
118 if (((fp = fopen(sfile, "w")) == NULL) || in save_into_file()
120 if (fp) in save_into_file()
121 fclose(fp); in save_into_file()
128 r_write(fp, &detect_monster, sizeof(detect_monster)); in save_into_file()
129 r_write(fp, &cur_level, sizeof(cur_level)); in save_into_file()
130 r_write(fp, &max_level, sizeof(max_level)); in save_into_file()
131 write_string(hunger_str, fp); in save_into_file()
132 write_string(login_name, fp); in save_into_file()
133 r_write(fp, &party_room, sizeof(party_room)); in save_into_file()
134 write_pack(&level_monsters, fp); in save_into_file()
135 write_pack(&level_objects, fp); in save_into_file()
136 r_write(fp, &file_id, sizeof(file_id)); in save_into_file()
137 rw_dungeon(fp, 1); in save_into_file()
138 r_write(fp, &foods, sizeof(foods)); in save_into_file()
139 r_write(fp, &rogue, sizeof(fighter)); in save_into_file()
140 write_pack(&rogue.pack, fp); in save_into_file()
141 rw_id(id_potions, fp, POTIONS, 1); in save_into_file()
142 rw_id(id_scrolls, fp, SCROLS, 1); in save_into_file()
143 rw_id(id_wands, fp, WANDS, 1); in save_into_file()
144 rw_id(id_rings, fp, RINGS, 1); in save_into_file()
145 r_write(fp, traps, (MAX_TRAPS * sizeof(trap))); in save_into_file()
146 r_write(fp, is_wood, (WANDS * sizeof(boolean))); in save_into_file()
147 r_write(fp, &cur_room, sizeof(cur_room)); in save_into_file()
148 rw_rooms(fp, 1); in save_into_file()
149 r_write(fp, &being_held, sizeof(being_held)); in save_into_file()
150 r_write(fp, &bear_trap, sizeof(bear_trap)); in save_into_file()
151 r_write(fp, &halluc, sizeof(halluc)); in save_into_file()
152 r_write(fp, &blind, sizeof(blind)); in save_into_file()
153 r_write(fp, &confused, sizeof(confused)); in save_into_file()
154 r_write(fp, &levitate, sizeof(levitate)); in save_into_file()
155 r_write(fp, &haste_self, sizeof(haste_self)); in save_into_file()
156 r_write(fp, &see_invisible, sizeof(see_invisible)); in save_into_file()
157 r_write(fp, &detect_monster, sizeof(detect_monster)); in save_into_file()
158 r_write(fp, &wizard, sizeof(wizard)); in save_into_file()
159 r_write(fp, &score_only, sizeof(score_only)); in save_into_file()
160 r_write(fp, &m_moves, sizeof(m_moves)); in save_into_file()
163 r_write(fp, &rt_buf, sizeof(rt_buf)); in save_into_file()
164 fclose(fp); in save_into_file()
176 FILE *fp; in restore() local
182 fp = NULL; in restore()
184 ((fp = fopen(fname, "r")) == NULL)) { in restore()
191 r_read(fp, &detect_monster, sizeof(detect_monster)); in restore()
192 r_read(fp, &cur_level, sizeof(cur_level)); in restore()
193 r_read(fp, &max_level, sizeof(max_level)); in restore()
194 read_string(hunger_str, fp, sizeof hunger_str); in restore()
197 read_string(login_name, fp, sizeof login_name); in restore()
202 r_read(fp, &party_room, sizeof(party_room)); in restore()
203 read_pack(&level_monsters, fp, 0); in restore()
207 read_pack(&level_objects, fp, 0); in restore()
208 r_read(fp, &saved_file_id, sizeof(saved_file_id)); in restore()
212 rw_dungeon(fp, 0); in restore()
213 r_read(fp, &foods, sizeof(foods)); in restore()
214 r_read(fp, &rogue, sizeof(fighter)); in restore()
215 read_pack(&rogue.pack, fp, 1); in restore()
221 rw_id(id_potions, fp, POTIONS, 0); in restore()
222 rw_id(id_scrolls, fp, SCROLS, 0); in restore()
223 rw_id(id_wands, fp, WANDS, 0); in restore()
224 rw_id(id_rings, fp, RINGS, 0); in restore()
225 r_read(fp, traps, (MAX_TRAPS * sizeof(trap))); in restore()
226 r_read(fp, is_wood, (WANDS * sizeof(boolean))); in restore()
227 r_read(fp, &cur_room, sizeof(cur_room)); in restore()
228 rw_rooms(fp, 0); in restore()
229 r_read(fp, &being_held, sizeof(being_held)); in restore()
230 r_read(fp, &bear_trap, sizeof(bear_trap)); in restore()
231 r_read(fp, &halluc, sizeof(halluc)); in restore()
232 r_read(fp, &blind, sizeof(blind)); in restore()
233 r_read(fp, &confused, sizeof(confused)); in restore()
234 r_read(fp, &levitate, sizeof(levitate)); in restore()
235 r_read(fp, &haste_self, sizeof(haste_self)); in restore()
236 r_read(fp, &see_invisible, sizeof(see_invisible)); in restore()
237 r_read(fp, &detect_monster, sizeof(detect_monster)); in restore()
238 r_read(fp, &wizard, sizeof(wizard)); in restore()
239 r_read(fp, &score_only, sizeof(score_only)); in restore()
240 r_read(fp, &m_moves, sizeof(m_moves)); in restore()
241 r_read(fp, &saved_time, sizeof(saved_time)); in restore()
243 if (fread(buf, 1, 1, fp) > 0) { in restore()
259 fclose(fp); in restore()
263 write_pack(const object *pack, FILE *fp) in write_pack() argument
268 r_write(fp, pack, sizeof(object)); in write_pack()
271 r_write(fp, &t, sizeof(object)); in write_pack()
275 read_pack(object *pack, FILE *fp, boolean is_rogue) in read_pack() argument
280 r_read(fp, &read_obj, sizeof(object)); in read_pack()
303 rw_dungeon(FILE *fp, boolean rw) in rw_dungeon() argument
310 r_write(fp, dungeon[i], (DCOLS * sizeof(dungeon[0][0]))); in rw_dungeon()
314 r_write(fp, buf, DCOLS); in rw_dungeon()
316 r_read(fp, dungeon[i], (DCOLS * sizeof(dungeon[0][0]))); in rw_dungeon()
317 r_read(fp, buf, DCOLS); in rw_dungeon()
326 rw_id(struct id id_table[], FILE *fp, int n, boolean wr) in rw_id() argument
332 r_write(fp, &id_table[i].value, sizeof(short)); in rw_id()
333 r_write(fp, &id_table[i].id_status, in rw_id()
335 write_string(id_table[i].title, fp); in rw_id()
337 r_read(fp, &id_table[i].value, sizeof(short)); in rw_id()
338 r_read(fp, &id_table[i].id_status, in rw_id()
340 read_string(id_table[i].title, fp, MAX_ID_TITLE_LEN); in rw_id()
346 write_string(char *s, FILE *fp) in write_string() argument
352 r_write(fp, &n, sizeof(short)); in write_string()
353 r_write(fp, s, n); in write_string()
357 read_string(char *s, FILE *fp, size_t len) in read_string() argument
361 r_read(fp, &n, sizeof(short)); in read_string()
365 r_read(fp, s, n); in read_string()
372 rw_rooms(FILE *fp, boolean rw) in rw_rooms() argument
377 rw ? r_write(fp, (rooms + i), sizeof(room)) : in rw_rooms()
378 r_read(fp, (rooms + i), sizeof(room)); in rw_rooms()
383 r_read(FILE *fp, void *buf, size_t n) in r_read() argument
385 if (fread(buf, 1, n, fp) != n) { in r_read()
391 r_write(FILE *fp, const void *buf, size_t n) in r_write() argument
394 if (fwrite(buf, 1, n, fp) != n) { in r_write()