Macros | Typedefs | Functions | Variables
load.c File Reference

Individual loading functions. More...

#include "angband.h"
#include "cave.h"
#include "effects.h"
#include "game-world.h"
#include "generate.h"
#include "init.h"
#include "mon-group.h"
#include "mon-lore.h"
#include "mon-make.h"
#include "mon-spell.h"
#include "mon-util.h"
#include "monster.h"
#include "obj-curse.h"
#include "obj-gear.h"
#include "obj-ignore.h"
#include "obj-init.h"
#include "obj-knowledge.h"
#include "obj-make.h"
#include "obj-pile.h"
#include "obj-randart.h"
#include "obj-slays.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "object.h"
#include "player-calcs.h"
#include "player-history.h"
#include "player-quest.h"
#include "player-spell.h"
#include "player-timed.h"
#include "player-util.h"
#include "savefile.h"
#include "store.h"
#include "trap.h"


#define OBJ_RECOVER   0
 Setting this to 1 and recompiling gives a chance to recover a savefile where the object list has become corrupted. More...


typedef struct object *(* rd_item_t) (void)
 Shorthand function pointer for rd_item version. More...


static struct objectrd_item (void)
 Read an object. More...
static bool rd_monster (struct chunk *c, struct monster *mon)
 Read a monster. More...
static void rd_trap (struct trap *trap)
 Read a trap record. More...
int rd_randomizer (void)
 Read RNG state. More...
int rd_options (void)
 Read options. More...
int rd_messages (void)
 Read the saved messages. More...
int rd_monster_memory (void)
 Read monster memory. More...
int rd_object_memory (void)
int rd_quests (void)
int rd_player (void)
 Read the player information. More...
int rd_ignore (void)
 Read ignore and autoinscription submenu for all known objects. More...
int rd_misc (void)
int rd_artifacts (void)
int rd_player_hp (void)
int rd_player_spells (void)
 Read the player spells. More...
static int rd_gear_aux (rd_item_t rd_item_version, struct object **gear)
 Read the player gear. More...
int rd_gear (void)
 Read the player gear - wrapper functions. More...
static int rd_stores_aux (rd_item_t rd_item_version)
 Read store contents. More...
int rd_stores (void)
 Read the stores - wrapper functions. More...
static int rd_dungeon_aux (struct chunk **c)
 Read the dungeon. More...
static int rd_objects_aux (rd_item_t rd_item_version, struct chunk *c)
 Read the floor object list. More...
static int rd_monsters_aux (struct chunk *c)
 Read monsters. More...
static int rd_traps_aux (struct chunk *c)
int rd_dungeon (void)
int rd_objects (void)
 Read the objects - wrapper functions. More...
int rd_monsters (void)
 Read the monster list - wrapper functions. More...
int rd_traps (void)
 Read the traps - wrapper functions. More...
int rd_chunks (void)
 Read the chunk list. More...
int rd_history (void)
int rd_null (void)
 For blocks that don't need loading anymore. More...


static byte square_size = 0
 Dungeon constants. More...
static byte hist_size = 0
 Player constants. More...
static byte obj_mod_max = 0
 Object constants. More...
static byte of_size = 0
static byte elem_max = 0
static byte brand_max
static byte slay_max
static byte curse_max
static byte mflag_size = 0
 Monster constants. More...
static byte trf_size = 0
 Trap constants. More...

Detailed Description

Individual loading functions.

Copyright (c) 1997 Ben Harrison, and others

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 OBJ_RECOVER   0

Setting this to 1 and recompiling gives a chance to recover a savefile where the object list has become corrupted.

Don't forget to reset to 0 and recompile again as soon as the savefile is viable again.

Typedef Documentation

◆ rd_item_t

typedef struct object*(* rd_item_t) (void)

Shorthand function pointer for rd_item version.

Function Documentation

◆ rd_artifacts()

int rd_artifacts ( void  )

◆ rd_chunks()

int rd_chunks ( void  )

◆ rd_dungeon()

int rd_dungeon ( void  )

◆ rd_dungeon_aux()

static int rd_dungeon_aux ( struct chunk **  c)

Read the dungeon.

The monsters/objects must be loaded in the same order that they were stored, since the actual indexes matter.

Note that the size of the dungeon is now the currrent dimensions of the cave global variable.

Note that dungeon objects, including objects held by monsters, are placed directly into the dungeon, using "object_copy()", which will copy "iy", "ix", and "held_m_idx", leaving "next_o_idx" blank for objects held by monsters, since it is not saved in the savefile.

After loading the monsters, the objects being held by monsters are linked directly into those monsters.

References player_upkeep::arena_level, c1, cave_new(), connector::feat, chunk::feeling, chunk::feeling_squares, connector::grid, chunk::height, height, i, square::info, connector::info, chunk::join, loc(), mem_zalloc(), chunk::name, connector::next, OPT, rd_byte(), rd_s32b(), rd_string(), rd_u16b(), square_set_feat(), square_size, chunk::squares, streq, string_make(), chunk::turn, player::upkeep, chunk::width, width, loc::x, and loc::y.

Referenced by rd_chunks(), and rd_dungeon().

◆ rd_gear()

int rd_gear ( void  )

◆ rd_gear_aux()

static int rd_gear_aux ( rd_item_t  rd_item_version,
struct object **  gear 

◆ rd_history()

int rd_history ( void  )

◆ rd_ignore()

int rd_ignore ( void  )

◆ rd_item()

static struct object* rd_item ( void  )

◆ rd_messages()

int rd_messages ( void  )

Read the saved messages.

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

◆ rd_misc()

int rd_misc ( void  )

◆ rd_monster()

static bool rd_monster ( struct chunk c,
struct monster mon 

◆ rd_monster_memory()

int rd_monster_memory ( void  )

◆ rd_monsters()

int rd_monsters ( void  )

◆ rd_monsters_aux()

static int rd_monsters_aux ( struct chunk c)

◆ rd_null()

int rd_null ( void  )

For blocks that don't need loading anymore.

◆ rd_object_memory()

int rd_object_memory ( void  )

◆ rd_objects()

int rd_objects ( void  )

Read the objects - wrapper functions.

References cave, player::cave, rd_item(), and rd_objects_aux().

◆ rd_objects_aux()

static int rd_objects_aux ( rd_item_t  rd_item_version,
struct chunk c 

◆ rd_options()

int rd_options ( void  )

◆ rd_player()

int rd_player ( void  )

◆ rd_player_hp()

int rd_player_hp ( void  )

◆ rd_player_spells()

int rd_player_spells ( void  )

◆ rd_quests()

int rd_quests ( void  )

◆ rd_randomizer()

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 i, RAND_DEG, Rand_quick, Rand_value, rd_u32b(), STATE, state_i, z0, z1, and z2.

◆ rd_stores()

int rd_stores ( void  )

Read the stores - wrapper functions.

References rd_item(), and rd_stores_aux().

◆ rd_stores_aux()

static int rd_stores_aux ( rd_item_t  rd_item_version)

◆ rd_trap()

static void rd_trap ( struct trap trap)

◆ rd_traps()

int rd_traps ( void  )

Read the traps - wrapper functions.

References cave, player::cave, and rd_traps_aux().

◆ rd_traps_aux()

static int rd_traps_aux ( struct chunk c)

Variable Documentation

◆ brand_max

byte brand_max

◆ curse_max

byte curse_max

◆ elem_max

byte elem_max = 0

◆ hist_size

byte hist_size = 0

Player constants.

Referenced by rd_history().

◆ mflag_size

byte mflag_size = 0

Monster constants.

Referenced by rd_monster(), and rd_monster_memory().

◆ obj_mod_max

byte obj_mod_max = 0

Object constants.

Referenced by rd_item(), and rd_object_memory().

◆ of_size

byte of_size = 0

◆ slay_max

byte slay_max

◆ square_size

byte square_size = 0

Dungeon constants.

Referenced by rd_dungeon(), and rd_dungeon_aux().

◆ trf_size

byte trf_size = 0

Trap constants.

Referenced by rd_trap(), and rd_traps_aux().