Split freeing proto_dungeon data
This commit is contained in:
+21
-16
@@ -55,6 +55,7 @@ static void init_dungeon_set_entry(struct proto_dungeon *, int);
|
|||||||
static void init_dungeon_set_depth(struct proto_dungeon *, int);
|
static void init_dungeon_set_depth(struct proto_dungeon *, int);
|
||||||
static void init_castle_tune(void);
|
static void init_castle_tune(void);
|
||||||
static void fixup_level_locations(void);
|
static void fixup_level_locations(void);
|
||||||
|
static void free_proto_dungeon(struct proto_dungeon *);
|
||||||
static boolean init_dungeon_dungeons(lua_State *, struct proto_dungeon *, int);
|
static boolean init_dungeon_dungeons(lua_State *, struct proto_dungeon *, int);
|
||||||
static boolean unplaced_floater(struct dungeon *);
|
static boolean unplaced_floater(struct dungeon *);
|
||||||
static boolean unreachable_level(d_level *, boolean);
|
static boolean unreachable_level(d_level *, boolean);
|
||||||
@@ -1176,6 +1177,25 @@ fixup_level_locations(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_proto_dungeon(struct proto_dungeon *pd)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < pd->n_brs; i++) {
|
||||||
|
free((genericptr_t) pd->tmpbranch[i].name);
|
||||||
|
}
|
||||||
|
for (i = 0; i < pd->n_levs; i++) {
|
||||||
|
free((genericptr_t) pd->tmplevel[i].name);
|
||||||
|
if (pd->tmplevel[i].chainlvl)
|
||||||
|
free((genericptr_t) pd->tmplevel[i].chainlvl);
|
||||||
|
}
|
||||||
|
for (i = 0; i < gn.n_dgns; i++) {
|
||||||
|
free((genericptr_t) pd->tmpdungeon[i].name);
|
||||||
|
free((genericptr_t) pd->tmpdungeon[i].protoname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize the "dungeon" structs */
|
/* initialize the "dungeon" structs */
|
||||||
void
|
void
|
||||||
init_dungeons(void)
|
init_dungeons(void)
|
||||||
@@ -1286,24 +1306,9 @@ init_dungeons(void)
|
|||||||
pd.n_levs, pd.n_brs);
|
pd.n_levs, pd.n_brs);
|
||||||
|
|
||||||
init_castle_tune();
|
init_castle_tune();
|
||||||
|
|
||||||
fixup_level_locations();
|
fixup_level_locations();
|
||||||
|
|
||||||
nhl_done(L);
|
nhl_done(L);
|
||||||
|
free_proto_dungeon(&pd);
|
||||||
for (i = 0; i < pd.n_brs; i++) {
|
|
||||||
free((genericptr_t) pd.tmpbranch[i].name);
|
|
||||||
}
|
|
||||||
for (i = 0; i < pd.n_levs; i++) {
|
|
||||||
free((genericptr_t) pd.tmplevel[i].name);
|
|
||||||
if (pd.tmplevel[i].chainlvl)
|
|
||||||
free((genericptr_t) pd.tmplevel[i].chainlvl);
|
|
||||||
}
|
|
||||||
for (i = 0; i < gn.n_dgns; i++) {
|
|
||||||
free((genericptr_t) pd.tmpdungeon[i].name);
|
|
||||||
free((genericptr_t) pd.tmpdungeon[i].protoname);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
dumpit();
|
dumpit();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user