Reset map x/y start/size in single place
This commit is contained in:
@@ -2538,6 +2538,7 @@ extern void release_sound_mappings(void);
|
||||
|
||||
#if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET)
|
||||
extern void create_des_coder(void);
|
||||
extern void reset_xystart_size(void);
|
||||
extern struct mapfragment *mapfrag_fromstr(char *);
|
||||
extern void mapfrag_free(struct mapfragment **);
|
||||
extern schar mapfrag_get(struct mapfragment *, int, int);
|
||||
|
||||
@@ -733,10 +733,7 @@ clear_level_structures(void)
|
||||
stairway_free_all();
|
||||
g.made_branch = FALSE;
|
||||
clear_regions();
|
||||
g.xstart = 1;
|
||||
g.ystart = 0;
|
||||
g.xsize = COLNO - 1;
|
||||
g.ysize = ROWNO;
|
||||
reset_xystart_size();
|
||||
if (g.lev_message) {
|
||||
free(g.lev_message);
|
||||
g.lev_message = (char *) 0;
|
||||
|
||||
27
src/sp_lev.c
27
src/sp_lev.c
@@ -201,6 +201,15 @@ static struct monst *invent_carrying_monster = (struct monst *) 0;
|
||||
|
||||
#define TYP_CANNOT_MATCH(typ) ((typ) == MAX_TYPE || (typ) == INVALID_TYPE)
|
||||
|
||||
void
|
||||
reset_xystart_size(void)
|
||||
{
|
||||
g.xstart = 1; /* column [0] is off limits */
|
||||
g.ystart = 0;
|
||||
g.xsize = COLNO - 1; /* 1..COLNO-1 */
|
||||
g.ysize = ROWNO; /* 0..ROWNO-1 */
|
||||
}
|
||||
|
||||
/* Does typ match with levl[][].typ, considering special types
|
||||
MATCH_WALL and MAX_TYPE (aka transparency)? */
|
||||
static boolean
|
||||
@@ -3923,12 +3932,8 @@ spo_endroom(struct sp_coder* coder UNUSED)
|
||||
/* Need to ensure xstart/ystart/xsize/ysize have something sensible,
|
||||
in case there's some stuff to be created outside the outermost
|
||||
room, and there's no MAP. */
|
||||
if (g.xsize <= 1 && g.ysize <= 1) {
|
||||
g.xstart = 1;
|
||||
g.ystart = 0;
|
||||
g.xsize = COLNO - 1;
|
||||
g.ysize = ROWNO;
|
||||
}
|
||||
if (g.xsize <= 1 && g.ysize <= 1)
|
||||
reset_xystart_size();
|
||||
}
|
||||
update_croom();
|
||||
}
|
||||
@@ -6349,10 +6354,7 @@ TODO: g.coder->croom needs to be updated
|
||||
g.ystart = 0;
|
||||
}
|
||||
if (g.xsize <= 1 && g.ysize <= 1) {
|
||||
g.xstart = 1;
|
||||
g.ystart = 0;
|
||||
g.xsize = COLNO - 1;
|
||||
g.ysize = ROWNO;
|
||||
reset_xystart_size();
|
||||
} else {
|
||||
coordxy mptyp;
|
||||
|
||||
@@ -6493,10 +6495,7 @@ sp_level_coder_init(void)
|
||||
|
||||
g.level.flags.is_maze_lev = 0;
|
||||
|
||||
g.xstart = 1; /* column [0] is off limits */
|
||||
g.ystart = 0;
|
||||
g.xsize = COLNO - 1; /* 1..COLNO-1 */
|
||||
g.ysize = ROWNO; /* 0..ROWNO-1 */
|
||||
reset_xystart_size();
|
||||
|
||||
return coder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user