OSDN Git Service

prfファイル内の「%:<file名>」で別ファイルを読み込む時、再帰的に自分を
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 24 Oct 2003 05:56:29 +0000 (05:56 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 24 Oct 2003 05:56:29 +0000 (05:56 +0000)
読み込む設定が書かれているとループが半永久的に続く問題点を修正。
20段以降は読み込まないようにした。

src/files.c

index e104259..9422523 100644 (file)
@@ -417,11 +417,6 @@ errr process_pref_file_command(char *buf)
 
        switch (buf[0])
        {
-       /* Process "%:<fname>" */
-       case '%':
-               /* Attempt to Process the given file */
-               return process_pref_file(buf + 2);
-
        /* Mega-Hack -- read external player's history file */
        /* Process "H:<history>" */
        case 'H':
@@ -1120,6 +1115,14 @@ static errr process_pref_file_aux(cptr name, int preftype)
                /* Process "%:<file>" */
                if (buf[0] == '%')
                {
+                       static int depth_count = 0;
+
+                       /* Ignore if deeper than 20 level */
+                       if (depth_count > 20) continue;
+
+                       /* Count depth level */
+                       depth_count++;
+
                        /* Process that file if allowed */
                        switch (preftype)
                        {
@@ -1134,6 +1137,9 @@ static errr process_pref_file_aux(cptr name, int preftype)
                                break;
                        }
 
+                       /* Set back depth level */
+                       depth_count--;
+
                        /* Continue */
                        continue;
                }