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:
+4
-1
@@ -24,7 +24,10 @@ NEARDATA int nroom = 0;
|
|||||||
NEARDATA int nsubroom = 0;
|
NEARDATA int nsubroom = 0;
|
||||||
NEARDATA int occtime = 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] */
|
int otg_temp; /* used by object_to_glyph() [otg] */
|
||||||
|
|
||||||
#ifdef REDO
|
#ifdef REDO
|
||||||
|
|||||||
@@ -57,17 +57,6 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
dlb_init(); /* must be before newgame() */
|
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
|
* Initialize the vision system. This must be before mklev() on a
|
||||||
* new game or before a level restore on a saved game.
|
* new game or before a level restore on a saved game.
|
||||||
|
|||||||
@@ -46,18 +46,6 @@ main (void)
|
|||||||
hname = "Mac Hack";
|
hname = "Mac Hack";
|
||||||
hackpid = getpid();
|
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();
|
setrandom();
|
||||||
initoptions();
|
initoptions();
|
||||||
init_nhwindows(&argc, (char **)&hname);
|
init_nhwindows(&argc, (char **)&hname);
|
||||||
|
|||||||
@@ -415,18 +415,6 @@ char *argv[];
|
|||||||
level_info[0].where = ACTIVE;
|
level_info[0].where = ACTIVE;
|
||||||
#endif
|
#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
|
* Initialize the vision system. This must be before mklev() on a
|
||||||
* new game or before a level restore on a saved game.
|
* new game or before a level restore on a saved game.
|
||||||
|
|||||||
@@ -231,17 +231,6 @@ char *argv[];
|
|||||||
|
|
||||||
dlb_init(); /* must be before newgame() */
|
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
|
* Initialize the vision system. This must be before mklev() on a
|
||||||
* new game or before a level restore on a saved game.
|
* new game or before a level restore on a saved game.
|
||||||
|
|||||||
@@ -158,17 +158,6 @@ char *argv[];
|
|||||||
|
|
||||||
dlb_init(); /* must be before newgame() */
|
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
|
* Initialize the vision system. This must be before mklev() on a
|
||||||
* new game or before a level restore on a saved game.
|
* new game or before a level restore on a saved game.
|
||||||
|
|||||||
Reference in New Issue
Block a user