OSDN Git Service

[Refactor] #40535 Separated cmd-travel.c/h from player-move.c/h
authorHourier <hourier@users.sourceforge.jp>
Mon, 13 Jul 2020 12:38:43 +0000 (21:38 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 13 Jul 2020 12:38:43 +0000 (21:38 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-action/cmd-travel.c [new file with mode: 0644]
src/cmd-action/cmd-travel.h [new file with mode: 0644]
src/grid/grid.c
src/io/input-key-processor.c
src/player/player-move.c
src/player/player-move.h
src/room/rooms.c

index dac6c8e..6b50e0e 100644 (file)
     <ClCompile Include="..\..\src\cmd-action\cmd-move.c" />\r
     <ClCompile Include="..\..\src\cmd-action\cmd-open-close.c" />\r
     <ClCompile Include="..\..\src\cmd-action\cmd-shoot.c" />\r
+    <ClCompile Include="..\..\src\cmd-action\cmd-travel.c" />\r
     <ClCompile Include="..\..\src\cmd-action\cmd-tunnel.c" />\r
     <ClCompile Include="..\..\src\action\movement-execution.c" />\r
     <ClCompile Include="..\..\src\cmd-io\cmd-lore.c" />\r
     <ClInclude Include="..\..\src\cmd-action\cmd-move.h" />\r
     <ClInclude Include="..\..\src\cmd-action\cmd-open-close.h" />\r
     <ClInclude Include="..\..\src\cmd-action\cmd-shoot.h" />\r
+    <ClInclude Include="..\..\src\cmd-action\cmd-travel.h" />\r
     <ClInclude Include="..\..\src\cmd-action\cmd-tunnel.h" />\r
     <ClInclude Include="..\..\src\action\movement-execution.h" />\r
     <ClInclude Include="..\..\src\cmd-io\cmd-lore.h" />\r
index 029958f..4600ad6 100644 (file)
     <ClCompile Include="..\..\src\window\main-window-util.c">
       <Filter>window</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\cmd-action\cmd-travel.c">
+      <Filter>cmd-action</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\window\main-window-util.h">
       <Filter>window</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\cmd-action\cmd-travel.h">
+      <Filter>cmd-action</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 6f80033..67feef4 100644 (file)
@@ -73,6 +73,7 @@ hengband_SOURCES = \
        cmd-action/cmd-shoot.c cmd-action/cmd-shoot.h \
        cmd-action/cmd-spell.c cmd-action/cmd-spell.h \
        cmd-action/cmd-throw.c cmd-action/cmd-throw.h \
+       cmd-action/cmd-travel.c cmd-action/cmd-travel.h \
        cmd-action/cmd-tunnel.c cmd-action/cmd-tunnel.h \
        \
        cmd-building/cmd-building.c cmd-building/cmd-building.h \
diff --git a/src/cmd-action/cmd-travel.c b/src/cmd-action/cmd-travel.c
new file mode 100644 (file)
index 0000000..bdadc47
--- /dev/null
@@ -0,0 +1,174 @@
+#include "cmd-action/cmd-travel.h"
+#include "action/travel-execution.h"
+#include "core/asking-player.h"
+#include "floor/floor.h"
+#include "grid/feature.h"
+#include "grid/grid.h"
+#include "io/targeting.h"
+#include "player/player-move.h"
+#include "view/display-messages.h"
+#include "util/bit-flags-calculator.h"
+
+#define TRAVEL_UNABLE 9999
+
+/*!
+ * @brief トラベル処理中に地形に応じた移動コスト基準を返す
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param y 該当地点のY座標
+ * @param x 該当地点のX座標
+ * @return コスト値
+ */
+static int travel_flow_cost(player_type *creature_ptr, POSITION y, POSITION x)
+{
+    int cost = 1;
+    feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[y][x].feat];
+    if (have_flag(f_ptr->flags, FF_AVOID_RUN))
+        cost += 1;
+
+    if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) && !creature_ptr->levitation)
+        cost += 5;
+
+    if (have_flag(f_ptr->flags, FF_LAVA)) {
+        int lava = 2;
+        if (!creature_ptr->resist_fire)
+            lava *= 2;
+
+        if (!creature_ptr->levitation)
+            lava *= 2;
+
+        if (have_flag(f_ptr->flags, FF_DEEP))
+            lava *= 2;
+
+        cost += lava;
+    }
+
+    if (creature_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) {
+        if (have_flag(f_ptr->flags, FF_DOOR))
+            cost += 1;
+
+        if (have_flag(f_ptr->flags, FF_TRAP))
+            cost += 10;
+    }
+
+    return cost;
+}
+
+/*!
+ * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param y 目標地点のY座標
+ * @param x 目標地点のX座標
+ * @param n 現在のコスト
+ * @param wall プレイヤーが壁の中にいるならばTRUE
+ * @return なし
+ */
+static void travel_flow_aux(player_type *creature_ptr, POSITION y, POSITION x, int n, bool wall)
+{
+    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+    grid_type *g_ptr = &floor_ptr->grid_array[y][x];
+    feature_type *f_ptr = &f_info[g_ptr->feat];
+    if (!in_bounds(floor_ptr, y, x))
+        return;
+
+    if (floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN))
+        return;
+
+    int add_cost = 1;
+    int from_wall = (n / TRAVEL_UNABLE);
+    if (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || (have_flag(f_ptr->flags, FF_DOOR) && floor_ptr->grid_array[y][x].mimic)
+        || (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !creature_ptr->levitation)) {
+        if (!wall || !from_wall)
+            return;
+
+        add_cost += TRAVEL_UNABLE;
+    } else
+        add_cost = travel_flow_cost(creature_ptr, y, x);
+
+    int base_cost = (n % TRAVEL_UNABLE);
+    int cost = base_cost + add_cost;
+    if (travel.cost[y][x] <= cost)
+        return;
+
+    travel.cost[y][x] = cost;
+    int old_head = flow_head;
+    temp2_y[flow_head] = y;
+    temp2_x[flow_head] = x;
+    if (++flow_head == MAX_SHORT)
+        flow_head = 0;
+
+    if (flow_head == flow_tail)
+        flow_head = old_head;
+}
+
+/*!
+ * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @param ty 目標地点のY座標
+ * @param tx 目標地点のX座標
+ * @return なし
+ */
+static void travel_flow(player_type *creature_ptr, POSITION ty, POSITION tx)
+{
+    flow_head = flow_tail = 0;
+    bool wall = FALSE;
+    feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
+    if (!have_flag(f_ptr->flags, FF_MOVE))
+        wall = TRUE;
+
+    travel_flow_aux(creature_ptr, ty, tx, 0, wall);
+    POSITION x, y;
+    while (flow_head != flow_tail) {
+        y = temp2_y[flow_tail];
+        x = temp2_x[flow_tail];
+        if (++flow_tail == MAX_SHORT)
+            flow_tail = 0;
+
+        for (DIRECTION d = 0; d < 8; d++)
+            travel_flow_aux(creature_ptr, y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
+    }
+
+    flow_head = flow_tail = 0;
+}
+
+/*!
+ * @brief トラベル処理のメインルーチン
+ * @return なし
+ */
+void do_cmd_travel(player_type *creature_ptr)
+{
+    POSITION x, y;
+    if (travel.x != 0 && travel.y != 0 && get_check(_("トラベルを継続しますか?", "Do you continue to travel?"))) {
+        y = travel.y;
+        x = travel.x;
+    } else if (!tgt_pt(creature_ptr, &x, &y))
+        return;
+
+    if ((x == creature_ptr->x) && (y == creature_ptr->y)) {
+        msg_print(_("すでにそこにいます!", "You are already there!!"));
+        return;
+    }
+
+    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+    feature_type *f_ptr;
+    f_ptr = &f_info[floor_ptr->grid_array[y][x].feat];
+    if ((floor_ptr->grid_array[y][x].info & CAVE_MARK)
+        && (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG)
+            || (have_flag(f_ptr->flags, FF_DOOR) && floor_ptr->grid_array[y][x].mimic))) {
+        msg_print(_("そこには行くことができません!", "You cannot travel there!"));
+        return;
+    }
+
+    forget_travel_flow(creature_ptr->current_floor_ptr);
+    travel_flow(creature_ptr, y, x);
+    travel.x = x;
+    travel.y = y;
+    travel.run = 255;
+    travel.dir = 0;
+    POSITION dx = abs(creature_ptr->x - x);
+    POSITION dy = abs(creature_ptr->y - y);
+    POSITION sx = ((x == creature_ptr->x) || (dx < dy)) ? 0 : ((x > creature_ptr->x) ? 1 : -1);
+    POSITION sy = ((y == creature_ptr->y) || (dy < dx)) ? 0 : ((y > creature_ptr->y) ? 1 : -1);
+    for (int i = 1; i <= 9; i++)
+        if ((sx == ddx[i]) && (sy == ddy[i]))
+            travel.dir = i;
+}
diff --git a/src/cmd-action/cmd-travel.h b/src/cmd-action/cmd-travel.h
new file mode 100644 (file)
index 0000000..bce4b2c
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "system/angband.h"
+
+void do_cmd_travel(player_type *creature_ptr);
index f8c51c2..182fd2d 100644 (file)
@@ -876,8 +876,8 @@ void update_flow(player_type *subject_ptr)
 {
        POSITION x, y;
        DIRECTION d;
-       int flow_head = 1;
-       int flow_tail = 0;
+       int flow_head_grid = 1;
+       int flow_tail_grid = 0;
 
        /* Paranoia -- make sure the array is empty */
        if (tmp_pos.n) return;
@@ -908,21 +908,21 @@ void update_flow(player_type *subject_ptr)
        tmp_pos.x[0] = subject_ptr->x;
 
        /* Now process the queue */
-       while (flow_head != flow_tail)
+       while (flow_head_grid != flow_tail_grid)
        {
                int ty, tx;
 
                /* Extract the next entry */
-               ty = tmp_pos.y[flow_tail];
-               tx = tmp_pos.x[flow_tail];
+               ty = tmp_pos.y[flow_tail_grid];
+               tx = tmp_pos.x[flow_tail_grid];
 
                /* Forget that entry */
-               if (++flow_tail == TEMP_MAX) flow_tail = 0;
+               if (++flow_tail_grid == TEMP_MAX) flow_tail_grid = 0;
 
                /* Add the "children" */
                for (d = 0; d < 8; d++)
                {
-                       int old_head = flow_head;
+                       int old_head = flow_head_grid;
                        byte m = subject_ptr->current_floor_ptr->grid_array[ty][tx].cost + 1;
                        byte n = subject_ptr->current_floor_ptr->grid_array[ty][tx].dist + 1;
                        grid_type *g_ptr;
@@ -952,14 +952,14 @@ void update_flow(player_type *subject_ptr)
                        if (n == MONSTER_FLOW_DEPTH) continue;
 
                        /* Enqueue that entry */
-                       tmp_pos.y[flow_head] = y;
-                       tmp_pos.x[flow_head] = x;
+                       tmp_pos.y[flow_head_grid] = y;
+                       tmp_pos.x[flow_head_grid] = x;
 
                        /* Advance the queue */
-                       if (++flow_head == TEMP_MAX) flow_head = 0;
+                       if (++flow_head_grid == TEMP_MAX) flow_head_grid = 0;
 
                        /* Hack -- notice overflow by forgetting new entry */
-                       if (flow_head == flow_tail) flow_head = old_head;
+                       if (flow_head_grid == flow_tail_grid) flow_head_grid = old_head;
                }
        }
 }
index ce3e27d..2fa7493 100644 (file)
@@ -15,6 +15,7 @@
 #include "cmd-action/cmd-pet.h"
 #include "cmd-action/cmd-shoot.h"
 #include "cmd-action/cmd-spell.h"
+#include "cmd-action/cmd-travel.h"
 #include "cmd-action/cmd-tunnel.h"
 #include "cmd-building/cmd-building.h"
 #include "cmd-io/cmd-autopick.h"
@@ -69,7 +70,6 @@
 #include "mspell/mspells3.h" // do_cmd_cast_learned() がある。後で移設する.
 #include "player/attack-defense-types.h"
 #include "player/player-class.h"
-#include "player/player-move.h" // do_cmd_travel() がある。後で移設する.
 #include "player/special-defense-types.h"
 #include "spell/spells-object.h"
 #include "status/action-setter.h"
index 147e8c5..10ea9a3 100644 (file)
 #include "view/display-messages.h"
 #include "world/world.h"
 
+int flow_head = 0;
+int flow_tail = 0;
+POSITION temp2_x[MAX_SHORT];
+POSITION temp2_y[MAX_SHORT];
+
 /*!
  * @brief 地形やその上のアイテムの隠された要素を全て明かす /
  * Search for hidden things
@@ -437,13 +442,6 @@ bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat)
     return FALSE;
 }
 
-#define TRAVEL_UNABLE 9999
-
-static int flow_head = 0;
-static int flow_tail = 0;
-static POSITION temp2_x[MAX_SHORT];
-static POSITION temp2_y[MAX_SHORT];
-
 /*!
  * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information
  * @param creature_ptr プレーヤーへの参照ポインタ
@@ -457,165 +455,3 @@ void forget_travel_flow(floor_type *floor_ptr)
 
     travel.y = travel.x = 0;
 }
-
-/*!
- * @brief トラベル処理中に地形に応じた移動コスト基準を返す
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param y 該当地点のY座標
- * @param x 該当地点のX座標
- * @return コスト値
- */
-static int travel_flow_cost(player_type *creature_ptr, POSITION y, POSITION x)
-{
-    int cost = 1;
-    feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[y][x].feat];
-    if (have_flag(f_ptr->flags, FF_AVOID_RUN))
-        cost += 1;
-
-    if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) && !creature_ptr->levitation)
-        cost += 5;
-
-    if (have_flag(f_ptr->flags, FF_LAVA)) {
-        int lava = 2;
-        if (!creature_ptr->resist_fire)
-            lava *= 2;
-
-        if (!creature_ptr->levitation)
-            lava *= 2;
-
-        if (have_flag(f_ptr->flags, FF_DEEP))
-            lava *= 2;
-
-        cost += lava;
-    }
-
-    if (creature_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) {
-        if (have_flag(f_ptr->flags, FF_DOOR))
-            cost += 1;
-
-        if (have_flag(f_ptr->flags, FF_TRAP))
-            cost += 10;
-    }
-
-    return cost;
-}
-
-/*!
- * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param y 目標地点のY座標
- * @param x 目標地点のX座標
- * @param n 現在のコスト
- * @param wall プレイヤーが壁の中にいるならばTRUE
- * @return なし
- */
-static void travel_flow_aux(player_type *creature_ptr, POSITION y, POSITION x, int n, bool wall)
-{
-    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
-    grid_type *g_ptr = &floor_ptr->grid_array[y][x];
-    feature_type *f_ptr = &f_info[g_ptr->feat];
-    if (!in_bounds(floor_ptr, y, x))
-        return;
-
-    if (floor_ptr->dun_level > 0 && !(g_ptr->info & CAVE_KNOWN))
-        return;
-
-    int add_cost = 1;
-    int from_wall = (n / TRAVEL_UNABLE);
-    if (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG) || (have_flag(f_ptr->flags, FF_DOOR) && floor_ptr->grid_array[y][x].mimic)
-        || (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !creature_ptr->levitation)) {
-        if (!wall || !from_wall)
-            return;
-
-        add_cost += TRAVEL_UNABLE;
-    } else
-        add_cost = travel_flow_cost(creature_ptr, y, x);
-
-    int base_cost = (n % TRAVEL_UNABLE);
-    int cost = base_cost + add_cost;
-    if (travel.cost[y][x] <= cost)
-        return;
-
-    travel.cost[y][x] = cost;
-    int old_head = flow_head;
-    temp2_y[flow_head] = y;
-    temp2_x[flow_head] = x;
-    if (++flow_head == MAX_SHORT)
-        flow_head = 0;
-
-    if (flow_head == flow_tail)
-        flow_head = old_head;
-}
-
-/*!
- * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @param ty 目標地点のY座標
- * @param tx 目標地点のX座標
- * @return なし
- */
-static void travel_flow(player_type *creature_ptr, POSITION ty, POSITION tx)
-{
-    flow_head = flow_tail = 0;
-    bool wall = FALSE;
-    feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat];
-    if (!have_flag(f_ptr->flags, FF_MOVE))
-        wall = TRUE;
-
-    travel_flow_aux(creature_ptr, ty, tx, 0, wall);
-    POSITION x, y;
-    while (flow_head != flow_tail) {
-        y = temp2_y[flow_tail];
-        x = temp2_x[flow_tail];
-        if (++flow_tail == MAX_SHORT)
-            flow_tail = 0;
-
-        for (DIRECTION d = 0; d < 8; d++)
-            travel_flow_aux(creature_ptr, y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
-    }
-
-    flow_head = flow_tail = 0;
-}
-
-/*!
- * @brief トラベル処理のメインルーチン
- * @return なし
- */
-void do_cmd_travel(player_type *creature_ptr)
-{
-    POSITION x, y;
-    if (travel.x != 0 && travel.y != 0 && get_check(_("トラベルを継続しますか?", "Do you continue to travel?"))) {
-        y = travel.y;
-        x = travel.x;
-    } else if (!tgt_pt(creature_ptr, &x, &y))
-        return;
-
-    if ((x == creature_ptr->x) && (y == creature_ptr->y)) {
-        msg_print(_("すでにそこにいます!", "You are already there!!"));
-        return;
-    }
-
-    floor_type *floor_ptr = creature_ptr->current_floor_ptr;
-    feature_type *f_ptr;
-    f_ptr = &f_info[floor_ptr->grid_array[y][x].feat];
-    if ((floor_ptr->grid_array[y][x].info & CAVE_MARK)
-        && (have_flag(f_ptr->flags, FF_WALL) || have_flag(f_ptr->flags, FF_CAN_DIG)
-            || (have_flag(f_ptr->flags, FF_DOOR) && floor_ptr->grid_array[y][x].mimic))) {
-        msg_print(_("そこには行くことができません!", "You cannot travel there!"));
-        return;
-    }
-
-    forget_travel_flow(creature_ptr->current_floor_ptr);
-    travel_flow(creature_ptr, y, x);
-    travel.x = x;
-    travel.y = y;
-    travel.run = 255;
-    travel.dir = 0;
-    POSITION dx = abs(creature_ptr->x - x);
-    POSITION dy = abs(creature_ptr->y - y);
-    POSITION sx = ((x == creature_ptr->x) || (dx < dy)) ? 0 : ((x > creature_ptr->x) ? 1 : -1);
-    POSITION sy = ((y == creature_ptr->y) || (dy < dx)) ? 0 : ((y > creature_ptr->y) ? 1 : -1);
-    for (int i = 1; i <= 9; i++)
-        if ((sx == ddx[i]) && (sy == ddy[i]))
-            travel.dir = i;
-}
index 65a55a9..67cd4ab 100644 (file)
 #define PATTERN_TILE_TELEPORT 7
 #define PATTERN_TILE_WRECKED  8
 
+extern int flow_head;
+extern int flow_tail;
+extern POSITION temp2_x[MAX_SHORT];
+extern POSITION temp2_y[MAX_SHORT];
+
 bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mpe_mode);
 bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x);
 bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat);
 void search(player_type *creature_ptr);
-void do_cmd_travel(player_type *creature_ptr);
 
 typedef struct floor_type floor_type;
 void forget_travel_flow(floor_type *floor_ptr);
index 3160588..9424427 100644 (file)
@@ -850,8 +850,8 @@ static void cave_fill(player_type *player_ptr, POSITION y, POSITION x)
        int i, j, d;
        POSITION ty, tx;
 
-       int flow_tail = 1;
-       int flow_head = 0;
+       int flow_tail_room = 1;
+       int flow_head_room = 0;
 
 
        /*** Start Grid ***/
@@ -862,19 +862,19 @@ static void cave_fill(player_type *player_ptr, POSITION y, POSITION x)
 
        /* Now process the queue */
        floor_type *floor_ptr = player_ptr->current_floor_ptr;
-       while (flow_head != flow_tail)
+       while (flow_head_room != flow_tail_room)
        {
                /* Extract the next entry */
-               ty = tmp_pos.y[flow_head];
-               tx = tmp_pos.x[flow_head];
+               ty = tmp_pos.y[flow_head_room];
+               tx = tmp_pos.x[flow_head_room];
 
                /* Forget that entry */
-               if (++flow_head == TEMP_MAX) flow_head = 0;
+               if (++flow_head_room == TEMP_MAX) flow_head_room = 0;
 
                /* Add the "children" */
                for (d = 0; d < 8; d++)
                {
-                       int old_head = flow_tail;
+                       int old_head = flow_tail_room;
 
                        /* Child location */
                        j = ty + ddy_ddd[d];
@@ -899,16 +899,16 @@ static void cave_fill(player_type *player_ptr, POSITION y, POSITION x)
                                        fill_data.info1, fill_data.info2, fill_data.info3))
                                {
                                        /* Enqueue that entry */
-                                       tmp_pos.y[flow_tail] = (byte)j;
-                                       tmp_pos.x[flow_tail] = (byte)i;
+                                       tmp_pos.y[flow_tail_room] = (byte)j;
+                                       tmp_pos.x[flow_tail_room] = (byte)i;
 
                                        /* Advance the queue */
-                                       if (++flow_tail == TEMP_MAX) flow_tail = 0;
+                                       if (++flow_tail_room == TEMP_MAX) flow_tail_room = 0;
 
                                        /* Hack -- Overflow by forgetting new entry */
-                                       if (flow_tail == flow_head)
+                                       if (flow_tail_room == flow_head_room)
                                        {
-                                               flow_tail = old_head;
+                                               flow_tail_room = old_head;
                                        }
                                        else
                                        {