diff xrogue/rip.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents 5a77931393f4
children b49d8b963df3
line wrap: on
line diff
--- a/xrogue/rip.c	Fri Feb 19 21:02:28 2016 -0500
+++ b/xrogue/rip.c	Wed Mar 02 21:13:26 2016 -0500
@@ -20,6 +20,7 @@
 #define EDITSCORE 2     /* Edit the current score file */
 #define ADDSCORE 3      /* Add a new score */
 
+#include <stdlib.h>
 #include <curses.h>
 #include <time.h>
 #include <signal.h>
@@ -54,14 +55,20 @@
 NULL
 };
 
-char    *killname();
+int rs_read_scorefile(FILE *savef, struct sc_ent *entries, int count);
+void rs_write_scorefile(FILE *savef, struct sc_ent *entries, int count);
+
+char *killname(short monst);
+void showpack(char *howso);
+int update(struct sc_ent top_ten[], unsigned long amount, short quest, 
+           char *whoami, short flags, short level, short monst, short ctype,
+           char *system, char *login);
 
 extern FILE *scorefi, *logfile;
 
 /*UNUSED*/
 void
-byebye(sig)
-int sig;
+byebye(int sig)
 {
 	NOOP(sig);
     exit_game(EXIT_ENDWIN);
@@ -73,8 +80,8 @@
  *      Do something really fun when he dies
  */
 
-death(monst)
-register short monst;
+void
+death(short monst)
 {
     register char **dp = rip, *killer;
     register struct tm *lt;
@@ -102,8 +109,7 @@
 }
 
 char *
-killname(monst)
-register short monst;
+killname(short monst)
 {
     static char mons_name[LINELEN/2];
     int i;
@@ -187,10 +193,8 @@
  */
 
 /* VARARGS2 */
-score(amount, flags, monst)
-unsigned long amount;
-int flags;
-short monst;
+void
+score(unsigned long amount, int flags, short monst)
 {
     struct sc_ent top_ten[NUMSCORE];
     register struct sc_ent *scp;
@@ -574,8 +578,8 @@
  *      Display the contents of the hero's pack
  */
 
-showpack(howso)
-char *howso;
+void
+showpack(char *howso)
 {
         reg char *iname;
         reg int cnt, packnum;
@@ -604,7 +608,8 @@
         refresh();
 }
 
-total_winner()
+void
+total_winner(void)
 {
     register struct linked_list *item;
     register struct object *obj;
@@ -665,9 +670,7 @@
 
 
 void
-delete_score(top_ten, idx)
-struct sc_ent top_ten[NUMSCORE];
-int idx;
+delete_score(struct sc_ent top_ten[NUMSCORE], int idx)
 {
     for(;idx < NUMSCORE-1;idx++)
         top_ten[idx] = top_ten[idx+1];
@@ -676,9 +679,7 @@
 }
 
 int
-insert_score(top_ten, sc)
-struct sc_ent top_ten[NUMSCORE];
-struct sc_ent *sc;
+insert_score(struct sc_ent top_ten[NUMSCORE], struct sc_ent *sc)
 {
     int i,j;
 
@@ -699,10 +700,8 @@
 
 /* PCS = player-class-system (used to determines uniqueness of player) */
 
-int
-is_pcs_match(sc1,sc2)
-struct sc_ent *sc1;
-struct sc_ent *sc2;
+bool
+is_pcs_match(struct sc_ent *sc1, struct sc_ent *sc2)
 {
     return( (strcmp(sc1->sc_name,sc2->sc_name) == 0) &&
          (sc1->sc_ctype == sc2->sc_ctype) &&
@@ -710,10 +709,8 @@
 }
 
 int
-count_pcs_matches(top_ten,sc,lowest)
-struct sc_ent top_ten[NUMSCORE];
-struct sc_ent *sc;
-int *lowest;
+count_pcs_matches(struct sc_ent top_ten[NUMSCORE], struct sc_ent *sc, 
+                  int *lowest)
 {
     int i, matches = 0;
 
@@ -729,10 +726,8 @@
 }
 
 int
-find_most_pcs_matches(top_ten,sc,num,idx)
-struct sc_ent top_ten[NUMSCORE];
-struct sc_ent *sc;
-int *num, *idx;
+find_most_pcs_matches(struct sc_ent top_ten[NUMSCORE], struct sc_ent *sc, 
+                      int *num, int *idx)
 {
     int i, matches, max_match=0, max_match_idx=-1, lowest;
     
@@ -761,9 +756,7 @@
 
 
 int
-add_score(top_ten,sc)
-struct sc_ent top_ten[NUMSCORE];
-struct sc_ent *sc;
+add_score(struct sc_ent top_ten[NUMSCORE], struct sc_ent *sc)
 {
     int idx, count;
       
@@ -797,11 +790,10 @@
     }    
 }
 
-update(top_ten, amount, quest, whoami, flags, level, monst, ctype, system, login)
-struct sc_ent top_ten[];
-unsigned long amount;
-short quest, flags, level, monst, ctype;
-char *whoami, *system, *login;
+int
+update(struct sc_ent top_ten[], unsigned long amount, short quest, char *whoami,
+       short flags, short level, short monst, short ctype, char *system, 
+       char *login)
 {
     struct sc_ent sc;