(EF_UPDATES, update_ca): New.
(empfile): Add it.
(update_time): Move to src/lib/global/updtime.c.
EF_NUKE_CHR,
EF_NEWS_CHR,
EF_INFRASTRUCTURE,
+ EF_UPDATES,
EF_TABLE,
EF_META,
/* Symbol tables */
extern struct castr game_ca[];
extern struct castr intrchr_ca[];
extern struct castr rpt_ca[];
+extern struct castr update_ca[];
extern struct castr empfile_ca[];
extern struct castr symbol_ca[];
extern struct symbol ship_chr_flags[];
extern int update_pending;
extern int update_running;
extern empth_rwlock_t *update_lock;
-extern time_t update_time[];
+extern time_t update_time[16];
void market_init(void);
void update_main(void);
* xdump.c: Experimental extended dump
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2006
+ * Markus Armbruster, 2004-2007
*/
/*
* - News item characteristics: rpt[]
* - News page headings: page_headings[]
* - Commands: player_coms[] (TODO)
+ * - Update schedule: update_time[] (not really static)
* - Configuration: configkeys[]
*
* Dynamic game data:
* file.c: Empire game data file descriptions.
*
* Known contributors to this file:
- * Markus Armbruster, 2005
+ * Markus Armbruster, 2005-2007
*/
#include <config.h>
#include "product.h"
#include "sect.h"
#include "ship.h"
+#include "server.h"
#include "trade.h"
#include "treaty.h"
ARRAY_TABLE(rpt, EFF_CFG)},
{EF_INFRASTRUCTURE, "infrastructure", "infra.config", intrchr_ca,
ARRAY_CACHE(intrchr, EFF_CFG)},
+ {EF_UPDATES, "updates", NULL, update_ca,
+ ARRAY_TABLE(update_time, EFF_CFG)},
{EF_TABLE, "table", NULL, empfile_ca,
ARRAY_TABLE(empfile, EFF_CFG)},
{EF_META, "meta", NULL, mdchr_ca,
* nsc.c: Empire selection global structures
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2006
+ * Markus Armbruster, 2004-2007
*/
/*
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
+struct castr update_ca[] = {
+ {NSC_TIME, 0, 0, 0, "time", EF_BAD},
+ {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+};
+
struct castr empfile_ca[] = {
{NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
{NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
--- /dev/null
+/*
+ * Empire - A multi-player, client/server Internet based war game.
+ * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Ken Stevens, Steve McClure
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * ---
+ *
+ * See files README, COPYING and CREDITS in the root of the source
+ * tree for related information and legal notices. It is expected
+ * that future projects/authors will amend these files as needed.
+ *
+ * ---
+ *
+ * updtime.c: Scheduled update times
+ *
+ * Known contributors to this file:
+ * Markus Armbruster, 2007
+ */
+
+#include <config.h>
+
+#include "server.h"
+
+time_t update_time[];
#include "prototypes.h"
#include "server.h"
-#define UPDATES 16
-
/*
* Lock to synchronize player threads with the update.
* Update takes it exclusive, commands take it shared.
*/
int update_running;
-time_t update_time[UPDATES];
-
static time_t update_schedule_anchor;
static int update_wanted;
{
time_t now = time(NULL);
- if (read_schedule(schedulefil, update_time, UPDATES,
+ if (read_schedule(schedulefil, update_time,
+ sizeof(update_time) / sizeof(*update_time),
now + 30, update_schedule_anchor) < 0) {
logerror("No update schedule!");
update_time[0] = 0;