Changeset 120

Show
Ignore:
Timestamp:
05/07/07 12:00:03 (1 year ago)
Author:
ajps
Message:

Random name generator now available for character names - this required some changes to askfor_aux also. (Closes #36).

request_command() no longer used for stores, so remove the "shopping" paramater, change the way responding to resizes works -- takkaria

A few bits of tidying up and reformatting.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/birth.c

    r111 r120  
    12191219 
    12201220                                /* Get a response (or escape) */ 
    1221                                 if (!askfor_aux(inp, 9)) inp[0] = '\0'; 
     1221                                if (!askfor_aux(inp, 9, NULL)) inp[0] = '\0'; 
    12221222 
    12231223                                /* Hack -- add a fake slash */ 
     
    14971497                prt(" a) Use the point-based system", 2, 1); 
    14981498                prt(" b) Use the autoroller", 3, 1); 
    1499                 prt(" c) Use the basic roller", 4, 1); 
     1499                prt(" c/*) Use the basic roller", 4, 1); 
    15001500 
    15011501                prt("", 6, 1); 
     
    15161516                        case 'c': 
    15171517                        case 'C': 
     1518                        case '*': 
    15181519                                done = TRUE; 
    15191520                                break; 
  • trunk/src/cmd4.c

    r116 r120  
    662662 
    663663                                        /* Get a filename */ 
    664                                         if (!askfor_aux(note_text, sizeof note_text)) continue; 
     664                                        if (!askfor_aux(note_text, sizeof note_text, NULL)) continue; 
    665665 
    666666                                                /* Set the inscription */ 
     
    16131613        flush(); 
    16141614         
    1615     if(0 != character_dungeon) 
     1615       if (0 != character_dungeon) 
    16161616                verify_panel(); 
    16171617 
     
    16491649 
    16501650        /* Place the cursor on the player */ 
    1651         if(0 != character_dungeon) 
     1651        if (0 != character_dungeon) 
    16521652                move_cursor_relative(p_ptr->px, p_ptr->py); 
    16531653 
     
    16711671                Term_activate(old); 
    16721672        } 
    1673 } 
    1674  
    1675 void do_cmd_resize() 
    1676 { 
    1677         /* Escape to main screen on resize */ 
    1678         Term_key_push(ESCAPE); 
    1679         do_cmd_redraw(); 
    16801673} 
    16811674 
     
    19051898 
    19061899                        /* Get a "shower" string, or continue */ 
    1907                         if (!askfor_aux(shower, sizeof shower)) continue; 
     1900                        if (!askfor_aux(shower, sizeof shower, NULL)) continue; 
    19081901 
    19091902                        /* Okay */ 
     
    19201913 
    19211914                        /* Get a "finder" string, or continue */ 
    1922                         if (!askfor_aux(finder, sizeof finder)) continue; 
     1915                        if (!askfor_aux(finder, sizeof finder, NULL)) continue; 
    19231916 
    19241917                        /* Show it */ 
     
    20522045 
    20532046        /* Ask for a file (or cancel) */ 
    2054         if (!askfor_aux(ftmp, sizeof ftmp)) return; 
     2047        if (!askfor_aux(ftmp, sizeof ftmp, NULL)) return; 
    20552048 
    20562049        /* Process the given filename */ 
     
    25142507 
    25152508        /* Get a filename */ 
    2516         if (!askfor_aux(ftmp, sizeof ftmp)) return; 
     2509        if (!askfor_aux(ftmp, sizeof ftmp, NULL)) return; 
    25172510 
    25182511        /* Build the filename */ 
     
    30022995 
    30032996                        /* Get an encoded action */ 
    3004                         if (askfor_aux(tmp, sizeof tmp)) 
     2997                        if (askfor_aux(tmp, sizeof tmp, NULL)) 
    30052998                        { 
    30062999                                /* Convert to ascii */ 
     
    31003093 
    31013094                        /* Get an encoded action */ 
    3102                         if (askfor_aux(tmp, sizeof tmp)) 
     3095                        if (askfor_aux(tmp, sizeof tmp, NULL)) 
    31033096                        { 
    31043097                                /* Convert to ascii */ 
     
    31493142 
    31503143                        /* Get an encoded action */ 
    3151                         if (askfor_aux(tmp, sizeof tmp)) 
     3144                        if (askfor_aux(tmp, sizeof tmp, NULL)) 
    31523145                        { 
    31533146                                /* Extract an action */ 
  • trunk/src/dungeon.c

    r119 r120  
    13881388        } 
    13891389 
    1390         /* Within these boundaries, the cast to unsigned char will have the desired effect */ 
    1391         assert(p_ptr->command_cmd >= CHAR_MIN && p_ptr->command_cmd <= CHAR_MAX); 
    1392  
    1393         /* Execute the command */ 
    1394         if (converted_list[(unsigned char) p_ptr->command_cmd]) 
    1395                 converted_list[(unsigned char) p_ptr->command_cmd](); 
     1390        /* Handle resize events XXX */ 
     1391        if (p_ptr->command_cmd_ex.type == EVT_RESIZE) 
     1392        { 
     1393                do_cmd_redraw(); 
     1394        } 
     1395        else 
     1396        { 
     1397                /* Within these boundaries, the cast to unsigned char will have the desired effect */ 
     1398                assert(p_ptr->command_cmd >= CHAR_MIN && p_ptr->command_cmd <= CHAR_MAX); 
     1399 
     1400                /* Execute the command */ 
     1401                if (converted_list[(unsigned char) p_ptr->command_cmd]) 
     1402                        converted_list[(unsigned char) p_ptr->command_cmd](); 
     1403        } 
    13961404} 
    13971405 
     
    17001708                        move_cursor_relative(p_ptr->py, p_ptr->px); 
    17011709 
    1702                         /* Get a command (normal) */ 
    1703                         request_command(FALSE); 
    1704  
    1705                         /* Process the command */ 
     1710                        /* Get and process a command */ 
     1711                        request_command(); 
    17061712                        process_command(); 
    17071713                } 
     
    22462252        (void)Term_set_cursor(FALSE); 
    22472253 
    2248         /* Set screen resize hook */ 
    2249         Term_set_resize_hook(do_cmd_resize); 
    2250  
    22512254        /* Attempt to load */ 
    22522255        if (!load_player()) 
  • trunk/src/externs.h

    r119 r120  
    727727extern void text_out_c(byte a, cptr str); 
    728728extern void clear_from(int row); 
    729 extern bool askfor_aux(char *buf, size_t len); 
     729extern bool askfor_aux(char *buf, size_t len, bool keypress_h(char *, size_t, size_t *, size_t *, char, bool)); 
    730730extern bool get_string(cptr prompt, char *buf, size_t len); 
    731731extern s16b get_quantity(cptr prompt, int max); 
     
    735735extern bool get_com_ex(cptr prompt, event_type *command); 
    736736extern void pause_line(int row); 
    737 extern void request_command(bool shopping); 
     737extern void request_command(void); 
    738738extern int damroll(int num, int sides); 
    739739extern int maxroll(int num, int sides); 
  • trunk/src/files.c

    r116 r120  
    24042404                        /* Get "shower" */ 
    24052405                        prt("Show: ", hgt - 1, 0); 
    2406                         (void)askfor_aux(shower, sizeof(shower)); 
     2406                        (void)askfor_aux(shower, sizeof(shower), NULL); 
    24072407 
    24082408                        /* Make the "shower" lowercase */ 
     
    24152415                        /* Get "finder" */ 
    24162416                        prt("Find: ", hgt - 1, 0); 
    2417                         if (askfor_aux(finder, sizeof(finder))) 
     2417                        if (askfor_aux(finder, sizeof(finder), NULL)) 
    24182418                        { 
    24192419                                /* Find it */ 
     
    24362436                        prt("Goto Line: ", hgt - 1, 0); 
    24372437                        strcpy(tmp, "0"); 
    2438                         if (askfor_aux(tmp, sizeof(tmp))) 
     2438                        if (askfor_aux(tmp, sizeof(tmp), NULL)) 
    24392439                        { 
    24402440                                line = atoi(tmp); 
     
    24482448                        prt("Goto File: ", hgt - 1, 0); 
    24492449                        strcpy(ftmp, "help.hlp"); 
    2450                         if (askfor_aux(ftmp, sizeof(ftmp))) 
     2450                        if (askfor_aux(ftmp, sizeof(ftmp), NULL)) 
    24512451                        { 
    24522452                                if (!show_file(ftmp, NULL, 0, mode)) ch = ESCAPE; 
     
    26122612        } 
    26132613} 
    2614  
    2615  
    2616 /* 
    2617  * Gets a name for the character, reacting to name changes. 
    2618  * 
    2619  * Perhaps we should NOT ask for a name (at "birth()") on 
    2620  * Unix machines?  XXX XXX XXX 
    2621  * 
    2622  * What a horrible name for a global function.  XXX XXX XXX 
    2623  */ 
    2624 void get_name(void) 
    2625 { 
    2626         char tmp[32]; 
    2627  
    2628         /* Save the player name */ 
    2629         my_strcpy(tmp, op_ptr->full_name, sizeof(tmp)); 
    2630  
    2631         /* Prompt for a new name */ 
    2632         if (get_string("Enter a name for your character: ", tmp, sizeof(tmp))) 
    2633         { 
    2634                 /* Use the name */ 
    2635                 my_strcpy(op_ptr->full_name, tmp, sizeof(op_ptr->full_name)); 
    2636  
    2637                 /* Process the player name */ 
    2638                 process_player_name(FALSE); 
    2639         } 
    2640 } 
    2641  
    26422614 
    26432615 
  • trunk/src/object1.c

    r119 r120  
    650650        char b1 = '[', b2 = ']'; 
    651651        char c1 = '{', c2 = '}'; 
    652  
    653         char discount_buf[80]; 
    654652 
    655653        char tmp_buf[128]; 
  • trunk/src/squelch.c

    r98 r120  
    614614 
    615615        /* Get a filename */ 
    616         if (askfor_aux(fname, sizeof fname)) 
     616        if (askfor_aux(fname, sizeof fname, NULL)) 
    617617        { 
    618618                /* Build the filename */ 
     
    688688 
    689689        /* Get a filename */ 
    690         if (askfor_aux(fname, sizeof fname)) 
     690        if (askfor_aux(fname, sizeof fname, NULL)) 
    691691        { 
    692692                /* Build the filename */ 
     
    743743 
    744744        /* Ask for a file (or cancel) */ 
    745         if (askfor_aux(fname, sizeof fname)) 
     745        if (askfor_aux(fname, sizeof fname, NULL)) 
    746746        { 
    747747                /* Process the given filename, note success or failure */ 
  • trunk/src/store.c

    r117 r120  
    25002500/* 
    25012501 * Enter a store, and interact with it. 
    2502  * 
    2503  * Note that we use the standard "request_command()" function 
    2504  * to get a command, allowing us to use "p_ptr->command_arg" and all 
    2505  * command macros and other nifty stuff, but we use the special 
    2506  * "shopping" argument, to force certain commands to be converted 
    2507  * into other commands, normally, we convert "p" (pray) and "m" 
    2508  * (cast magic) into "g" (get), and "s" (search) into "d" (drop). 
    25092502 */ 
    25102503void do_cmd_store(void) 
  • trunk/src/ui.h

    r95 r120  
    130130struct panel_type { 
    131131        event_target target; 
    132         void (*refresh)(); 
     132        void (*refresh)(void); 
    133133        region boundary; 
    134134}; 
  • trunk/src/util.c

    r112 r120  
    1010 
    1111#include "angband.h" 
    12  
     12#include "randname.h" 
    1313 
    1414 
     
    26582658} 
    26592659 
    2660  
    2661  
     2660/* 
     2661 * The default "keypress handling function" for askfor_aux, this takes the 
     2662 * given keypress, input buffer, length, etc, and does the appropriate action 
     2663 * for each keypress, such as moving the cursor left or inserting a character. 
     2664 * 
     2665 * It should return TRUE when editing of the buffer is "complete" (e.g. on 
     2666 * the press of RETURN). 
     2667 */ 
     2668bool askfor_aux_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, char keypress, bool firsttime) 
     2669
     2670        switch (keypress) 
     2671        { 
     2672                case ESCAPE: 
     2673                { 
     2674                        *curs = 0; 
     2675                        return TRUE; 
     2676                        break; 
     2677                } 
     2678                 
     2679                case '\n': 
     2680                case '\r': 
     2681                { 
     2682                        *curs = *len; 
     2683                        return TRUE; 
     2684                        break; 
     2685                } 
     2686                 
     2687                case ARROW_LEFT: 
     2688                { 
     2689                        if (firsttime) *curs = 0; 
     2690                        if (*curs > 0) (*curs)--; 
     2691                        break; 
     2692                } 
     2693                 
     2694                case ARROW_RIGHT: 
     2695                { 
     2696                        if (firsttime) *curs = *len - 1; 
     2697                        if (*curs < *len) (*curs)++; 
     2698                        break; 
     2699                } 
     2700                 
     2701                case 0x7F: 
     2702                case '\010': 
     2703                { 
     2704                        /* If this is the first time round, backspace means "delete all" */ 
     2705                        if (firsttime) 
     2706                        { 
     2707                                buf[0] = '\0'; 
     2708                                *curs = 0; 
     2709                                *len = 0; 
     2710 
     2711                                break; 
     2712                        } 
     2713 
     2714                        /* Refuse to backspace into oblivion */ 
     2715                        if (*curs == 0) break; 
     2716 
     2717                        /* Move the string from k to nul along to the left by 1 */ 
     2718                        memmove(&buf[*curs - 1], &buf[*curs], *len - *curs); 
     2719 
     2720                        /* Decrement */ 
     2721                        (*curs)--; 
     2722                        (*len)--; 
     2723 
     2724                        /* Terminate */ 
     2725                        buf[*len] = '\0'; 
     2726 
     2727                        break; 
     2728                } 
     2729                 
     2730                default: 
     2731                { 
     2732                        bool atnull = (buf[*curs] == 0); 
     2733 
     2734 
     2735                        if (!isprint((unsigned char)keypress)) 
     2736                        { 
     2737                                bell("Illegal edit key!"); 
     2738                                break; 
     2739                        } 
     2740 
     2741                        /* Clear the buffer if this is the first time round */ 
     2742                        if (firsttime) 
     2743                        { 
     2744                                buf[0] = '\0'; 
     2745                                *curs = 0; 
     2746                                *len = 0; 
     2747                                atnull = 1; 
     2748                        } 
     2749 
     2750                        if (atnull) 
     2751                        { 
     2752                                /* Make sure we have enough room for a new character */ 
     2753                                if ((*curs + 1) >= buflen) break; 
     2754                        } 
     2755                        else 
     2756                        { 
     2757                                /* Make sure we have enough room to add a new character */ 
     2758                                if ((*len + 1) >= buflen) break; 
     2759 
     2760                                /* Move the rest of the buffer along to make room */ 
     2761                                memmove(&buf[*curs+1], &buf[*curs], *len - *curs); 
     2762                        } 
     2763 
     2764                        /* Insert the character */ 
     2765                        buf[(*curs)++] = keypress; 
     2766                        (*len)++; 
     2767 
     2768                        /* Terminate */ 
     2769                        buf[*len] = '\0'; 
     2770 
     2771                        break; 
     2772                } 
     2773        } 
     2774 
     2775        /* By default, we aren't done. */ 
     2776        return FALSE; 
     2777
    26622778 
    26632779/* 
     
    26772793 * Note that 'len' refers to the size of the buffer.  The maximum length 
    26782794 * of the input is 'len-1'. 
    2679  */ 
    2680 bool askfor_aux(char *buf, size_t len) 
    2681 
     2795 * 
     2796 * 'keypress_h' is a pointer to a function to handle keypresses, altering 
     2797 * the input buffer, cursor position and suchlike as required.  See 
     2798 * 'askfor_aux_keypress' (the default handler if you supply NULL for 
     2799 * 'keypress_h') for an example. 
     2800 */ 
     2801bool askfor_aux(char *buf, size_t len, bool keypress_h(char *, size_t, size_t *, size_t *, char, bool)) 
     2802
     2803 
    26822804        int y, x; 
    26832805 
     
    26902812        bool firsttime = TRUE; 
    26912813 
     2814        if (keypress_h == NULL) 
     2815        { 
     2816                keypress_h = askfor_aux_keypress; 
     2817        } 
    26922818 
    26932819        /* Locate the cursor */ 
     
    27212847                ch = inkey(); 
    27222848 
    2723                 /* Analyze the key */ 
    2724                 switch (ch) 
    2725                 { 
    2726                         case ESCAPE: 
    2727                         { 
    2728                                 k = 0; 
    2729                                 done = TRUE; 
    2730                                 break; 
    2731                         } 
    2732  
    2733                         case '\n': 
    2734                         case '\r': 
    2735                         { 
    2736                                 k = strlen(buf); 
    2737                                 done = TRUE; 
    2738                                 break; 
    2739                         } 
    2740  
    2741                         case ARROW_LEFT: 
    2742                         { 
    2743                                 if (firsttime) k = 0; 
    2744                                 if (k > 0) k--; 
    2745                                 break; 
    2746                         } 
    2747  
    2748                         case ARROW_RIGHT: 
    2749                         { 
    2750                                 if (firsttime) k = nul - 1; 
    2751                                 if (k < nul) k++; 
    2752                                 break; 
    2753                         } 
    2754  
    2755                         case 0x7F: 
    2756                         case '\010': 
    2757                         { 
    2758                                 /* If this is the first time round, backspace means "delete all" */ 
    2759                                 if (firsttime) 
    2760                                 { 
    2761                                         buf[0] = '\0'; 
    2762                                         k = 0; 
    2763                                         nul = 0; 
    2764  
    2765                                         break; 
    2766                                 } 
    2767  
    2768                                 /* Refuse to backspace into oblivion */ 
    2769                                 if (k == 0) break; 
    2770  
    2771                                 /* Move the string from k to nul along to the left by 1 */ 
    2772                                 memmove(&buf[k-1], &buf[k], nul - k); 
    2773  
    2774                                 /* Decrement */ 
    2775                                 k--; 
    2776                                 nul--; 
    2777  
    2778                                 /* Terminate */ 
    2779                                 buf[nul] = '\0'; 
    2780  
    2781                                 break; 
    2782                         } 
    2783  
    2784                         default: 
    2785                         { 
    2786                                 bool atnull = (buf[k] == 0); 
    2787  
    2788  
    2789                                 if (!isprint((unsigned char)ch)) 
    2790                                 { 
    2791                                         bell("Illegal edit key!"); 
    2792                                         break; 
    2793                                 } 
    2794  
    2795                                 /* Clear the buffer if this is the first time round */ 
    2796                                 if (firsttime) 
    2797                                 { 
    2798                                         buf[0] = '\0'; 
    2799                                         k = 0; 
    2800                                         nul = 0; 
    2801                                         atnull = 1; 
    2802                                 } 
    2803  
    2804                                 if (atnull) 
    2805                                 { 
    2806                                         /* Make sure we have enough room for a new character */ 
    2807                                         if ((k + 1) >= len) break; 
    2808                                 } 
    2809                                 else 
    2810                                 { 
    2811                                         /* Make sure we have enough room to add a new character */ 
    2812                                         if ((nul + 1) >= len) break; 
    2813  
    2814                                         /* Move the rest of the buffer along to make room */ 
    2815                                         memmove(&buf[k+1], &buf[k], nul - k); 
    2816                                 } 
    2817  
    2818                                 /* Insert the character */ 
    2819                                 buf[k++] = ch; 
    2820                                 nul++; 
    2821  
    2822                                 /* Terminate */ 
    2823                                 buf[nul] = '\0'; 
    2824  
    2825                                 break; 
    2826                         } 
    2827                 } 
     2849                /* Let the keypress handler deal with the keypress */ 
     2850                done = keypress_h(buf, len, &k, &nul, ch, firsttime); 
    28282851 
    28292852                /* Update the entry */ 
     
    28392862} 
    28402863 
     2864/* 
     2865 * A "keypress" handling function for askfor_aux, that handles the special 
     2866 * case of '*' for a new random "name" and passes any other "keypress" 
     2867 * through to the default "editing" handler. 
     2868 */ 
     2869bool get_name_keypress(char *buf, size_t buflen, size_t *curs, size_t *len, char keypress, bool firsttime) 
     2870{ 
     2871        bool result; 
     2872 
     2873        switch (keypress) 
     2874        { 
     2875                case '*': 
     2876                { 
     2877                        *len = make_word(RANDNAME_TOLKIEN, 4, 8, buf, buflen); 
     2878                        buf[0] = toupper((unsigned char) buf[0]); 
     2879                        *curs = 0; 
     2880                        result = FALSE; 
     2881                        break; 
     2882                } 
     2883                 
     2884                 
     2885                default: 
     2886                { 
     2887                        result = askfor_aux_keypress(buf, buflen, curs, len, keypress, firsttime); 
     2888                        break; 
     2889                } 
     2890        } 
     2891 
     2892        return result; 
     2893} 
     2894 
     2895 
     2896/* 
     2897 * Gets a name for the character, reacting to name changes. 
     2898 * 
     2899 * What a horrible name for a global function.  XXX XXX XXX 
     2900 */ 
     2901void get_name(void) 
     2902{ 
     2903        bool res; 
     2904        char tmp[32]; 
     2905 
     2906        /* Paranoia XXX XXX XXX */ 
     2907        message_flush(); 
     2908 
     2909        /* Display prompt */ 
     2910        prt("Enter a name for your character (* for a random name): ", 0, 0); 
     2911 
     2912        /* Save the player name */ 
     2913        my_strcpy(tmp, op_ptr->full_name, sizeof(tmp)); 
     2914 
     2915        /* Ask the user for a string */ 
     2916        res = askfor_aux(tmp, sizeof(tmp), get_name_keypress); 
     2917 
     2918        /* Clear prompt */ 
     2919        prt("", 0, 0); 
     2920 
     2921        if (res) 
     2922        { 
     2923                /* Use the name */ 
     2924                my_strcpy(op_ptr->full_name, tmp, sizeof(op_ptr->full_name)); 
     2925 
     2926                /* Process the player name */ 
     2927                process_player_name(FALSE); 
     2928        } 
     2929} 
     2930 
     2931 
    28412932 
    28422933/* 
     
    28592950 
    28602951        /* Ask the user for a string */ 
    2861         res = askfor_aux(buf, len); 
     2952        res = askfor_aux(buf, len, NULL); 
    28622953 
    28632954        /* Clear prompt */ 
     
    31343225 * Note that "p_ptr->command_new" may not work any more.  XXX XXX XXX 
    31353226 */ 
    3136 void request_command(bool shopping
     3227void request_command(void
    31373228{ 
    31383229        int i; 
     
    31993290                /* Clear top line */ 
    32003291                prt("", 0, 0); 
     3292 
     3293 
     3294                /* Resize events XXX XXX */ 
     3295                if (ke.type == EVT_RESIZE) 
     3296                { 
     3297                        p_ptr->command_cmd_ex = ke; 
     3298                        p_ptr->command_new = ' '; 
     3299                } 
    32013300 
    32023301 
     
    33653464                        /* Repeat 99 times */ 
    33663465                        p_ptr->command_arg = 99; 
    3367                 } 
    3368         } 
    3369  
    3370  
    3371         /* Shopping */ 
    3372         if (shopping) 
    3373         { 
    3374                 /* Hack -- Convert a few special keys */ 
    3375                 switch (p_ptr->command_cmd) 
    3376                 { 
    3377                         /* Command "p" -> "purchase" (get) */ 
    3378                         case 'p': p_ptr->command_cmd = 'g'; break; 
    3379  
    3380                         /* Command "m" -> "purchase" (get) */ 
    3381                         case 'm': p_ptr->command_cmd = 'g'; break; 
    3382  
    3383                         /* Command "s" -> "sell" (drop) */ 
    3384                         case 's': p_ptr->command_cmd = 'd'; break; 
    33853466                } 
    33863467        } 
  • trunk/src/z-term.c

    r98 r120  
    386386        s->cv = f->cv; 
    387387 
    388         /* Copy resize hook */ 
    389         s->resize_hook = f->resize_hook; 
    390  
    391388        /* Success */ 
    392389        return (0); 
     
    20292026 
    20302027/* 
    2031  * Set the resize hook for the current term. 
    2032  */ 
    2033 errr Term_set_resize_hook(void (*hook)(void)) 
    2034 { 
    2035         /* Ensure hook */ 
    2036         if (!hook) return (-1); 
    2037  
    2038         /* Set hook */ 
    2039         Term->scr->resize_hook = hook; 
    2040  
    2041         /* Success */ 
    2042         return (0); 
    2043 } 
    2044  
    2045 /* 
    20462028 * Save the "requested" screen into the "memorized" screen 
    20472029 * 
     
    20682050        Term->mem = mem; 
    20692051 
    2070         /* Nuke the resize hook (safety) */ 
    2071         Term->scr->resize_hook = NULL; 
    2072  
    20732052        /* Success */ 
    20742053        return (0); 
     
    21172096        Term->y1 = 0; 
    21182097        Term->y2 = h - 1; 
    2119  
    2120         /* Call the resize hook */ 
    2121         if (Term->scr->resize_hook && (w != Term->wid) && (h != Term->hgt)) 
    2122                 Term->scr->resize_hook(); 
    21232098 
    21242099        /* Success */ 
     
    21452120        term_win *hold_tmp; 
    21462121 
     2122        event_type evt = { EVT_RESIZE, 0, 0, 0, 0 }; 
     2123 
    21472124 
    21482125        /* Resizing is forbidden */ 
     
    22972274        Term->y2 = h - 1; 
    22982275 
    2299         /* Call the resize hook */ 
    2300         if (Term->scr->resize_hook) 
    2301         { 
    2302                 Term->scr->resize_hook(); 
    2303         } 
    2304         else 
    2305         { 
    2306                 /* Push a resize event onto the stack */ 
    2307                 event_type evt = { EVT_RESIZE, 0, 0, 0, 0 }; 
    2308                 Term_event_push(&evt); 
    2309         } 
     2276        /* Push a resize event onto the stack */ 
     2277        Term_event_push(&evt); 
    23102278 
    23112279        /* Success */ 
  • trunk/src/z-term.h

    r95 r120  
    5555 
    5656        term_win *next; 
    57         void (*resize_hook)(void); 
    5857}; 
    5958 
     
    9392{ 
    9493        event_class type; 
    95     byte mousex, mousey; 
     94       byte mousex, mousey; 
    9695        char key;  
    97     short index; 
     96       short index; 
    9897}; 
    9998 
     
    378377extern errr Term_inkey(event_type *ch, bool wait, bool take); 
    379378 
    380 extern errr Term_set_resize_hook(void (*hook)(void)); 
    381379extern errr Term_save(void); 
    382380extern errr Term_load(void);