]> git.pond.sub.org Git - empserver/commitdiff
(fl_sct_init, write_sects, file_sct_init, main): Do not initialize
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 Jul 2007 13:40:47 +0000 (13:40 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 Jul 2007 13:40:47 +0000 (13:40 +0000)
sector and realm timestamps to current time.  It's not useful, and it
facilitates attacks against the PRNG.  This backs out fairland.c
rev. 1.27 and files.c rev. 1.31 and partly backs out files.c
rev. 1.38.

src/util/fairland.c
src/util/files.c

index 58ad7c563791eff5c005143820c6880aab088864..d16d9e1eb17700f5e20530346062a712d291a68d 100644 (file)
@@ -176,7 +176,7 @@ static int stable(void);
 static void elevate_land(void);
 static void elevate_sea(void);
 static int map_symbol(int x, int y);
 static void elevate_land(void);
 static void elevate_sea(void);
 static int map_symbol(int x, int y);
-static void fl_sct_init(coord, coord, struct sctstr *, time_t timestamp);
+static void fl_sct_init(coord, coord, struct sctstr *);
 static void set_coastal_flags(void);
 
 static void print_vars(void);
 static void set_coastal_flags(void);
 
 static void print_vars(void);
@@ -1085,13 +1085,12 @@ write_sects(void)
 {
     struct sctstr *sct;
     int c, x, y, total;
 {
     struct sctstr *sct;
     int c, x, y, total;
-    time_t current_time = time(NULL);
 
     /*  sct = &sects[0][0]; */
     sct = sectsbuf;
     for (y = 0; y < YSIZE; y++) {
        for (x = 0; x < XSIZE; x++, sct++) {
 
     /*  sct = &sects[0][0]; */
     sct = sectsbuf;
     for (y = 0; y < YSIZE; y++) {
        for (x = 0; x < XSIZE; x++, sct++) {
-           fl_sct_init(x * 2 + (y & 1), y, sct, current_time);
+           fl_sct_init(x * 2 + (y & 1), y, sct);
            total = elev[sct->sct_x][y];
            if (total < LANDMIN) {
                sct->sct_type = SCT_WATER;
            total = elev[sct->sct_x][y];
            if (total < LANDMIN) {
                sct->sct_type = SCT_WATER;
@@ -1219,7 +1218,7 @@ qprint(const char * const fmt, ...)
 }
 
 static void
 }
 
 static void
-fl_sct_init(coord x, coord y, struct sctstr *sp, time_t timestamp)
+fl_sct_init(coord x, coord y, struct sctstr *sp)
 {
     sp->ef_type = EF_SECTOR;
     sp->sct_x = x;
 {
     sp->ef_type = EF_SECTOR;
     sp->sct_x = x;
@@ -1229,7 +1228,6 @@ fl_sct_init(coord x, coord y, struct sctstr *sp, time_t timestamp)
     sp->sct_road = 0;
     sp->sct_rail = 0;
     sp->sct_defense = 0;
     sp->sct_road = 0;
     sp->sct_rail = 0;
     sp->sct_defense = 0;
-    sp->sct_timestamp = timestamp;
     sp->sct_coastal = 1;
 }
 
     sp->sct_coastal = 1;
 }
 
index 43021d76a5d339e86d4d68a8291d68eac74801a8..d67f506253d9fa8dcdafb7d2166dcaf583ae96df 100644 (file)
@@ -62,8 +62,7 @@
 #include "trade.h"
 #include "version.h"
 
 #include "trade.h"
 #include "version.h"
 
-static void file_sct_init(coord, coord, struct sctstr *ptr,
-                         time_t timestamp);
+static void file_sct_init(coord, coord, struct sctstr *ptr);
 
 static void
 print_usage(char *program_name)
 
 static void
 print_usage(char *program_name)
@@ -92,7 +91,6 @@ main(int argc, char *argv[])
     int opt;
     char *config_file = NULL;
     int force = 0;
     int opt;
     char *config_file = NULL;
     int force = 0;
-    time_t current_time = time(NULL);
 
     while ((opt = getopt(argc, argv, "e:fhv")) != EOF) {
        switch (opt) {
 
     while ((opt = getopt(argc, argv, "e:fhv")) != EOF) {
        switch (opt) {
@@ -173,7 +171,6 @@ main(int argc, char *argv[])
        for (j = 0; j < MAXNOR; j++) {
            realm.r_realm = j;
            realm.r_uid = (i * MAXNOR) + j;
        for (j = 0; j < MAXNOR; j++) {
            realm.r_realm = j;
            realm.r_uid = (i * MAXNOR) + j;
-           realm.r_timestamp = current_time;
            putrealm(&realm);
        }
     }
            putrealm(&realm);
        }
     }
@@ -192,7 +189,7 @@ main(int argc, char *argv[])
     memset(&sct, 0, sizeof(sct));
     for (y = 0; y < WORLD_Y; y++) {
        for (x = 0; x < WORLD_X / 2; x++) {
     memset(&sct, 0, sizeof(sct));
     for (y = 0; y < WORLD_Y; y++) {
        for (x = 0; x < WORLD_X / 2; x++) {
-           file_sct_init(x * 2 + (y & 1), y, &sct, current_time);
+           file_sct_init(x * 2 + (y & 1), y, &sct);
            putsect(&sct);
        }
     }
            putsect(&sct);
        }
     }
@@ -213,7 +210,7 @@ main(int argc, char *argv[])
 }
 
 static void
 }
 
 static void
-file_sct_init(coord x, coord y, struct sctstr *ptr, time_t timestamp)
+file_sct_init(coord x, coord y, struct sctstr *ptr)
 {
     struct sctstr *sp = (struct sctstr *)ptr;
 
 {
     struct sctstr *sp = (struct sctstr *)ptr;
 
@@ -222,7 +219,6 @@ file_sct_init(coord x, coord y, struct sctstr *ptr, time_t timestamp)
     sp->sct_y = y;
     sp->sct_dist_x = x;
     sp->sct_dist_y = y;
     sp->sct_y = y;
     sp->sct_dist_x = x;
     sp->sct_dist_y = y;
-    sp->sct_timestamp = timestamp;
     sp->sct_newtype = sp->sct_type = SCT_WATER;
     sp->sct_coastal = 1;
 }
     sp->sct_newtype = sp->sct_type = SCT_WATER;
     sp->sct_coastal = 1;
 }