Angband
Macros | Functions
savefile.h File Reference

Savefile loading and saving main routines. More...

Go to the source code of this file.

Macros

#define EQUIP_CODE   1
#define INVEN_CODE   2
#define FINISHED_CODE   3
#define ITEM_VERSION   5

Functions

bool savefile_save (const char *path)
 

Savefile API


bool savefile_load (const char *path, bool cheat_death)
 Load the savefile given.
const char * savefile_get_description (const char *path)
 Try to get a description for this savefile.
void note (const char *msg)
 

Detailed saving and loading functions


void wr_byte (byte v)
 

Accessor functions


void wr_u16b (u16b v)
void wr_s16b (s16b v)
void wr_u32b (u32b v)
void wr_s32b (s32b v)
void wr_string (const char *str)
void pad_bytes (int n)
void rd_byte (byte *ip)
void rd_u16b (u16b *ip)
void rd_s16b (s16b *ip)
void rd_u32b (u32b *ip)
void rd_s32b (s32b *ip)
void rd_string (char *str, int max)
void strip_bytes (int n)
int rd_randomizer (void)
 Read RNG state.
int rd_options (void)
 Read options.
int rd_messages (void)
 Read the saved messages.
int rd_monster_memory (void)
 Read monster memory.
int rd_object_memory (void)
int rd_quests (void)
int rd_artifacts (void)
int rd_player (void)
 Read the player information.
int rd_ignore (void)
 Read ignore and autoinscription submenu for all known objects.
int rd_misc (void)
int rd_player_hp (void)
int rd_player_spells (void)
 Read the player spells.
int rd_gear (void)
 Read the player gear - wrapper functions.
int rd_stores (void)
 Read the stores - wrapper functions.
int rd_dungeon (void)
int rd_chunks (void)
 Read the chunk list.
int rd_objects (void)
 Read the objects - wrapper functions.
int rd_monsters (void)
 Read the monster list - wrapper functions.
int rd_history (void)
int rd_traps (void)
 Read the traps - wrapper functions.
int rd_null (void)
 For blocks that don't need loading anymore.
void wr_description (void)
 Write a description of the character.
void wr_randomizer (void)
 Write RNG state.
void wr_options (void)
 Write the "options".
void wr_messages (void)
void wr_monster_memory (void)
void wr_object_memory (void)
void wr_quests (void)
void wr_artifacts (void)
void wr_player (void)
void wr_ignore (void)
void wr_misc (void)
void wr_player_hp (void)
void wr_player_spells (void)
void wr_randarts (void)
void wr_gear (void)
void wr_stores (void)
void wr_dungeon (void)
void wr_chunks (void)
void wr_objects (void)
void wr_monsters (void)
void wr_ghost (void)
void wr_history (void)
void wr_traps (void)

Detailed Description

Savefile loading and saving main routines.

Copyright (c) 2009 Andi Sidwell andi@.nosp@m.takk.nosp@m.aria..nosp@m.org

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation

#define EQUIP_CODE   1

Referenced by rd_gear_aux(), and wr_gear_aux().

#define FINISHED_CODE   3

Referenced by rd_gear_aux(), and wr_gear_aux().

#define INVEN_CODE   2

Referenced by wr_gear_aux().

#define ITEM_VERSION   5

Referenced by wr_item().

Function Documentation

void note ( const char *  message)
void pad_bytes ( int  n)

References wr_byte().

int rd_artifacts ( void  )
void rd_byte ( byte ip)
int rd_chunks ( void  )
int rd_dungeon ( void  )
int rd_gear ( void  )

Read the player gear - wrapper functions.

References player::body, calc_inventory(), player::gear, player::gear_k, rd_gear_aux(), rd_item(), and player::upkeep.

int rd_history ( void  )
int rd_ignore ( void  )
int rd_messages ( void  )

Read the saved messages.

References buf, i, message_add(), num, rd_s16b(), rd_string(), and rd_u16b().

int rd_misc ( void  )
int rd_monster_memory ( void  )
int rd_monsters ( void  )

Read the monster list - wrapper functions.

References cave, cave_k, and rd_monsters_aux().

int rd_null ( void  )

For blocks that don't need loading anymore.

int rd_object_memory ( void  )
int rd_objects ( void  )

Read the objects - wrapper functions.

References cave, cave_k, rd_item(), and rd_objects_aux().

int rd_options ( void  )
int rd_player ( void  )
int rd_player_hp ( void  )
int rd_player_spells ( void  )
int rd_quests ( void  )
int rd_randomizer ( void  )

Read RNG state.

There were originally 64 bytes of randomizer saved. Now we only need 32 + 5 bytes saved, so we'll read an extra 27 bytes at the end which won't be used.

References FALSE, i, RAND_DEG, Rand_quick, Rand_value, rd_u32b(), STATE, state_i, z0, z1, and z2.

void rd_s16b ( s16b ip)
void rd_s32b ( s32b ip)

References rd_u32b().

Referenced by rd_dungeon_aux(), rd_history(), rd_misc(), and rd_player().

int rd_stores ( void  )

Read the stores - wrapper functions.

References rd_item(), and rd_stores_aux().

void rd_string ( char *  str,
int  max 
)
int rd_traps ( void  )

Read the traps - wrapper functions.

References cave, cave_k, and rd_traps_aux().

void rd_u16b ( u16b ip)
void rd_u32b ( u32b ip)
const char* savefile_get_description ( const char *  path)

Try to get a description for this savefile.

Try to get a description for this savefile.

Fail gracefully.

References check_header(), file_close(), file_open(), FTYPE_TEXT, get_desc(), load_block(), MODE_READ, my_strcpy(), blockheader::name, next_blockheader(), savefile_desc, skip_block(), and streq.

Referenced by list_saves().

bool savefile_load ( const char *  path,
bool  cheat_death 
)
bool savefile_save ( const char *  path)
void strip_bytes ( int  n)

References rd_byte().

Referenced by rd_ignore(), and rd_player().

void wr_artifacts ( void  )
void wr_byte ( byte  v)
void wr_chunks ( void  )
void wr_description ( void  )
void wr_dungeon ( void  )
void wr_gear ( void  )
void wr_ghost ( void  )
void wr_history ( void  )
void wr_ignore ( void  )
void wr_messages ( void  )
void wr_misc ( void  )
void wr_monster_memory ( void  )
void wr_monsters ( void  )

References cave, cave_k, and wr_monsters_aux().

void wr_object_memory ( void  )
void wr_objects ( void  )

References cave, cave_k, and wr_objects_aux().

void wr_options ( void  )
void wr_player ( void  )
void wr_player_hp ( void  )
void wr_player_spells ( void  )
void wr_quests ( void  )
void wr_randarts ( void  )
void wr_randomizer ( void  )

Write RNG state.

There were originally 64 bytes of randomizer saved. Now we only need 32 + 5 bytes saved, so we'll write an extra 27 bytes at the end which won't be used.

References i, RAND_DEG, Rand_value, STATE, state_i, wr_u32b(), z0, z1, and z2.

void wr_s16b ( s16b  v)
void wr_s32b ( s32b  v)

References wr_u32b().

Referenced by wr_dungeon_aux(), wr_history(), and wr_misc().

void wr_stores ( void  )
void wr_string ( const char *  str)
void wr_traps ( void  )

References cave, cave_k, and wr_traps_aux().

void wr_u16b ( u16b  v)
void wr_u32b ( u32b  v)