Angband
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-lore.h"
#include "mon-make.h"
#include "mon-spell.h"
#include "mon-util.h"
#include "monster.h"
#include "obj-gear.h"
#include "obj-identify.h"
#include "obj-ignore.h"
#include "obj-make.h"
#include "obj-pile.h"
#include "obj-randart.h"
#include "obj-slays.h"
#include "obj-util.h"
#include "object.h"
#include "player-history.h"
#include "player-quest.h"
#include "player-spell.h"
#include "player-timed.h"
#include "player-util.h"
#include "player.h"
#include "savefile.h"
#include "store.h"
#include "trap.h"

Typedefs

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

Functions

static struct ego_itemlookup_ego (int idx)
 Find an ego item from its index.
static struct objectrd_item (void)
 Read an object.
static void rd_monster (monster_type *mon)
 Read a monster.
static void rd_trap (struct trap *trap)
 Read a trap record.
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.
static int rd_gear_aux (rd_item_t rd_item_version, struct object **gear)
 Read the player gear.
int rd_gear (void)
 Read the player gear - wrapper functions.
static int rd_stores_aux (rd_item_t rd_item_version)
 Read store contents.
int rd_stores (void)
 Read the stores - wrapper functions.
static int rd_dungeon_aux (struct chunk **c)
 Read the dungeon.
static int rd_objects_aux (rd_item_t rd_item_version, struct chunk *c)
 Read the floor object list.
static int rd_monsters_aux (struct chunk *c)
 Read monsters.
static int rd_traps_aux (struct chunk *c)
int rd_dungeon (void)
int rd_objects (void)
 Read the objects - wrapper functions.
int rd_monsters (void)
 Read the monster list - wrapper functions.
int rd_traps (void)
 Read the traps - wrapper functions.
int rd_chunks (void)
 Read the chunk list.
int rd_history (void)
int rd_null (void)
 For blocks that don't need loading anymore.

Variables

byte square_size = 0
 Dungeon constants.
byte hist_size = 0
 Player constants.
byte obj_mod_max = 0
 Object constants.
byte of_size = 0
byte id_size = 0
byte elem_max = 0
byte monster_blow_max = 0
 Monster constants.
byte rf_size = 0
byte rsf_size = 0
byte mflag_size = 0
byte trf_size = 0
 Trap constants.

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.

Typedef Documentation

typedef struct object*(* rd_item_t)(void)

Shorthand function pointer for rd_item version.

Function Documentation

static struct ego_item* lookup_ego ( int  idx)
staticread

Find an ego item from its index.

References e_info.

Referenced by rd_item().

int rd_artifacts ( void  )
int rd_chunks ( void  )
int rd_dungeon ( void  )
static int rd_dungeon_aux ( struct chunk **  c)
static

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 c1, cave_new(), chunk::created_at, chunk::feeling, chunk::feeling_squares, chunk::height, height, i, square::info, chunk::name, rd_byte(), rd_s32b(), rd_string(), rd_u16b(), square_set_feat(), square_size, chunk::squares, string_make(), chunk::width, and width.

Referenced by rd_chunks(), and rd_dungeon().

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.

static int rd_gear_aux ( rd_item_t  rd_item_version,
struct object **  gear 
)
static
int rd_history ( void  )
int rd_ignore ( void  )
static struct object* rd_item ( void  )
staticread
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  )
static void rd_monster ( monster_type mon)
static
int rd_monster_memory ( void  )
int rd_monsters ( void  )

Read the monster list - wrapper functions.

References cave, cave_k, and rd_monsters_aux().

static int rd_monsters_aux ( struct chunk c)
static
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().

static int rd_objects_aux ( rd_item_t  rd_item_version,
struct chunk c 
)
static

Read the floor object list.

References floor_carry(), format(), player::is_dead, object::ix, object::iy, note(), rd_item(), and TRUE.

Referenced by rd_chunks(), and rd_objects().

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.

int rd_stores ( void  )

Read the stores - wrapper functions.

References rd_item(), and rd_stores_aux().

static int rd_stores_aux ( rd_item_t  rd_item_version)
static
static void rd_trap ( struct trap trap)
static

Read a trap record.

References trap::flags, trap::fx, trap::fy, i, trap::kind, rd_byte(), trap::t_idx, trap_info, trf_size, and trap::xtra.

Referenced by rd_traps_aux().

int rd_traps ( void  )

Read the traps - wrapper functions.

References cave, cave_k, and rd_traps_aux().

static int rd_traps_aux ( struct chunk c)
static

Variable Documentation

byte elem_max = 0
byte hist_size = 0

Player constants.

Referenced by rd_history().

byte id_size = 0

Referenced by rd_item(), and rd_object_memory().

byte mflag_size = 0

Referenced by rd_monster(), and rd_monster_memory().

byte monster_blow_max = 0

Monster constants.

byte obj_mod_max = 0

Object constants.

Referenced by rd_item(), and rd_object_memory().

byte of_size = 0
byte rf_size = 0
byte rsf_size = 0
byte square_size = 0

Dungeon constants.

Referenced by rd_dungeon(), and rd_dungeon_aux().

byte trf_size = 0

Trap constants.

Referenced by rd_trap(), and rd_traps_aux().