Changeset 756

Show
Ignore:
Timestamp:
03/12/08 15:56:19 (9 months ago)
Author:
takkaria
Message:

Add bits of a patch sent by Shanoah:

  • Add a MN_NULL constant so we can stop using 0 in enums
  • Remove an unused variable.
Files:

Legend:

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

    r700 r756  
    907907 
    908908 
    909 static const menu_iter menu_defs[] = { 
    910         { 0, 0, 0, display_gender, gender_handler }, 
    911         { 0, 0, 0, display_race, race_handler }, 
    912         { 0, 0, 0, display_class, class_handler }, 
    913         { 0, 0, 0, display_roller, roller_handler }, 
     909static const menu_iter menu_defs[] = 
     910
     911        { MN_NULL, 0, 0, display_gender, gender_handler }, 
     912        { MN_NULL, 0, 0, display_race, race_handler }, 
     913        { MN_NULL, 0, 0, display_class, class_handler }, 
     914        { MN_NULL, 0, 0, display_roller, roller_handler }, 
    914915}; 
    915916 
     
    17001701} 
    17011702 
    1702 typedef enum  
     1703typedef enum 
    17031704{ 
    17041705        BIRTH_RESTART = 0, 
     
    17321733                        case BIRTH_RESTART: 
    17331734                        { 
    1734                                 state++
     1735                                state = BIRTH_QUESTIONS
    17351736                                break; 
    17361737                        } 
     
    17391740                        { 
    17401741                                /* Race, class, etc. choices */ 
    1741                                 if (player_birth_aux_1(start_at_end))  
    1742                                         state++
     1742                                if (player_birth_aux_1(start_at_end)) 
     1743                                        state = BIRTH_STATS
    17431744                                break; 
    17441745                        } 
     
    17461747                        case BIRTH_STATS: 
    17471748                        { 
     1749                                int temp; 
     1750 
    17481751                                if (roller_type == ROLLER_POINT) 
    17491752                                { 
    17501753                                        /* Fill stats using point-based methods */ 
    1751                                         state += player_birth_aux_2(start_at_end); 
     1754                                        temp = player_birth_aux_2(start_at_end); 
    17521755                                } 
    17531756                                else 
    17541757                                { 
    17551758                                        /* Fills stats using the standard- or auto-roller */ 
    1756                                         state += player_birth_aux_3(start_at_end, roller_type == ROLLER_AUTO); 
     1759                                        temp = player_birth_aux_3(start_at_end, roller_type == ROLLER_AUTO); 
    17571760                                } 
     1761 
     1762                                if (temp > 0) 
     1763                                        state = BIRTH_NAME; 
     1764                                else if (temp < 0) 
     1765                                        state = BIRTH_QUESTIONS; 
     1766 
    17581767                                break; 
    17591768                        } 
     
    17621771                        { 
    17631772                                /* Get a name, prepare savefile */ 
    1764                                 if (get_name(FALSE))  
    1765                                         state++
    1766                                 else  
    1767                                         state--
     1773                                if (get_name(FALSE)) 
     1774                                        state = BIRTH_FINAL_APPROVAL
     1775                                else 
     1776                                        state = BIRTH_STATS
    17681777 
    17691778                                break; 
    17701779                        } 
    1771                          
     1780 
    17721781                        case BIRTH_FINAL_APPROVAL: 
    17731782                        { 
     
    17841793                                button_add("[S]", 'S'); 
    17851794                                redraw_stuff(); 
    1786              
     1795 
    17871796                                /* Get a key */ 
    17881797                                ke = inkey_ex(); 
    17891798 
    17901799                                /* Start over */ 
    1791                                 if (ke.key == 'S')  
     1800                                if (ke.key == 'S') 
    17921801                                        state = BIRTH_RESTART; 
    17931802 
    1794                                 if (ke.key == KTRL('X'))  
     1803                                if (ke.key == KTRL('X')) 
    17951804                                        quit(NULL); 
    17961805 
    1797                                 if (ke.key == ESCAPE)  
    1798                                         state--
     1806                                if (ke.key == ESCAPE) 
     1807                                        state = BIRTH_NAME
    17991808                                else 
    1800                                         state++
     1809                                        state = BIRTH_ACCEPTED
    18011810 
    18021811                                /* Buttons */ 
    18031812                                button_kill_all(); 
    18041813                                redraw_stuff(); 
    1805              
     1814 
    18061815                                /* Clear prompt */ 
    18071816                                clear_from(23); 
     
    18091818                                break; 
    18101819                        } 
    1811                          
     1820 
    18121821                        case BIRTH_ACCEPTED: 
    18131822                        { 
  • trunk/src/button.c

    r698 r756  
    5555static int button_length; 
    5656static int button_num; 
    57 static int prompt_end; 
    5857 
    5958 
  • trunk/src/ui-menu.h

    r542 r756  
    180180typedef enum 
    181181{ 
     182        /* An empty slate */ 
     183        MN_NULL = 0x0, 
     184 
    182185        /* A simple list of actions with an associated name and id. 
    183186           An array of menu_action */