Changeset 220

Show
Ignore:
Timestamp:
06/26/07 18:27:33 (1 year ago)
Author:
ajps
Message:

A couple of bits of code cleanup to fix warnings, and a few alterations purely to avoid warnings.

Files:

Legend:

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

    r199 r220  
    3737 
    3838/* Forward declare these, because they're really defined later */ 
    39 static do_cmd_type do_cmd_wizard, do_cmd_try_debug, do_cmd_try_borg, 
     39static do_cmd_type do_cmd_wizard, do_cmd_try_debug, 
    4040            do_cmd_cast_or_pray, do_cmd_quit, do_cmd_mouseclick, do_cmd_port, 
    4141            do_cmd_xxx_options, do_cmd_menu, do_cmd_monlist; 
    4242 
     43#ifdef ALLOW_BORG 
     44static do_cmd_type do_cmd_try_borg; 
     45#endif 
    4346 
    4447/* 
     
    562565                        unsigned char key = commands[i].key; 
    563566 
    564                         assert(key < N_ELEMENTS(converted_list)); 
     567                        /* Note: at present converted_list is UCHAR_MAX + 1  
     568                           large, so 'key' is always a valid index. */ 
    565569                        converted_list[key] = commands[i].hook; 
    566570                } 
  • trunk/src/cmd1.c

    r156 r220  
    1010 
    1111#include "angband.h" 
    12  
     12#include "cmds.h" 
    1313 
    1414 
  • trunk/src/cmds.h

    r136 r220  
    1 #ifndef __angband_cmds_h__ 
    2 #define __angband_cmds_h__ 
     1#ifndef INCLUDED_CMDS_H 
     2#define INCLUDED_CMDS_H 
    33 
    44/* cmd.c */ 
  • trunk/src/files.c

    r200 r220  
    1010 
    1111#include "angband.h" 
     12#include "cmds.h" 
    1213 
    1314#define MAX_PANEL 12 
  • trunk/src/main-ros.c

    r155 r220  
    5757 *   This is the port version; it appears in the infobox. 
    5858 */ 
    59 #define PORTVERSION     "1.33 (2007-02-06)" 
     59#define PORTVERSION     "1.34 (2007-06-24)" 
    6060 
    6161/* 
  • trunk/src/main-win.c

    r214 r220  
    19661966 
    19671967        /* Play the sound, catch errors */ 
    1968         return (PlaySound(buf, 0, SND_FILENAME | SND_ASYNC)); 
     1968        PlaySound(buf, 0, SND_FILENAME | SND_ASYNC); 
    19691969 
    19701970#else /* USE_SOUND */ 
  • trunk/src/obj-info.c

    r48 r220  
    1010 
    1111#include "angband.h" 
    12  
     12#include "cmds.h" 
    1313 
    1414/* TRUE if a paragraph break should be output before next p_text_out() */ 
  • trunk/src/pathfind.c

    r148 r220  
    7373bool findpath(int y, int x) 
    7474{ 
    75         int i, j, dir, wanted_dir
     75        int i, j, dir
    7676        bool try_again; 
    7777        int cur_distance; 
  • trunk/src/squelch.c

    r217 r220  
    814814static char tag_options_item(menu_type *menu, int oid) 
    815815{ 
    816         if (oid < N_ELEMENTS(sval_dependent)) 
     816        size_t line = (size_t) oid; 
     817 
     818        if (line < N_ELEMENTS(sval_dependent)) 
    817819                return I2A(oid); 
    818820 
    819821        /* Separator - blank line. */ 
    820         if (oid == N_ELEMENTS(sval_dependent)) 
     822        if (line == N_ELEMENTS(sval_dependent)) 
    821823                return 0; 
    822824 
    823         oid = oid - N_ELEMENTS(sval_dependent)
    824  
    825         if (oid - 1 < N_ELEMENTS(extra_item_options)) 
    826                 return extra_item_options[oid - 1].tag; 
     825        line = line - N_ELEMENTS(sval_dependent) - 1
     826 
     827        if (line < N_ELEMENTS(extra_item_options)) 
     828                return extra_item_options[line].tag; 
    827829 
    828830        return 0; 
     
    831833static int valid_options_item(menu_type *menu, int oid) 
    832834{ 
    833         if (oid < N_ELEMENTS(sval_dependent)) 
     835        size_t line = (size_t) oid; 
     836 
     837        if (line < N_ELEMENTS(sval_dependent)) 
    834838                return 1; 
    835839 
    836840        /* Separator - blank line. */ 
    837         if (oid == N_ELEMENTS(sval_dependent)) 
     841        if (line == N_ELEMENTS(sval_dependent)) 
    838842                return 0; 
    839843 
    840         oid = oid - N_ELEMENTS(sval_dependent)
    841  
    842         if (oid - 1 < N_ELEMENTS(extra_item_options)) 
     844        line = line - N_ELEMENTS(sval_dependent) - 1
     845 
     846        if (line < N_ELEMENTS(extra_item_options)) 
    843847                return 1; 
    844848 
     
    848852static void display_options_item(menu_type *menu, int oid, bool cursor, int row, int col, int width) 
    849853{ 
    850         if (oid < N_ELEMENTS(sval_dependent)) 
    851         { 
    852                 bool known = seen_tval(sval_dependent[oid].tval); 
     854        size_t line = (size_t) oid; 
     855 
     856        /* First section of menu - the svals */ 
     857        if (line < N_ELEMENTS(sval_dependent)) 
     858        { 
     859                bool known = seen_tval(sval_dependent[line].tval); 
    853860                byte attr = curs_attrs[known ? CURS_KNOWN: CURS_UNKNOWN][(int)cursor]; 
    854861 
    855                 c_prt(attr, sval_dependent[oid].desc, row, col); 
    856         } 
     862                c_prt(attr, sval_dependent[line].desc, row, col); 
     863        } 
     864        /* Second section - the "extra options" */ 
    857865        else 
    858866        { 
    859867                byte attr = curs_attrs[CURS_KNOWN][(int)cursor]; 
    860868 
    861                 oid = oid - N_ELEMENTS(sval_dependent)
     869                line = line - N_ELEMENTS(sval_dependent) - 1
    862870     
    863                 if (oid - 1 < N_ELEMENTS(extra_item_options)) 
    864                         c_prt(attr, extra_item_options[oid - 1].name, row, col); 
     871                if (line < N_ELEMENTS(extra_item_options)) 
     872                        c_prt(attr, extra_item_options[line].name, row, col); 
    865873        } 
    866874} 
     
    907915                if (c.type == EVT_SELECT) 
    908916                { 
    909                         if (cursor < N_ELEMENTS(sval_dependent)) 
     917                        if ((size_t) cursor < N_ELEMENTS(sval_dependent)) 
    910918                        { 
    911919                                sval_menu(sval_dependent[cursor].tval, sval_dependent[cursor].desc); 
     
    914922                        { 
    915923                                cursor = cursor - N_ELEMENTS(sval_dependent) - 1; 
    916                                 if (cursor< N_ELEMENTS(extra_item_options)) 
     924                                if ((size_t) cursor< N_ELEMENTS(extra_item_options)) 
    917925                                        extra_item_options[cursor].action(); 
    918926                        } 
  • trunk/src/ui.c

    r210 r220  
    702702                case EVT_KBRD: 
    703703                { 
    704                         int dir; 
     704                        int c, dir; 
    705705 
    706706                        /* could install handle_menu_key as a handler */ 
     
    714714                        } 
    715715 
    716                         int c = get_cursor_key(menu, menu->top, in->key); 
     716                        c = get_cursor_key(menu, menu->top, in->key); 
    717717 
    718718                        /* keypress shortcuts are allowed, but the choice */ 
     
    11281128{ 
    11291129        if (menu->object_list) 
    1130                 FREE(menu->object_list); 
     1130                FREE((void *)menu->object_list); 
    11311131} 
    11321132 
  • trunk/src/z-file.h

    r182 r220  
    1 #ifndef __angband_z_file__ 
    2 #define __angband_z_file__ 
     1#ifndef INCLUDED_Z_FILE_H 
     2#define INCLUDED_Z_FILE_H 
    33 
    44/*** Various system-specific fixes ***/