comparison arogue7/command.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents 1cd604c827a3
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
27 #ifdef PC7300 27 #ifdef PC7300
28 #include "sys/window.h" 28 #include "sys/window.h"
29 extern struct uwdata wdata; 29 extern struct uwdata wdata;
30 #endif 30 #endif
31 31
32 void display(void);
33 void help(void);
34 void identify(char ch);
35 void d_level(void);
36 void u_level(void);
37 void shell(void);
38 void nameit(void);
39 void namemonst(void);
40 void count_gold(void);
41
32 /* 42 /*
33 * command: 43 * command:
34 * Process the user commands 44 * Process the user commands
35 */ 45 */
36 46
37 command() 47 void
48 command(void)
38 { 49 {
39 unsigned char ch; 50 unsigned char ch;
40 struct linked_list *item; 51 struct linked_list *item;
41 unsigned char countch, direction, newcount = FALSE; 52 unsigned char countch, direction, newcount = FALSE;
42 int segment = 1; 53 int segment = 1;
265 /* Let's quote the wise guy a price */ 276 /* Let's quote the wise guy a price */
266 buy_it(); 277 buy_it();
267 after = FALSE; 278 after = FALSE;
268 } 279 }
269 when C_COUNT : count_gold(); 280 when C_COUNT : count_gold();
270 when C_QUAFF : quaff(-1, NULL, NULL, TRUE); 281 when C_QUAFF : quaff(-1, 0, 0, TRUE);
271 when C_READ : read_scroll(-1, NULL, TRUE); 282 when C_READ : read_scroll(-1, 0, TRUE);
272 when C_EAT : eat(); 283 when C_EAT : eat();
273 when C_WIELD : wield(); 284 when C_WIELD : wield();
274 when C_WEAR : wear(); 285 when C_WEAR : wear();
275 when C_TAKEOFF : take_off(); 286 when C_TAKEOFF : take_off();
276 when 'o' : option(); 287 when 'o' : option();
278 when '=' : after = FALSE; display(); 289 when '=' : after = FALSE; display();
279 when 'm' : nameitem(NULL, TRUE); 290 when 'm' : nameitem(NULL, TRUE);
280 when '>' : after = FALSE; d_level(); 291 when '>' : after = FALSE; d_level();
281 when '<' : after = FALSE; u_level(); 292 when '<' : after = FALSE; u_level();
282 when '?' : after = FALSE; help(); 293 when '?' : after = FALSE; help();
283 when '/' : after = FALSE; identify(NULL); 294 when '/' : after = FALSE; identify(0);
284 when C_USE : use_mm(-1); 295 when C_USE : use_mm(-1);
285 when CTRL('T') : 296 when CTRL('T') :
286 if (player.t_action == A_NIL) { 297 if (player.t_action == A_NIL) {
287 if (get_dir(&player.t_newpos)) { 298 if (get_dir(&player.t_newpos)) {
288 player.t_action = CTRL('T'); 299 player.t_action = CTRL('T');
313 } 324 }
314 else { 325 else {
315 search(FALSE, FALSE); 326 search(FALSE, FALSE);
316 player.t_action = A_NIL; 327 player.t_action = A_NIL;
317 } 328 }
318 when C_ZAP : if (!player_zap(NULL, FALSE)) 329 when C_ZAP : if (!player_zap(0, FALSE))
319 after=FALSE; 330 after=FALSE;
320 when C_PRAY : pray(); 331 when C_PRAY : pray();
321 when C_CHANT : chant(); 332 when C_CHANT : chant();
322 when C_CAST : cast(); 333 when C_CAST : cast();
323 when 'a' : 334 when 'a' :
551 /* 562 /*
552 * display 563 * display
553 * tell the player what is at a certain coordinates assuming 564 * tell the player what is at a certain coordinates assuming
554 * it can be seen. 565 * it can be seen.
555 */ 566 */
556 display() 567 void
568 display(void)
557 { 569 {
558 coord c; 570 coord c;
559 struct linked_list *item; 571 struct linked_list *item;
560 struct thing *tp; 572 struct thing *tp;
561 int what; 573 int what;
585 * quit: 597 * quit:
586 * Have player make certain, then exit. 598 * Have player make certain, then exit.
587 */ 599 */
588 600
589 void 601 void
590 quit(sig) 602 quit(int sig)
591 int sig;
592 { 603 {
593 /* 604 /*
594 * Reset the signal in case we got here via an interrupt 605 * Reset the signal in case we got here via an interrupt
595 */ 606 */
596 if (signal(SIGINT, quit) != quit) 607 if (signal(SIGINT, quit) != quit)
626 * bugkill: 637 * bugkill:
627 * killed by a program bug instead of voluntarily. 638 * killed by a program bug instead of voluntarily.
628 */ 639 */
629 640
630 void 641 void
631 bugkill(sig) 642 bugkill(int sig)
632 int sig;
633 { 643 {
634 signal(sig, quit); /* If we get it again, give up */ 644 signal(sig, quit); /* If we get it again, give up */
635 death(D_SIGNAL); /* Killed by a bug */ 645 death(D_SIGNAL); /* Killed by a bug */
636 } 646 }
637 647
639 /* 649 /*
640 * search: 650 * search:
641 * Player gropes about him to find hidden things. 651 * Player gropes about him to find hidden things.
642 */ 652 */
643 653
644 search(is_thief, door_chime) 654 void
645 register bool is_thief, door_chime; 655 search(bool is_thief, bool door_chime)
646 { 656 {
647 register int x, y; 657 register int x, y;
648 register char ch, /* The trap or door character */ 658 register char ch, /* The trap or door character */
649 sch, /* Trap or door character (as seen on screen) */ 659 sch, /* Trap or door character (as seen on screen) */
650 mch; /* Monster, if a monster is on the trap or door */ 660 mch; /* Monster, if a monster is on the trap or door */
750 /* 760 /*
751 * help: 761 * help:
752 * Give single character help, or the whole mess if he wants it 762 * Give single character help, or the whole mess if he wants it
753 */ 763 */
754 764
755 help() 765 void
766 help(void)
756 { 767 {
757 register struct h_list *strp = helpstr; 768 register struct h_list *strp = helpstr;
758 #ifdef WIZARD 769 #ifdef WIZARD
759 struct h_list *wizp = wiz_help; 770 struct h_list *wizp = wiz_help;
760 #endif 771 #endif
842 /* 853 /*
843 * identify: 854 * identify:
844 * Tell the player what a certain thing is. 855 * Tell the player what a certain thing is.
845 */ 856 */
846 857
847 identify(ch) 858 void
848 register char ch; 859 identify(char ch)
849 { 860 {
850 register char *str; 861 register char *str;
851 862
852 if (ch == 0) { 863 if (ch == 0) {
853 msg("What do you want identified? "); 864 msg("What do you want identified? ");
905 /* 916 /*
906 * d_level: 917 * d_level:
907 * He wants to go down a level 918 * He wants to go down a level
908 */ 919 */
909 920
921 void
910 d_level() 922 d_level()
911 { 923 {
912 bool no_phase=FALSE; 924 bool no_phase=FALSE;
913 char position = CCHAR( winat(hero.y, hero.x) ); 925 char position = CCHAR( winat(hero.y, hero.x) );
914 926
956 /* 968 /*
957 * u_level: 969 * u_level:
958 * He wants to go up a level 970 * He wants to go up a level
959 */ 971 */
960 972
961 u_level() 973 void
974 u_level(void)
962 { 975 {
963 bool no_phase = FALSE; 976 bool no_phase = FALSE;
964 register struct linked_list *item; 977 register struct linked_list *item;
965 struct thing *tp; 978 struct thing *tp;
966 struct object *obj; 979 struct object *obj;
1014 1027
1015 /* 1028 /*
1016 * Let him escape for a while 1029 * Let him escape for a while
1017 */ 1030 */
1018 1031
1019 shell() 1032 void
1033 shell(void)
1020 { 1034 {
1021 register char *sh; 1035 register char *sh;
1022 1036
1023 /* 1037 /*
1024 * Set the terminal back to original mode 1038 * Set the terminal back to original mode
1048 } 1062 }
1049 1063
1050 /* 1064 /*
1051 * see what we want to name -- an item or a monster. 1065 * see what we want to name -- an item or a monster.
1052 */ 1066 */
1053 nameit() 1067 void
1068 nameit(void)
1054 { 1069 {
1055 char answer; 1070 char answer;
1056 1071
1057 msg("Name monster or item (m or i)? "); 1072 msg("Name monster or item (m or i)? ");
1058 answer = readchar(); 1073 answer = readchar();
1071 } 1086 }
1072 1087
1073 /* 1088 /*
1074 * allow a user to call a potion, scroll, or ring something 1089 * allow a user to call a potion, scroll, or ring something
1075 */ 1090 */
1076 nameitem(item, mark) 1091 void
1077 struct linked_list *item; 1092 nameitem(struct linked_list *item, bool mark)
1078 bool mark;
1079 { 1093 {
1080 register struct object *obj; 1094 register struct object *obj;
1081 register char **guess = NULL, *elsewise = NULL; 1095 register char **guess = NULL, *elsewise = NULL;
1082 register bool *know; 1096 register bool *know;
1083 1097
1159 } 1173 }
1160 } 1174 }
1161 1175
1162 /* Name a monster */ 1176 /* Name a monster */
1163 1177
1164 namemonst() 1178 void
1179 namemonst(void)
1165 { 1180 {
1166 register struct thing *tp; 1181 register struct thing *tp;
1167 struct linked_list *item; 1182 struct linked_list *item;
1168 coord c; 1183 coord c;
1169 1184
1204 } 1219 }
1205 1220
1206 msg("There is no monster there to name."); 1221 msg("There is no monster there to name.");
1207 } 1222 }
1208 1223
1209 count_gold() 1224 void
1225 count_gold(void)
1210 { 1226 {
1211 if (player.t_action != C_COUNT) { 1227 if (player.t_action != C_COUNT) {
1212 msg("You take a break to count your money..."); 1228 msg("You take a break to count your money...");
1213 player.t_using = NULL; 1229 player.t_using = NULL;
1214 player.t_action = C_COUNT; /* We are counting */ 1230 player.t_action = C_COUNT; /* We are counting */