]> git.pond.sub.org Git - empserver/commitdiff
New xdump updates:
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 18 Jul 2007 06:16:33 +0000 (06:16 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 18 Jul 2007 06:16:33 +0000 (06:16 +0000)
(EF_UPDATES, update_ca): New.
(empfile): Add it.
(update_time): Move to src/lib/global/updtime.c.

include/file.h
include/nsc.h
include/server.h
src/lib/commands/xdump.c
src/lib/global/file.c
src/lib/global/nsc.c
src/lib/global/updtime.c [new file with mode: 0644]
src/server/update.c

index 3011a13f87443d42b7f2271b37f37df824135f74..0ca82d91b850b6cecd19bae8eeabf19a5cc37329 100644 (file)
@@ -129,6 +129,7 @@ enum {
     EF_NUKE_CHR,
     EF_NEWS_CHR,
     EF_INFRASTRUCTURE,
+    EF_UPDATES,
     EF_TABLE,
     EF_META,
     /* Symbol tables */
index 5ba06a9bba7cae971ec27c8ae9efa91f58dd992d..15bb65163af66f0ddb1bc23fff263d30c11cbe3b 100644 (file)
@@ -219,6 +219,7 @@ extern struct castr realm_ca[];
 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[];
index c0bb483d53cf9223a0f6472fa6902b5b384d4ad8..dd24388e9467a7cf73be2292fc458d8ad933cc77 100644 (file)
@@ -40,7 +40,7 @@ extern int shutdown_pending;
 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);
index e1d4217bdee2501e97d6f4455688f707e2e65f83..77b3eed3d5f4725ecef2037997e2f42b84d0f8df 100644 (file)
@@ -28,7 +28,7 @@
  *  xdump.c: Experimental extended dump
  * 
  *  Known contributors to this file:
- *     Markus Armbruster, 2004-2006
+ *     Markus Armbruster, 2004-2007
  */
 
 /*
@@ -46,6 +46,7 @@
  * - 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:
index 9f91ebb7b40b0b19a0c14a10491cca803a6b5a1c..017c1647b2769e9f1bd75daf6ea5972514b80dd0 100644 (file)
@@ -28,7 +28,7 @@
  *  file.c: Empire game data file descriptions.
  * 
  *  Known contributors to this file:
- *     Markus Armbruster, 2005
+ *     Markus Armbruster, 2005-2007
  */
 
 #include <config.h>
@@ -49,6 +49,7 @@
 #include "product.h"
 #include "sect.h"
 #include "ship.h"
+#include "server.h"
 #include "trade.h"
 #include "treaty.h"
 
@@ -162,6 +163,8 @@ struct empfile empfile[] = {
      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,
index 0e1ca3ea927b1ac379f1eb5f00aa07a55cc12bd4..8a58a4cd955699e707f9d7ffb9e271e6972907aa 100644 (file)
@@ -28,7 +28,7 @@
  *  nsc.c: Empire selection global structures
  * 
  *  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}
 };
 
+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},
diff --git a/src/lib/global/updtime.c b/src/lib/global/updtime.c
new file mode 100644 (file)
index 0000000..0c37c6c
--- /dev/null
@@ -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[];
index b4e7c07c040fe0f8bfce7aeb23c76f7c207587fb..2704cad1d38f8140f3fbed220756ed46244b098a 100644 (file)
@@ -48,8 +48,6 @@
 #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.
@@ -68,8 +66,6 @@ int update_pending;
  */
 int update_running;
 
-time_t update_time[UPDATES];
-
 static time_t update_schedule_anchor;
 static int update_wanted;
 
@@ -116,7 +112,8 @@ update_get_schedule(void)
 {
     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;