home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9a45da3
)
Server: Simplify rule for when to update worldstate file.
author
Christian Heller
<c.heller@plomlompom.de>
Thu, 10 Jul 2014 01:28:18 +0000
(
03:28
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Thu, 10 Jul 2014 01:28:18 +0000
(
03:28
+0200)
src/server/init.c
patch
|
blob
|
history
src/server/init.h
patch
|
blob
|
history
src/server/io.c
patch
|
blob
|
history
src/server/io.h
patch
|
blob
|
history
src/server/run.c
patch
|
blob
|
history
src/server/world.h
patch
|
blob
|
history
diff --git
a/src/server/init.c
b/src/server/init.c
index e9bb3d43836e4590874f0ae125841c7f14fb2a76..dd6ee15408a70a83b37a76b338e76878d475888c 100644
(file)
--- a/
src/server/init.c
+++ b/
src/server/init.c
@@
-127,7
+127,7
@@
extern void remake_world()
world.log = NULL; /* thing_actions.c's update_log() checks for this. */
world.seed_map = world.seed;
free_things(world.things);
world.log = NULL; /* thing_actions.c's update_log() checks for this. */
world.seed_map = world.seed;
free_things(world.things);
- world.
last_update_turn = 0
;
+ world.
do_update = 1
;
remake_map();
struct ThingType * tt;
for (tt = world.thing_types; NULL != tt; tt = tt->next)
remake_map();
struct ThingType * tt;
for (tt = world.thing_types; NULL != tt; tt = tt->next)
diff --git
a/src/server/init.h
b/src/server/init.h
index e56337414bd8f1f96243433b0d73424832f742ba..cadacf3ad27cac50695e3bc159b3b1490ee57d75 100644
(file)
--- a/
src/server/init.h
+++ b/
src/server/init.h
@@
-20,9
+20,8
@@
extern void setup_server_io();
* Unlinks any pre-existing record file.
*
* Thing (action) definitions read in from server config directory are not
* Unlinks any pre-existing record file.
*
* Thing (action) definitions read in from server config directory are not
- * affected. The map is populated accordingly. world.last_update_turn is set to
- * 0 and world.turn to 1, so that io_round()'s criteria for updating the output
- * file are triggered even when this function is called during a round 1.
+ * affected. The map is populated accordingly. world.turn is set to 1, as is
+ * world.do_update, so that io_round() is told to update the worldstate file.
*/
extern void remake_world();
*/
extern void remake_world();
diff --git
a/src/server/io.c
b/src/server/io.c
index c8f5167a24a3a2bf4e5dddc849063e3ed83ca0a5..00afb3cc28fa16d09cd053b38dd5bd4333bf37e0 100644
(file)
--- a/
src/server/io.c
+++ b/
src/server/io.c
@@
-304,10
+304,10
@@
extern char * io_round()
{
return get_message_from_queue();
}
{
return get_message_from_queue();
}
- if (world.
turn != world.last_update_turn
)
+ if (world.
do_update
)
{
update_worldstate_file();
{
update_worldstate_file();
- world.
last_update_turn = world.turn
;
+ world.
do_update = 0
;
}
read_file_into_queue();
if (world.queue_size && '\0' != world.queue[world.queue_size - 1])
}
read_file_into_queue();
if (world.queue_size && '\0' != world.queue[world.queue_size - 1])
diff --git
a/src/server/io.h
b/src/server/io.h
index 82117538c4bd2a87b877b777fba21db58120eedb..2f8397fa2da941b8689b681a109e5593da10355b 100644
(file)
--- a/
src/server/io.h
+++ b/
src/server/io.h
@@
-10,10
+10,9
@@
/* Return single \0-terminated string read from input queue (world.queue); or,
/* Return single \0-terminated string read from input queue (world.queue); or,
- * if queue is empty and world.turn is unequal world.last_update_turn, update
- * world state file (and world.last_update_turn) and write a single dot line to
- * server out file, then read server in file for the next load of bytes to put
- * onto the input queue.
+ * if queue is empty and world.do_update is set, update world state file (and
+ * unset world.do_update) and write a single dot line to server out file, then
+ * read server in file for the next load of bytes to put onto the input queue.
*
* Reading the server in file may put many \0-terminated strings on the queue at
* once. Successive calls of io_round() will make these available one by one.
*
* Reading the server in file may put many \0-terminated strings on the queue at
* once. Successive calls of io_round() will make these available one by one.
diff --git
a/src/server/run.c
b/src/server/run.c
index 3f1b1e39aa9893f716e06557eb4d8d301dc2a9c5..8e1914b72da4b0c75642465463165c3c390c8b4b 100644
(file)
--- a/
src/server/run.c
+++ b/
src/server/run.c
@@
-360,7
+360,7
@@
extern void obey_msg(char * msg, uint8_t do_record)
free(msg_copy);
return;
}
free(msg_copy);
return;
}
- world.
last_update_turn = 0
;
+ world.
do_update = 1
;
free(msg_copy);
if (do_record)
{
free(msg_copy);
if (do_record)
{
diff --git
a/src/server/world.h
b/src/server/world.h
index 35928096d12ea1fb86b3a169f41f3f927f34e3f5..22af12c618a48288ebcaba517cec6ab132ea09e4 100644
(file)
--- a/
src/server/world.h
+++ b/
src/server/world.h
@@
-31,7
+31,7
@@
struct World
uint32_t seed_map; /* Map seed. */
uint16_t replay; /* Turn up to which to replay game. No replay if zero. */
uint16_t turn; /* Current game turn. */
uint32_t seed_map; /* Map seed. */
uint16_t replay; /* Turn up to which to replay game. No replay if zero. */
uint16_t turn; /* Current game turn. */
- uint16_t
last_update_turn; /* Last turn the .path_out file was updated
. */
+ uint16_t
do_update; /* Update worldstate file if !0
. */
uint8_t player_type; /* Thing type that player will start as. */
uint8_t is_verbose; /* Should server send debugging info to stdout? */
};
uint8_t player_type; /* Thing type that player will start as. */
uint8_t is_verbose; /* Should server send debugging info to stdout? */
};