(file_sct_init, main, fl_sct_init, write_sects): Assign sct_timestamp with the

time the sector was created in files and fairland programs.
This commit is contained in:
Ron Koenderink 2005-11-17 02:20:28 +00:00
parent 2ce7ab4178
commit 8f98e53a23
2 changed files with 13 additions and 6 deletions

View file

@ -177,7 +177,8 @@ static void elevate_land(void);
static void elevate_sea(void); static void elevate_sea(void);
static void translate_continents(void); static void translate_continents(void);
static int map_symbol(int x, int y); static int map_symbol(int x, int y);
static void fl_sct_init(coord x, coord y, s_char *ptr); static void fl_sct_init(coord x, coord y, s_char *ptr,
time_t timestamp);
static void print_vars(void); static void print_vars(void);
static void fl_move(int); static void fl_move(int);
@ -1077,12 +1078,13 @@ write_sects(void)
{ {
struct sctstr *sct; struct sctstr *sct;
int c, x, y, total; int c, x, y, total;
time_t current_time = time(NULL);
/* sct = &sects[0][0]; */ /* sct = &sects[0][0]; */
sct = sectsbuf; sct = sectsbuf;
for (y = 0; y < YSIZE; y++) { for (y = 0; y < YSIZE; y++) {
for (x = 0; x < XSIZE; x++, sct++) { for (x = 0; x < XSIZE; x++, sct++) {
fl_sct_init(x * 2 + (y & 01), y, (s_char *)sct); fl_sct_init(x * 2 + (y & 01), y, (s_char *)sct, current_time);
total = elev[sct->sct_x][y]; total = elev[sct->sct_x][y];
if (total < LANDMIN) { if (total < LANDMIN) {
sct->sct_type = SCT_WATER; sct->sct_type = SCT_WATER;
@ -1260,7 +1262,7 @@ qprint(const char * const fmt, ...)
} }
static void static void
fl_sct_init(coord x, coord y, s_char *ptr) fl_sct_init(coord x, coord y, s_char *ptr, time_t timestamp)
{ {
struct sctstr *sp = (struct sctstr *)ptr; struct sctstr *sp = (struct sctstr *)ptr;
@ -1272,4 +1274,5 @@ fl_sct_init(coord x, coord y, s_char *ptr)
sp->sct_road = 0; sp->sct_road = 0;
sp->sct_rail = 0; sp->sct_rail = 0;
sp->sct_defense = 0; sp->sct_defense = 0;
sp->sct_timestamp = timestamp;
} }

View file

@ -61,7 +61,8 @@
#include "prototypes.h" #include "prototypes.h"
#include "optlist.h" #include "optlist.h"
static void file_sct_init(coord x, coord y, s_char *ptr); static void file_sct_init(coord x, coord y, s_char *ptr,
time_t timestamp);
static void static void
print_usage(char *program_name) print_usage(char *program_name)
@ -83,6 +84,7 @@ main(int argc, char *argv[])
int opt; int opt;
char *config_file = NULL; char *config_file = NULL;
int force = 0; int force = 0;
time_t current_time = time(NULL);
while ((opt = getopt(argc, argv, "e:f")) != EOF) { while ((opt = getopt(argc, argv, "e:f")) != EOF) {
switch (opt) { switch (opt) {
@ -168,7 +170,8 @@ main(int argc, char *argv[])
memset(&sct, 0, sizeof(sct)); memset(&sct, 0, sizeof(sct));
for (y = 0; y < WORLD_Y; y++) { for (y = 0; y < WORLD_Y; y++) {
for (x = 0; x < WORLD_X / 2; x++) { for (x = 0; x < WORLD_X / 2; x++) {
file_sct_init(x * 2 + (y & 01), y, (s_char *)&sct); file_sct_init(x * 2 + (y & 01), y, (s_char *)&sct,
current_time);
putsect(&sct); putsect(&sct);
} }
} }
@ -190,7 +193,7 @@ main(int argc, char *argv[])
} }
static void static void
file_sct_init(coord x, coord y, s_char *ptr) file_sct_init(coord x, coord y, s_char *ptr, time_t timestamp)
{ {
struct sctstr *sp = (struct sctstr *)ptr; struct sctstr *sp = (struct sctstr *)ptr;
@ -199,4 +202,5 @@ file_sct_init(coord x, coord y, s_char *ptr)
sp->sct_y = y; sp->sct_y = y;
sp->sct_dist_x = x; sp->sct_dist_x = x;
sp->sct_dist_y = y; sp->sct_dist_y = y;
sp->sct_timestamp = timestamp;
} }