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-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"

Typedefs

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

Functions

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...
 

Variables

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.

Typedef Documentation

typedef struct object*(* rd_item_t)(void)

Shorthand function pointer for rd_item version.

Function Documentation

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(), connector::feat, chunk::feeling, chunk::feeling_squares, connector::grid, chunk::height, height, i, square::info, connector::info, chunk::join, mem_zalloc(), chunk::name, connector::next, OPT, rd_byte(), rd_s32b(), rd_string(), rd_u16b(), square_set_feat(), square_size, chunk::squares, string_make(), chunk::turn, chunk::width, width, loc::x, and loc::y.

Referenced by rd_chunks(), and rd_dungeon().

int rd_gear ( void  )
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  )
static
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 bool rd_monster ( struct chunk c,
struct monster mon 
)
static
int rd_monster_memory ( void  )
int rd_monsters ( void  )

Read the monster list - wrapper functions.

References cave, player::cave, i, player::is_dead, object::known, chunk::obj_max, chunk::objects, 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, player::cave, rd_item(), and rd_objects_aux().

static int rd_objects_aux ( rd_item_t  rd_item_version,
struct chunk c 
)
static
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 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
int rd_traps ( void  )

Read the traps - wrapper functions.

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

static int rd_traps_aux ( struct chunk c)
static

Variable Documentation

byte brand_max
static
byte curse_max
static
byte elem_max = 0
static
byte hist_size = 0
static

Player constants.

Referenced by rd_history().

byte mflag_size = 0
static

Monster constants.

Referenced by rd_monster(), and rd_monster_memory().

byte obj_mod_max = 0
static

Object constants.

Referenced by rd_item(), and rd_object_memory().

byte of_size = 0
static
byte slay_max
static
byte square_size = 0
static

Dungeon constants.

Referenced by rd_dungeon(), and rd_dungeon_aux().

byte trf_size = 0
static

Trap constants.

Referenced by rd_trap(), and rd_traps_aux().