static int save_cursor; /* currently displayed cursor position */
static int change_ok = TRUE; /* true if new sector may be displayed */
+#ifdef A_COLOR
+void init_colors()
+{
+ start_color();
+
+ init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
+ init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
+ init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
+ init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
+ init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
+ init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
+ init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
+ init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
+}
+#endif /* A_COLOR */
+
/*
This routine is called when the current display has been
trashed and no sector is shown on the screen.
r = loc_row (loc);
c = loc_col (loc);
(void) move (r-ref_row+NUMTOPS, c-ref_col);
- (void) addch ((chtype)vmap[loc].contents);;
+ disp_square(&vmap[loc]);
save_cursor = loc; /* remember cursor location */
(void) move (r-ref_row+NUMTOPS, c-ref_col);
}
}
}
+/*
+Display the contents of a single map square.
+
+Fancy color hacks are done here. At the moment this is kind of bogus,
+because the color doesn't convey any extra information, it just looks
+pretty.
+*/
+
+
+static disp_square(vp)
+view_map_t *vp;
+{
+#ifdef A_COLOR
+ switch(vp->contents)
+ {
+ case '+':
+ attron(COLOR_PAIR(COLOR_GREEN));
+ break;
+ case '.':
+ attron(COLOR_PAIR(COLOR_BLUE));
+ break;
+ case 'a':
+ case 'f':
+ case 'p':
+ case 'd':
+ case 'b':
+ case 't':
+ case 'c':
+ case 'z':
+ case 'X':
+ attron(COLOR_PAIR(COLOR_RED));
+ break;
+ default:
+ attron(COLOR_PAIR(COLOR_WHITE));
+ break;
+ }
+#endif /* A_COLOR */
+ (void) addch ((chtype)vp->contents);
+#ifdef A_COLOR
+ attrset(0);
+#endif /* A_COLOR */
+}
+
+
/*
Display the portion of the map that appears on the screen.
*/
for (c = ref_col; c < ref_col + display_cols && c < MAP_WIDTH; c++) {
t = row_col_loc (r, c);
(void) move (r-ref_row+NUMTOPS, c-ref_col);
- (void) addch ((chtype)vmap[t].contents);;
+ disp_square(&vmap[t]);
}
}
int WATER_RATIO; /* percentage of map that is water */
int MIN_CITY_DIST; /* cities must be at least this far apart */
int delay_time;
+int save_interval; /* turns between autosaves */
real_map_t map[MAP_SIZE]; /* the way the world really looks */
view_map_t comp_map[MAP_SIZE]; /* computer's view of the world */
void print_pzoom();
void print_xzoom();
void display_score();
+#ifdef A_COLOR
+void init_colors();
+#endif /* A_COLOR */
void init_game(); /* game routines */
void save_game();
-d delay: number of milliseconds to delay between output.
default is 2000 (2 seconds).
+
+ -S saveinterval: sets turn interval between saves.
+ default is 10
*/
#include <stdio.h>
#include "empire.h"
#include "extern.h"
-#define OPTFLAGS "w:s:d:"
+#define OPTFLAGS "w:s:d:S:"
main (argc, argv)
int argc;
extern int optind;
extern int opterr; /* set to 1 to suppress error msg */
int errflg = 0;
- int wflg, sflg, dflg;
+ int wflg, sflg, dflg, Sflg;
int land;
wflg = 70; /* set defaults */
sflg = 5;
dflg = 2000;
+ Sflg = 10;
/*
* extract command line options
case 'd':
dflg = atoi (optarg);
break;
+ case 'S':
+ Sflg = atoi (optarg);
+ break;
case '?': /* illegal option? */
errflg++;
break;
SMOOTH = sflg;
WATER_RATIO = wflg;
delay_time = dflg;
+ save_interval = Sflg;
/* compute min distance between cities */
land = MAP_SIZE * (100 - WATER_RATIO) / 100; /* available land */