another main() bit (trunk only)

It always struck me as odd that x_maze_max and y_maze_max were
initialized in main().  They're only needed when making new levels, so
don't have to come before saved game restoration.  They could easily have
gone into init_dungeon() (although they make well predate that), or even
mklev() (reinitializing them for each new level wouldn't have been a big
deal).  That's all moot, though, since it's trivial to initialize them at
compile time.
This commit is contained in:
nethack.rankin
2009-03-23 00:29:56 +00:00
parent a2124ab231
commit 664229027e
6 changed files with 4 additions and 58 deletions

View File

@@ -24,7 +24,10 @@ NEARDATA int nroom = 0;
NEARDATA int nsubroom = 0;
NEARDATA int occtime = 0;
int x_maze_max, y_maze_max; /* initialized in main, used in mkmaze.c */
/* maze limits must be even; masking off lowest bit guarantees that */
int x_maze_max = (COLNO-1) & ~1,
y_maze_max = (ROWNO-1) & ~1;
int otg_temp; /* used by object_to_glyph() [otg] */
#ifdef REDO

View File

@@ -57,17 +57,6 @@ int MAIN(int argc, char **argv)
dlb_init(); /* must be before newgame() */
/*
* Initialization of the boundaries of the mazes
* Both boundaries have to be even.
*/
x_maze_max = COLNO-1;
if (x_maze_max % 2)
x_maze_max--;
y_maze_max = ROWNO-1;
if (y_maze_max % 2)
y_maze_max--;
/*
* Initialize the vision system. This must be before mklev() on a
* new game or before a level restore on a saved game.

View File

@@ -46,18 +46,6 @@ main (void)
hname = "Mac Hack";
hackpid = getpid();
/*
* Initialisation of the boundaries of the mazes
* Both boundaries have to be even.
*/
x_maze_max = COLNO-1;
if (x_maze_max % 2)
x_maze_max--;
y_maze_max = ROWNO-1;
if (y_maze_max % 2)
y_maze_max--;
setrandom();
initoptions();
init_nhwindows(&argc, (char **)&hname);

View File

@@ -415,18 +415,6 @@ char *argv[];
level_info[0].where = ACTIVE;
#endif
/*
* Initialisation of the boundaries of the mazes
* Both boundaries have to be even.
*/
x_maze_max = COLNO-1;
if (x_maze_max % 2)
x_maze_max--;
y_maze_max = ROWNO-1;
if (y_maze_max % 2)
y_maze_max--;
/*
* Initialize the vision system. This must be before mklev() on a
* new game or before a level restore on a saved game.

View File

@@ -231,17 +231,6 @@ char *argv[];
dlb_init(); /* must be before newgame() */
/*
* Initialization of the boundaries of the mazes
* Both boundaries have to be even.
*/
x_maze_max = COLNO-1;
if (x_maze_max % 2)
x_maze_max--;
y_maze_max = ROWNO-1;
if (y_maze_max % 2)
y_maze_max--;
/*
* Initialize the vision system. This must be before mklev() on a
* new game or before a level restore on a saved game.

View File

@@ -158,17 +158,6 @@ char *argv[];
dlb_init(); /* must be before newgame() */
/*
* Initialization of the boundaries of the mazes
* Both boundaries have to be even.
*/
x_maze_max = COLNO-1;
if (x_maze_max % 2)
x_maze_max--;
y_maze_max = ROWNO-1;
if (y_maze_max % 2)
y_maze_max--;
/*
* Initialize the vision system. This must be before mklev() on a
* new game or before a level restore on a saved game.