New xdump updates:
(EF_UPDATES, update_ca): New. (empfile): Add it. (update_time): Move to src/lib/global/updtime.c.
This commit is contained in:
parent
e9cfbdc241
commit
7dd8b8a305
8 changed files with 55 additions and 9 deletions
|
@ -129,6 +129,7 @@ enum {
|
||||||
EF_NUKE_CHR,
|
EF_NUKE_CHR,
|
||||||
EF_NEWS_CHR,
|
EF_NEWS_CHR,
|
||||||
EF_INFRASTRUCTURE,
|
EF_INFRASTRUCTURE,
|
||||||
|
EF_UPDATES,
|
||||||
EF_TABLE,
|
EF_TABLE,
|
||||||
EF_META,
|
EF_META,
|
||||||
/* Symbol tables */
|
/* Symbol tables */
|
||||||
|
|
|
@ -219,6 +219,7 @@ extern struct castr realm_ca[];
|
||||||
extern struct castr game_ca[];
|
extern struct castr game_ca[];
|
||||||
extern struct castr intrchr_ca[];
|
extern struct castr intrchr_ca[];
|
||||||
extern struct castr rpt_ca[];
|
extern struct castr rpt_ca[];
|
||||||
|
extern struct castr update_ca[];
|
||||||
extern struct castr empfile_ca[];
|
extern struct castr empfile_ca[];
|
||||||
extern struct castr symbol_ca[];
|
extern struct castr symbol_ca[];
|
||||||
extern struct symbol ship_chr_flags[];
|
extern struct symbol ship_chr_flags[];
|
||||||
|
|
|
@ -40,7 +40,7 @@ extern int shutdown_pending;
|
||||||
extern int update_pending;
|
extern int update_pending;
|
||||||
extern int update_running;
|
extern int update_running;
|
||||||
extern empth_rwlock_t *update_lock;
|
extern empth_rwlock_t *update_lock;
|
||||||
extern time_t update_time[];
|
extern time_t update_time[16];
|
||||||
|
|
||||||
void market_init(void);
|
void market_init(void);
|
||||||
void update_main(void);
|
void update_main(void);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* xdump.c: Experimental extended dump
|
* xdump.c: Experimental extended dump
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2004-2006
|
* Markus Armbruster, 2004-2007
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
* - News item characteristics: rpt[]
|
* - News item characteristics: rpt[]
|
||||||
* - News page headings: page_headings[]
|
* - News page headings: page_headings[]
|
||||||
* - Commands: player_coms[] (TODO)
|
* - Commands: player_coms[] (TODO)
|
||||||
|
* - Update schedule: update_time[] (not really static)
|
||||||
* - Configuration: configkeys[]
|
* - Configuration: configkeys[]
|
||||||
*
|
*
|
||||||
* Dynamic game data:
|
* Dynamic game data:
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* file.c: Empire game data file descriptions.
|
* file.c: Empire game data file descriptions.
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2005
|
* Markus Armbruster, 2005-2007
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -49,6 +49,7 @@
|
||||||
#include "product.h"
|
#include "product.h"
|
||||||
#include "sect.h"
|
#include "sect.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
|
#include "server.h"
|
||||||
#include "trade.h"
|
#include "trade.h"
|
||||||
#include "treaty.h"
|
#include "treaty.h"
|
||||||
|
|
||||||
|
@ -162,6 +163,8 @@ struct empfile empfile[] = {
|
||||||
ARRAY_TABLE(rpt, EFF_CFG)},
|
ARRAY_TABLE(rpt, EFF_CFG)},
|
||||||
{EF_INFRASTRUCTURE, "infrastructure", "infra.config", intrchr_ca,
|
{EF_INFRASTRUCTURE, "infrastructure", "infra.config", intrchr_ca,
|
||||||
ARRAY_CACHE(intrchr, EFF_CFG)},
|
ARRAY_CACHE(intrchr, EFF_CFG)},
|
||||||
|
{EF_UPDATES, "updates", NULL, update_ca,
|
||||||
|
ARRAY_TABLE(update_time, EFF_CFG)},
|
||||||
{EF_TABLE, "table", NULL, empfile_ca,
|
{EF_TABLE, "table", NULL, empfile_ca,
|
||||||
ARRAY_TABLE(empfile, EFF_CFG)},
|
ARRAY_TABLE(empfile, EFF_CFG)},
|
||||||
{EF_META, "meta", NULL, mdchr_ca,
|
{EF_META, "meta", NULL, mdchr_ca,
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* nsc.c: Empire selection global structures
|
* nsc.c: Empire selection global structures
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Markus Armbruster, 2004-2006
|
* Markus Armbruster, 2004-2007
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -576,6 +576,11 @@ struct castr rpt_ca[] = {
|
||||||
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
|
{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[] = {
|
struct castr empfile_ca[] = {
|
||||||
{NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
|
{NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
|
||||||
{NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
|
{NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
|
||||||
|
|
38
src/lib/global/updtime.c
Normal file
38
src/lib/global/updtime.c
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* 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[];
|
|
@ -48,8 +48,6 @@
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
#define UPDATES 16
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock to synchronize player threads with the update.
|
* Lock to synchronize player threads with the update.
|
||||||
* Update takes it exclusive, commands take it shared.
|
* Update takes it exclusive, commands take it shared.
|
||||||
|
@ -68,8 +66,6 @@ int update_pending;
|
||||||
*/
|
*/
|
||||||
int update_running;
|
int update_running;
|
||||||
|
|
||||||
time_t update_time[UPDATES];
|
|
||||||
|
|
||||||
static time_t update_schedule_anchor;
|
static time_t update_schedule_anchor;
|
||||||
static int update_wanted;
|
static int update_wanted;
|
||||||
|
|
||||||
|
@ -116,7 +112,8 @@ update_get_schedule(void)
|
||||||
{
|
{
|
||||||
time_t now = time(NULL);
|
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) {
|
now + 30, update_schedule_anchor) < 0) {
|
||||||
logerror("No update schedule!");
|
logerror("No update schedule!");
|
||||||
update_time[0] = 0;
|
update_time[0] = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue