Changeset 35

Show
Ignore:
Timestamp:
04/09/07 10:01:21 (2 years ago)
Author:
takkaria
Message:

Clean up code so it's ISO89 and indented more Angband-like.

Files:

Legend:

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

    r33 r35  
    193193{ 
    194194        feature_type *f_ptr = &f_info[feat]; 
    195         switch(f_ptr->d_char) { 
     195        switch(f_ptr->d_char) 
     196        { 
    196197                case '.':                               return 0; 
    197198                case '^':                               return 1; 
     
    201202                case '*': case '%' :    return 5; 
    202203                case ';': case ':' :    return 6; 
     204 
    203205                default: 
    204                 if(isdigit(f_ptr->d_char)) return 7; 
    205                 return 8; 
    206         } 
    207 }; 
     206                       if (isdigit(f_ptr->d_char)) return 7; 
     207                       return 8; 
     208        } 
     209} 
    208210 
    209211 
     
    227229                return width; 
    228230} 
     231 
    229232static int actual_height(int height) { 
    230233        if(use_bigtile) height *= 2; 
     
    364367        int g_o_count = 0;                               /* object count for group */ 
    365368        int oid = -1;                           /* object identifiers */ 
     369 
     370        region title_area = {0, 0, 0, 4}; 
     371        region group_region = {0, 6, g_name_len, -2}; 
     372        region object_region = {g_name_len+3, 6, 0, -2}; 
    366373 
    367374        /* display state variables */ 
     
    394401        int i; 
    395402        int prev_g = -1; 
     403 
     404        int omode = rogue_like_commands; 
    396405 
    397406        /* Get size */ 
     
    430439 
    431440        /* Disable the roguelike commands for the duration */ 
    432         int omode = rogue_like_commands; 
    433441        rogue_like_commands = FALSE; 
    434  
    435         region title_area = {0, 0, 0, 4}; 
    436         region group_region = {0, 6, g_name_len, -2}; 
    437         region object_region = {g_name_len+3, 6, 0, -2}; 
    438442 
    439443        /* Leave room for the group summary information */ 
     
    39393943        char tmp_val[256]; 
    39403944 
    3941         typedef void (*dump_func)(FILE*); 
     3945        typedef void (*dump_func)(FILE *); 
    39423946        dump_func dump_visuals [] =  
    3943                 {dump_monsters, dump_features, dump_objects, dump_flavors, dump_colors}; 
     3947                { dump_monsters, dump_features, dump_objects, dump_flavors, dump_colors }; 
    39443948 
    39453949        /* File type is "TEXT" */ 
    39463950        FILE_TYPE(FILE_TYPE_TEXT); 
    3947  
    39483951 
    39493952        /* Ask for a file */ 
     
    39553958        fff = my_fopen(file_name, "w"); 
    39563959 
    3957         if (!fff) { 
     3960        /* Check for failure */ 
     3961        if (!fff) 
     3962        { 
    39583963                msg_print("Screen dump failed."); 
    39593964                message_flush(); 
    39603965                return; 
    39613966        } 
    3962         for(i = 0; i < N_ELEMENTS(dump_visuals); i++) 
     3967 
     3968        /* Dump all the visuals */ 
     3969        for (i = 0; i < N_ELEMENTS(dump_visuals); i++) 
    39633970                dump_visuals[i](fff); 
     3971 
    39643972        my_fclose(fff); 
    3965  
    39663973 
    39673974        /* Dump the screen with raw character attributes */ 
     
    39763983        do_cmd_redraw(); 
    39773984 
    3978         msg_print("Html screen dump saved."); 
     3985        msg_print("HTML screen dump saved."); 
    39793986        message_flush(); 
    39803987} 
     
    40294036{ 
    40304037        int cursor = -1; 
     4038        event_type c; 
    40314039 
    40324040        screen_save(); 
    4033  
    40344041        menu_layout(&option_menu, &SCREEN_REGION); 
    4035         for(;;) { 
    4036                 event_type c; 
     4042 
     4043        while (c.key != ESCAPE) 
     4044        { 
    40374045                Term_clear(); 
    40384046                c = menu_select(&option_menu, &cursor, 0); 
    4039                 if(ESCAPE == c.key) break; 
    40404047        } 
    40414048 
     
    40464053{ 
    40474054        int cursor = -1; 
     4055        event_type c; 
    40484056 
    40494057        screen_save(); 
    4050  
    40514058        menu_layout(&knowledge_menu, &SCREEN_REGION); 
    4052         for(;;) { 
    4053                 event_type c; 
     4059 
     4060        while (c.key != ESCAPE) 
     4061        { 
    40544062                Term_clear(); 
    40554063                c = menu_select(&knowledge_menu, &cursor, 0); 
    4056                 if(ESCAPE == c.key) break; 
    40574064        } 
    40584065 
     
    41154122 
    41164123        /* initialize other static variables */ 
    4117         if(!obj_group_order) { 
     4124        if (!obj_group_order) 
     4125        { 
    41184126                int i; 
    41194127                int gid = -1; 
     4128 
    41204129                C_MAKE(obj_group_order, TV_GOLD+1, int); 
    41214130                atexit(cleanup_cmds); 
    4122                 for(i = 0; i <= TV_GOLD; i++) /* allow for missing values */ 
     4131 
     4132                /* Sllow for missing values */ 
     4133                for (i = 0; i <= TV_GOLD; i++) 
    41234134                        obj_group_order[i] = -1; 
    4124                 for(i = 0; 0 != object_text_order[i].tval; i++) { 
     4135 
     4136                for (i = 0; 0 != object_text_order[i].tval; i++) 
     4137                { 
    41254138                        if(object_text_order[i].name) gid = i; 
    41264139                        obj_group_order[object_text_order[i].tval] = gid; 
  • trunk/src/z-term.c

    r33 r35  
    19281928errr Term_key_push(int k) 
    19291929{ 
     1930        event_type ke; 
     1931 
    19301932        if (!k) return (-1); 
    1931         event_type ke; 
     1933 
    19321934        ke.type = EVT_KBRD; 
    19331935        ke.index = 0; 
    19341936        ke.key = k; 
     1937 
    19351938        return Term_event_push(&ke); 
    19361939} 
  • trunk/src/z-term.h

    r33 r35  
    7878                                                                        /* For example, a command key action. */ 
    7979        EVT_REFRESH             = 0x0200,               /* Display refresh */ 
    80         EVT_RESIZE              = 0x0400,               /* Display refresh */ 
    81  
    82         EVT_AGAIN               = 0x40000000, /* Retry notification */ 
    83         EVT_STOP                = 0x80000000, /* Loop stopped (never handled) */ 
     80        EVT_RESIZE              = 0x0400,               /* Display resize */ 
     81 
     82        EVT_AGAIN               = 0x4000000,  /* Retry notification */ 
     83        EVT_STOP                = 0x8000000           /* Loop stopped (never handled) */ 
    8484} event_class; 
    8585