OSDN Git Service

When using travel command, we can only pass already known grids
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 15 Feb 2013 16:36:08 +0000 (16:36 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 15 Feb 2013 16:36:08 +0000 (16:36 +0000)
Known grids are those directly viewed by player or detected by mapping area magic

src/cave.c
src/cmd2.c
src/defines.h
src/externs.h
src/spells2.c

index 36eef79..2fde3a5 100644 (file)
@@ -3357,7 +3357,7 @@ void forget_view(void)
 #define cave_view_hack(C,Y,X) \
 {\
     if (!((C)->info & (CAVE_VIEW))){\
-    (C)->info |= (CAVE_VIEW); \
+    (C)->info |= (CAVE_VIEW | CAVE_KNOWN); \
     view_y[view_n] = (Y); \
     view_x[view_n] = (X); \
     view_n++;}\
@@ -4304,6 +4304,9 @@ void map_area(int range)
 
                        c_ptr = &cave[y][x];
 
+                       /* Memorize terrain of the grid */
+                       c_ptr->info |= (CAVE_KNOWN);
+
                        /* Feature code (applying "mimic" field) */
                        feat = get_feat_mimic(c_ptr);
                        f_ptr = &f_info[feat];
@@ -4392,6 +4395,9 @@ void wiz_lite(bool ninja)
                {
                        cave_type *c_ptr = &cave[y][x];
 
+                       /* Memorize terrain of the grid */
+                       c_ptr->info |= (CAVE_KNOWN);
+
                        /* Feature code (applying "mimic" field) */
                        feat = get_feat_mimic(c_ptr);
                        f_ptr = &f_info[feat];
@@ -4471,7 +4477,7 @@ void wiz_dark(void)
                        cave_type *c_ptr = &cave[y][x];
 
                        /* Process the grid */
-                       c_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT);
+                       c_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
                        c_ptr->info |= (CAVE_UNSAFE);
                }
        }
@@ -4505,6 +4511,9 @@ void wiz_dark(void)
                o_ptr->marked &= OM_TOUCHED;
        }
 
+       /* Forget travel route when we have forgotten map */
+       forget_travel_flow();
+
        /* Mega-Hack -- Forget the view and lite */
        p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
 
index 4eaa365..19763f5 100644 (file)
@@ -4805,6 +4805,9 @@ static bool travel_flow_aux(int y, int x, int n, bool wall)
        /* Ignore "pre-stamped" entries */
        if (travel.cost[y][x] != TRAVEL_UNABLE) return wall;
 
+       /* Ignore unknown grid */
+       if (!(c_ptr->info & CAVE_KNOWN)) return wall;
+
        /* Ignore "walls" and "rubble" (include "secret doors") */
        if (have_flag(f_ptr->flags, FF_WALL) ||
                have_flag(f_ptr->flags, FF_CAN_DIG) ||
index 9362baf..336f359 100644 (file)
 #define CAVE_MASK (CAVE_FLOOR | CAVE_EXTRA | CAVE_INNER | CAVE_OUTER | CAVE_SOLID | CAVE_VAULT)
 
 /* Used only after cave generation */
-#define CAVE_XXXX1      0x0200
+#define CAVE_KNOWN      0x0200    /* Directly viewed or map detected flag */
 #define CAVE_NOTE       0x0400    /* Flag for delayed visual update (needs note_spot()) */
 #define CAVE_REDRAW     0x0800    /* Flag for delayed visual update (needs lite_spot()) */
 #define CAVE_OBJECT     0x1000    /* Mirror, glyph, etc. */
index 72e225f..2966aec 100644 (file)
@@ -716,6 +716,7 @@ extern void travel_step(void);
 #endif
 
 /* cmd2.c */
+extern void forget_travel_flow(void);
 extern bool confirm_leave_level(bool down_stair);
 extern void do_cmd_go_up(void);
 extern void do_cmd_go_down(void);
index ae68634..967cfd2 100644 (file)
@@ -5107,7 +5107,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                        c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                        /* Lose light and knowledge */
-                       c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW);
+                       c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
 
                        if (!in_generate) /* Normal */
                        {
@@ -5419,7 +5419,7 @@ bool earthquake_aux(int cy, int cx, int r, int m_idx)
                        c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
 
                        /* Lose light and knowledge */
-                       c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
+                       c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
 
                        /* Skip the epicenter */
                        if (!dx && !dy) continue;