Angband
savefile.h
Go to the documentation of this file.
1 
18 #ifndef INCLUDED_SAVEFILE_H
19 #define INCLUDED_SAVEFILE_H
20 
21 #define FINISHED_CODE 255
22 #define ITEM_VERSION 5
23 #define EGO_ART_KNOWN 0xffffffff
24 
33 extern bool character_saved;
34 
38 bool savefile_save(const char *path);
39 
43 bool savefile_load(const char *path, bool cheat_death);
44 
48 const char *savefile_get_description(const char *path);
49 
50 
57 /* Utility */
58 void note(const char *msg);
59 
60 /* Writing bits */
61 void wr_byte(byte v);
62 void wr_u16b(u16b v);
63 void wr_s16b(s16b v);
64 void wr_u32b(u32b v);
65 void wr_s32b(s32b v);
66 void wr_string(const char *str);
67 void pad_bytes(int n);
68 
69 /* Reading bits */
70 void rd_byte(byte *ip);
71 void rd_u16b(u16b *ip);
72 void rd_s16b(s16b *ip);
73 void rd_u32b(u32b *ip);
74 void rd_s32b(s32b *ip);
75 void rd_string(char *str, int max);
76 void strip_bytes(int n);
77 
78 
79 
80 /* load.c */
81 int rd_randomizer(void);
82 int rd_options(void);
83 int rd_messages(void);
84 int rd_monster_memory(void);
85 int rd_object_memory(void);
86 int rd_quests(void);
87 int rd_artifacts(void);
88 int rd_player(void);
89 int rd_ignore(void);
90 int rd_misc(void);
91 int rd_player_hp(void);
92 int rd_player_spells(void);
93 int rd_gear(void);
94 int rd_stores(void);
95 int rd_dungeon(void);
96 int rd_chunks(void);
97 int rd_objects(void);
98 int rd_monsters(void);
99 int rd_history(void);
100 int rd_traps(void);
101 int rd_null(void);
102 
103 /* save.c */
104 void wr_description(void);
105 void wr_randomizer(void);
106 void wr_options(void);
107 void wr_messages(void);
108 void wr_monster_memory(void);
109 void wr_object_memory(void);
110 void wr_quests(void);
111 void wr_artifacts(void);
112 void wr_player(void);
113 void wr_ignore(void);
114 void wr_misc(void);
115 void wr_player_hp(void);
116 void wr_player_spells(void);
117 void wr_randarts(void);
118 void wr_gear(void);
119 void wr_stores(void);
120 void wr_dungeon(void);
121 void wr_chunks(void);
122 void wr_objects(void);
123 void wr_monsters(void);
124 void wr_ghost(void);
125 void wr_history(void);
126 void wr_traps(void);
127 
128 
129 #endif /* INCLUDED_SAVEFILE_H */
uint16_t u16b
Definition: h-basic.h:169
void wr_u32b(u32b v)
Definition: savefile.c:237
void wr_randarts(void)
char ** path
Definition: main.c:147
int rd_traps(void)
Read the traps - wrapper functions.
Definition: load.c:1468
void rd_u32b(u32b *ip)
Definition: savefile.c:277
int rd_object_memory(void)
Definition: load.c:497
bool savefile_load(const char *path, bool cheat_death)
Load the savefile given.
Definition: savefile.c:620
uint32_t u32b
Definition: h-basic.h:172
void wr_options(void)
Write the "options".
Definition: save.c:300
void wr_string(const char *str)
Definition: savefile.c:250
void wr_player_spells(void)
Definition: save.c:680
int rd_player_spells(void)
Read the player spells.
Definition: load.c:1010
void wr_objects(void)
Definition: save.c:939
void wr_s16b(s16b v)
Definition: savefile.c:232
bool character_saved
Savefile API
Definition: savefile.c:74
void wr_history(void)
Definition: save.c:988
void wr_s32b(s32b v)
Definition: savefile.c:245
uint8_t byte
Definition: h-basic.h:167
int rd_artifacts(void)
Definition: load.c:957
void wr_player(void)
Definition: save.c:401
int rd_gear(void)
Read the player gear - wrapper functions.
Definition: load.c:1088
int rd_player_hp(void)
Definition: load.c:987
void pad_bytes(int n)
Definition: savefile.c:311
void wr_quests(void)
Definition: save.c:388
int rd_misc(void)
Definition: load.c:879
void wr_misc(void)
Definition: save.c:588
void wr_chunks(void)
Definition: save.c:960
void wr_monsters(void)
Definition: save.c:945
int rd_quests(void)
Definition: load.c:572
const char * msg
Definition: mon-msg.c:78
int rd_ignore(void)
Read ignore and autoinscription submenu for all known objects.
Definition: load.c:774
void wr_monster_memory(void)
Definition: save.c:340
int rd_chunks(void)
Read the chunk list.
Definition: load.c:1480
int rd_null(void)
For blocks that don't need loading anymore.
Definition: load.c:1566
int rd_objects(void)
Read the objects - wrapper functions.
Definition: load.c:1431
void rd_s16b(s16b *ip)
Definition: savefile.c:272
void wr_randomizer(void)
Write RNG state.
Definition: save.c:272
static void cheat_death(game_event_type type, game_event_data *data, void *user)
Temporary (hopefully) hackish solutions.
Definition: ui-display.c:2260
int16_t s16b
Definition: h-basic.h:170
int rd_monsters(void)
Read the monster list - wrapper functions.
Definition: load.c:1444
void rd_byte(byte *ip)
Definition: savefile.c:261
void rd_u16b(u16b *ip)
Definition: savefile.c:266
int rd_dungeon(void)
Definition: load.c:1379
void rd_string(char *str, int max)
Definition: savefile.c:290
int rd_stores(void)
Read the stores - wrapper functions.
Definition: load.c:1169
void wr_object_memory(void)
Definition: save.c:360
void wr_stores(void)
Definition: save.c:722
int rd_monster_memory(void)
Read monster memory.
Definition: load.c:453
void wr_gear(void)
Definition: save.c:715
void note(const char *msg)
Detailed saving and loading functions
Definition: savefile.c:177
void wr_u16b(u16b v)
Definition: savefile.c:226
int rd_messages(void)
Read the saved messages.
Definition: load.c:424
int rd_player(void)
Read the player information.
Definition: load.c:600
bool savefile_save(const char *path)
Save to the given location.
Definition: savefile.c:373
void wr_player_hp(void)
Definition: save.c:670
void wr_traps(void)
Definition: save.c:951
int32_t s32b
Definition: h-basic.h:173
const char * savefile_get_description(const char *path)
Try to get a description for this savefile.
Definition: savefile.c:590
int rd_randomizer(void)
Read RNG state.
Definition: load.c:348
void wr_dungeon(void)
Definition: save.c:918
void wr_ignore(void)
Definition: save.c:497
int rd_history(void)
Definition: load.c:1515
void strip_bytes(int n)
Definition: savefile.c:305
void wr_byte(byte v)
Accessor functions
Definition: savefile.c:221
int rd_options(void)
Read options.
Definition: load.c:384
void wr_ghost(void)
void wr_messages(void)
Definition: save.c:323
void wr_description(void)
Write a description of the character.
Definition: save.c:47
void wr_artifacts(void)
Definition: save.c:652
void rd_s32b(s32b *ip)
Definition: savefile.c:285