OSDN Git Service

[Refactor] 無駄な空白、改行の削除、includeのソート
[hengbandforosx/hengbandosx.git] / src / term / z-term.c
index 59fe375..5942862 100644 (file)
@@ -8,8 +8,10 @@
  */
 
 #include "term/z-term.h"
+#include "game-option/map-screen-options.h"
 #include "game-option/runtime-arguments.h"
 #include "game-option/special-options.h"
+#include "term/gameterm.h"
 #include "term/term-color-types.h"
 #include "term/z-virt.h"
 
@@ -274,7 +276,6 @@ void term_queue_char(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta
  */
 void term_queue_bigchar(TERM_LEN x, TERM_LEN y, TERM_COLOR a, char c, TERM_COLOR ta, char tc)
 {
-
 #ifdef JP
     /*
      * A table which relates each ascii character to a multibyte
@@ -511,7 +512,6 @@ static void term_queue_chars(TERM_LEN x, TERM_LEN y, int n, TERM_COLOR a, concpt
      * (条件追加:タイルの1文字目でない事を確かめるように。)
      */
     {
-
         int w, h;
         term_get_size(&w, &h);
         if (x != w && !(scr_aa[x] & AF_TILE1) && (scr_aa[x] & AF_KANJI2)) {
@@ -1021,6 +1021,13 @@ static void term_fresh_row_text(TERM_LEN y, TERM_LEN x1, TERM_LEN x2)
     }
 }
 
+bool macro_running(void)
+{
+    int diff = angband_term[0]->key_head - angband_term[0]->key_tail;
+    return diff < -1 || 1 < diff;
+}
+
+bool need_term_fresh(void) { return !macro_running() || fresh_after; }
 /*
  * @brief Actually perform all requested changes to the window
  */
@@ -1667,7 +1674,7 @@ errr term_redraw(void)
 /*
  * Redraw part of a window.
  */
-static errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2)
+errr term_redraw_section(TERM_LEN x1, TERM_LEN y1, TERM_LEN x2, TERM_LEN y2)
 {
     char *g_ptr;
 
@@ -1841,10 +1848,6 @@ errr term_inkey(char *ch, bool wait, bool take)
     /* Assume no key */
     (*ch) = '\0';
 
-#ifdef CHUUKEI
-    flush_ringbuf();
-#endif
-
     /* get bored */
     if (!Term->never_bored) {
         /* Process random events */
@@ -1947,7 +1950,7 @@ errr term_load(void)
 /*
  * Exchange the "requested" screen with the "tmp" screen
  */
-static errr term_exchange(void)
+errr term_exchange(void)
 {
     TERM_LEN w = Term->wid;
     TERM_LEN h = Term->hgt;
@@ -2267,3 +2270,69 @@ errr term_init(term_type *t, TERM_LEN w, TERM_LEN h, int k)
     t->pict_hook = term_pict_hack;
     return 0;
 }
+
+#ifdef JP
+/*
+ * Move to a location and, using an attr, add a string vertically
+ */
+errr term_putstr_v(TERM_LEN x, TERM_LEN y, int n, byte a, concptr s)
+{
+    errr res;
+    int y0 = y;
+
+    for (int i = 0; i < n && s[i] != 0; i++) {
+        /* Move first */
+        if ((res = term_gotoxy(x, y0)) != 0)
+            return (res);
+
+        if (iskanji(s[i])) {
+            if ((res = term_addstr(2, a, &s[i])) != 0)
+                return (res);
+            i++;
+            y0++;
+            if (s[i] == 0)
+                break;
+        } else {
+            if ((res = term_addstr(1, a, &s[i])) != 0)
+                return (res);
+            y0++;
+        }
+    }
+
+    return 0;
+}
+#endif
+
+#ifndef WINDOWS
+errr term_nuke(term_type *t)
+{
+    TERM_LEN w = t->wid;
+    TERM_LEN h = t->hgt;
+    if (t->active_flag) {
+        if (t->nuke_hook)
+            (*t->nuke_hook)(t);
+
+        t->active_flag = FALSE;
+        t->mapped_flag = FALSE;
+    }
+
+    term_win_nuke(t->old, w, h);
+    KILL(t->old, term_win);
+    term_win_nuke(t->scr, w, h);
+    KILL(t->scr, term_win);
+    if (t->mem) {
+        term_win_nuke(t->mem, w, h);
+        KILL(t->mem, term_win);
+    }
+
+    if (t->tmp) {
+        term_win_nuke(t->tmp, w, h);
+        KILL(t->tmp, term_win);
+    }
+
+    C_KILL(t->x1, h, TERM_LEN);
+    C_KILL(t->x2, h, TERM_LEN);
+    C_KILL(t->key_queue, t->key_size, char);
+    return 0;
+}
+#endif
\ No newline at end of file