From 1dc64ee46c2dcbd7eb8a6c4fcd27620dab7d7680 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 8 Mar 2015 17:14:53 +0100
Subject: [PATCH] Server/C: Don't update map memory on WORLD_ACTIVE command.

---
 src/server/field_of_view.c | 5 +++--
 src/server/field_of_view.h | 2 +-
 src/server/god_commands.c  | 4 ++--
 src/server/init.c          | 2 +-
 src/server/run.c           | 2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/server/field_of_view.c b/src/server/field_of_view.c
index dc60442..45c90e6 100644
--- a/src/server/field_of_view.c
+++ b/src/server/field_of_view.c
@@ -308,7 +308,7 @@ static void add_things_to_map_memory(struct Thing * t_eye)
 
 
 
-extern void update_map_memory(struct Thing * t_eye)
+extern void update_map_memory(struct Thing * t_eye, uint8_t age_map)
 {
     if (!t_eye->mem_map)
     {
@@ -330,7 +330,8 @@ extern void update_map_memory(struct Thing * t_eye)
             }
             continue;
         }
-        if (   '0' <= t_eye->mem_depth_map[i] && '9' > t_eye->mem_depth_map[i]
+        if (age_map &&
+            '0' <= t_eye->mem_depth_map[i] && '9' > t_eye->mem_depth_map[i]
             && !(rrand() % (uint16_t) pow(2, t_eye->mem_depth_map[i] - 48)))
         {
             t_eye->mem_depth_map[i]++;
diff --git a/src/server/field_of_view.h b/src/server/field_of_view.h
index 54ffe28..be6324b 100644
--- a/src/server/field_of_view.h
+++ b/src/server/field_of_view.h
@@ -18,7 +18,7 @@ struct Thing;
 /* Update "t_eye"'s .mem_map memory with what's in its current FOV, and update
  * and age the .mem_depth_map.
  */
-extern void update_map_memory(struct Thing * t_eye);
+extern void update_map_memory(struct Thing * t_eye, uint8_t age_map);
 
 /* Build "t"'s field of view. */
 extern void build_fov_map(struct Thing * t);
diff --git a/src/server/god_commands.c b/src/server/god_commands.c
index d91cea3..0dbf1a3 100644
--- a/src/server/god_commands.c
+++ b/src/server/god_commands.c
@@ -257,7 +257,7 @@ static uint8_t parse_position(char* tok0, char * tok1, struct Thing * t)
                 build_fov_map(t);
                 if (t == get_player())
                 {
-                    update_map_memory(t);
+                    update_map_memory(t, 1);
                 }
             }
         }
@@ -386,7 +386,7 @@ static uint8_t parse_world_active(char * tok0, char * tok1)
                         build_fov_map(ti);
                         if (ti == get_player())
                         {
-                            update_map_memory(ti);
+                            update_map_memory(ti, 0);
                         }
                     }
                 }
diff --git a/src/server/init.c b/src/server/init.c
index 43a4d68..f5c81d3 100644
--- a/src/server/init.c
+++ b/src/server/init.c
@@ -209,7 +209,7 @@ extern uint8_t remake_world()
             break;
         }
     }
-    update_map_memory(get_player());
+    update_map_memory(get_player(), 1);
     for (tt = world.thing_types; tt; tt = tt->next)
     {
         if (world.player_type != tt->id)
diff --git a/src/server/run.c b/src/server/run.c
index 4351b9f..ad04f71 100644
--- a/src/server/run.c
+++ b/src/server/run.c
@@ -327,7 +327,7 @@ static void turn_over()
             {
                 if (0 == thing->command)
                 {
-                    update_map_memory(thing);
+                    update_map_memory(thing, 1);
                     if (thing == player)
                     {
                         break;
-- 
2.30.2