Mercurial > hg > early-roguelike
comparison arogue5/command.c @ 218:56e748983fa8
Advanced Rogue 5: convert to ANSI function declarations.
This still leaves over a thousand lines of warning messages, mostly
related to the return types of daemons and fuses.
| author | John "Elwin" Edwards | 
|---|---|
| date | Sun, 07 Feb 2016 14:39:21 -0500 | 
| parents | a0a57cf42810 | 
| children | e52a8a7ad4c5 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 217:94a0d9dd5ce1 | 218:56e748983fa8 | 
|---|---|
| 19 #include <ctype.h> | 19 #include <ctype.h> | 
| 20 #include <signal.h> | 20 #include <signal.h> | 
| 21 #include "rogue.h" | 21 #include "rogue.h" | 
| 22 #include "mach_dep.h" | 22 #include "mach_dep.h" | 
| 23 | 23 | 
| 24 void help(void); | |
| 25 void identify(void); | |
| 26 void d_level(void); | |
| 27 void u_level(void); | |
| 28 void shell(void); | |
| 29 void call(bool mark); | |
| 30 | |
| 24 /* | 31 /* | 
| 25 * command: | 32 * command: | 
| 26 * Process the user commands | 33 * Process the user commands | 
| 27 */ | 34 */ | 
| 28 | 35 | 
| 29 command() | 36 void | 
| 37 command(void) | |
| 30 { | 38 { | 
| 31 register char ch; | 39 register char ch; | 
| 32 register int ntimes = 1; /* Number of player moves */ | 40 register int ntimes = 1; /* Number of player moves */ | 
| 33 static char countch, direction, newcount = FALSE; | 41 static char countch, direction, newcount = FALSE; | 
| 34 struct linked_list *item; | 42 struct linked_list *item; | 
| 205 when 'Q' : after = FALSE; quit(-1); | 213 when 'Q' : after = FALSE; quit(-1); | 
| 206 when 'i' : after = FALSE; inventory(pack, ALL); | 214 when 'i' : after = FALSE; inventory(pack, ALL); | 
| 207 when 'I' : after = FALSE; picky_inven(); | 215 when 'I' : after = FALSE; picky_inven(); | 
| 208 when 'd' : drop(NULL); | 216 when 'd' : drop(NULL); | 
| 209 when 'P' : grab(hero.y, hero.x); | 217 when 'P' : grab(hero.y, hero.x); | 
| 210 when 'q' : quaff(-1, NULL, TRUE); | 218 when 'q' : quaff(-1, 0, TRUE); | 
| 211 when 'r' : read_scroll(-1, NULL, TRUE); | 219 when 'r' : read_scroll(-1, 0, TRUE); | 
| 212 when 'e' : eat(); | 220 when 'e' : eat(); | 
| 213 when 'w' : wield(); | 221 when 'w' : wield(); | 
| 214 when 'W' : wear(); | 222 when 'W' : wear(); | 
| 215 when 'T' : take_off(); | 223 when 'T' : take_off(); | 
| 216 when 'o' : option(); | 224 when 'o' : option(); | 
| 226 else after = FALSE; | 234 else after = FALSE; | 
| 227 when 'D' : dip_it(); | 235 when 'D' : dip_it(); | 
| 228 when 'G' : gsense(); | 236 when 'G' : gsense(); | 
| 229 when '^' : set_trap(&player, hero.y, hero.x); | 237 when '^' : set_trap(&player, hero.y, hero.x); | 
| 230 when 's' : search(FALSE, FALSE); | 238 when 's' : search(FALSE, FALSE); | 
| 231 when 'z' : if (!do_zap(TRUE, NULL, FALSE)) | 239 when 'z' : if (!do_zap(TRUE, 0, FALSE)) | 
| 232 after=FALSE; | 240 after=FALSE; | 
| 233 when 'p' : pray(); | 241 when 'p' : pray(); | 
| 234 when 'C' : cast(); | 242 when 'C' : cast(); | 
| 235 when 'a' : | 243 when 'a' : | 
| 236 if (get_dir()) | 244 if (get_dir()) | 
| 473 * bugkill: | 481 * bugkill: | 
| 474 * killed by a program bug instead of voluntarily. | 482 * killed by a program bug instead of voluntarily. | 
| 475 */ | 483 */ | 
| 476 | 484 | 
| 477 void | 485 void | 
| 478 bugkill(sig) | 486 bugkill(int sig) | 
| 479 int sig; | |
| 480 { | 487 { | 
| 481 signal(sig, quit); /* If we get it again, give up */ | 488 signal(sig, quit); /* If we get it again, give up */ | 
| 482 death(D_SIGNAL); /* Killed by a bug */ | 489 death(D_SIGNAL); /* Killed by a bug */ | 
| 483 } | 490 } | 
| 484 | 491 | 
| 486 /* | 493 /* | 
| 487 * search: | 494 * search: | 
| 488 * Player gropes about him to find hidden things. | 495 * Player gropes about him to find hidden things. | 
| 489 */ | 496 */ | 
| 490 | 497 | 
| 491 search(is_thief, door_chime) | 498 void | 
| 492 register bool is_thief, door_chime; | 499 search(bool is_thief, bool door_chime) | 
| 493 { | 500 { | 
| 494 register int x, y; | 501 register int x, y; | 
| 495 register char ch, /* The trap or door character */ | 502 register char ch, /* The trap or door character */ | 
| 496 sch, /* Trap or door character (as seen on screen) */ | 503 sch, /* Trap or door character (as seen on screen) */ | 
| 497 mch; /* Monster, if a monster is on the trap or door */ | 504 mch; /* Monster, if a monster is on the trap or door */ | 
| 568 /* | 575 /* | 
| 569 * help: | 576 * help: | 
| 570 * Give single character help, or the whole mess if he wants it | 577 * Give single character help, or the whole mess if he wants it | 
| 571 */ | 578 */ | 
| 572 | 579 | 
| 573 help() | 580 void | 
| 581 help(void) | |
| 574 { | 582 { | 
| 575 register struct h_list *strp = helpstr; | 583 register struct h_list *strp = helpstr; | 
| 576 #ifdef WIZARD | 584 #ifdef WIZARD | 
| 577 struct h_list *wizp = wiz_help; | 585 struct h_list *wizp = wiz_help; | 
| 578 #endif | 586 #endif | 
| 662 /* | 670 /* | 
| 663 * identify: | 671 * identify: | 
| 664 * Tell the player what a certain thing is. | 672 * Tell the player what a certain thing is. | 
| 665 */ | 673 */ | 
| 666 | 674 | 
| 667 identify() | 675 void | 
| 676 identify(void) | |
| 668 { | 677 { | 
| 669 register char ch; | 678 register char ch; | 
| 670 const char *str; | 679 const char *str; | 
| 671 | 680 | 
| 672 msg("What do you want identified? "); | 681 msg("What do you want identified? "); | 
| 724 /* | 733 /* | 
| 725 * d_level: | 734 * d_level: | 
| 726 * He wants to go down a level | 735 * He wants to go down a level | 
| 727 */ | 736 */ | 
| 728 | 737 | 
| 729 d_level() | 738 void | 
| 739 d_level(void) | |
| 730 { | 740 { | 
| 731 bool no_phase=FALSE; | 741 bool no_phase=FALSE; | 
| 732 | 742 | 
| 733 | 743 | 
| 734 /* If we are at a top-level trading post, we probably can't go down */ | 744 /* If we are at a top-level trading post, we probably can't go down */ | 
| 768 /* | 778 /* | 
| 769 * u_level: | 779 * u_level: | 
| 770 * He wants to go up a level | 780 * He wants to go up a level | 
| 771 */ | 781 */ | 
| 772 | 782 | 
| 773 u_level() | 783 void | 
| 784 u_level(void) | |
| 774 { | 785 { | 
| 775 bool no_phase = FALSE; | 786 bool no_phase = FALSE; | 
| 776 register struct linked_list *item; | 787 register struct linked_list *item; | 
| 777 struct thing *tp; | 788 struct thing *tp; | 
| 778 struct object *obj; | 789 struct object *obj; | 
| 826 | 837 | 
| 827 /* | 838 /* | 
| 828 * Let him escape for a while | 839 * Let him escape for a while | 
| 829 */ | 840 */ | 
| 830 | 841 | 
| 831 shell() | 842 void | 
| 843 shell(void) | |
| 832 { | 844 { | 
| 833 /* | 845 /* | 
| 834 * Set the terminal back to original mode | 846 * Set the terminal back to original mode | 
| 835 */ | 847 */ | 
| 836 wclear(hw); | 848 wclear(hw); | 
| 857 } | 869 } | 
| 858 | 870 | 
| 859 /* | 871 /* | 
| 860 * allow a user to call a potion, scroll, or ring something | 872 * allow a user to call a potion, scroll, or ring something | 
| 861 */ | 873 */ | 
| 862 call(mark) | 874 void | 
| 863 bool mark; | 875 call(bool mark) | 
| 864 { | 876 { | 
| 865 register struct object *obj; | 877 register struct object *obj; | 
| 866 register struct linked_list *item; | 878 register struct linked_list *item; | 
| 867 register char **guess = NULL, *elsewise = NULL; | 879 register char **guess = NULL, *elsewise = NULL; | 
| 868 register bool *know; | 880 register bool *know; | 
