Mercurial > hg > early-roguelike
comparison srogue/state.c @ 217:94a0d9dd5ce1
Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
author | John "Elwin" Edwards |
---|---|
date | Sun, 31 Jan 2016 13:45:07 -0500 |
parents | 09db0cf536af |
children | 696277507a2e |
comparison
equal
deleted
inserted
replaced
216:b24545357d2e | 217:94a0d9dd5ce1 |
---|---|
68 #include "rogue.ext" | 68 #include "rogue.ext" |
69 | 69 |
70 #define READSTAT ((format_error == 0) && (read_error == 0)) | 70 #define READSTAT ((format_error == 0) && (read_error == 0)) |
71 #define WRITESTAT (write_error == 0) | 71 #define WRITESTAT (write_error == 0) |
72 | 72 |
73 int rs_read_int(int inf, int *i); | |
74 int rs_write_int(FILE *savef, int c); | |
75 | |
73 int read_error = FALSE; | 76 int read_error = FALSE; |
74 int write_error = FALSE; | 77 int write_error = FALSE; |
75 int format_error = FALSE; | 78 int format_error = FALSE; |
76 int end_of_file = FALSE; | 79 int end_of_file = FALSE; |
77 int big_endian = 0; | 80 int big_endian = 0; |
80 char encstr[] = "\354\251\243\332A\201|\301\321p\210\251\327\"\257\365t\341%3\271^`~\203z{\341};\f\341\231\222e\234\351]\321"; | 83 char encstr[] = "\354\251\243\332A\201|\301\321p\210\251\327\"\257\365t\341%3\271^`~\203z{\341};\f\341\231\222e\234\351]\321"; |
81 | 84 |
82 /* | 85 /* |
83 * perform an encrypted write | 86 * perform an encrypted write |
84 */ | 87 */ |
85 encwrite(starta, size, outf) | 88 void |
86 register void *starta; | 89 encwrite(void *starta, unsigned int size, FILE *outf) |
87 unsigned int size; | |
88 register FILE *outf; | |
89 { | 90 { |
90 register char *ep; | 91 register char *ep; |
91 register char *start = starta; | 92 register char *start = starta; |
92 | 93 |
93 ep = encstr; | 94 ep = encstr; |
101 } | 102 } |
102 | 103 |
103 /* | 104 /* |
104 * perform an encrypted read | 105 * perform an encrypted read |
105 */ | 106 */ |
106 encread(starta, size, inf) | 107 int |
107 register void *starta; | 108 encread(void *starta, unsigned int size, int inf) |
108 unsigned int size; | |
109 register int inf; | |
110 { | 109 { |
111 register char *ep; | 110 register char *ep; |
112 register int read_size; | 111 register int read_size; |
113 register char *start = starta; | 112 register char *start = starta; |
114 | 113 |
1554 rs_write_int(savef, trap[n].tr_flags); | 1553 rs_write_int(savef, trap[n].tr_flags); |
1555 rs_write_char(savef, trap[n].tr_type); | 1554 rs_write_char(savef, trap[n].tr_type); |
1556 } | 1555 } |
1557 } | 1556 } |
1558 | 1557 |
1558 int | |
1559 rs_read_traps(int inf, struct trap *trap, int count) | 1559 rs_read_traps(int inf, struct trap *trap, int count) |
1560 { | 1560 { |
1561 int id = 0, value = 0, n = 0; | 1561 int id = 0, value = 0, n = 0; |
1562 | 1562 |
1563 if (rs_read_int(inf,&id) != 0) | 1563 if (rs_read_int(inf,&id) != 0) |
1883 else format_error = TRUE; | 1883 else format_error = TRUE; |
1884 | 1884 |
1885 return(READSTAT); | 1885 return(READSTAT); |
1886 } | 1886 } |
1887 | 1887 |
1888 rs_fix_monster_list(list) | 1888 void |
1889 struct linked_list *list; | 1889 rs_fix_monster_list(struct linked_list *list) |
1890 { | 1890 { |
1891 struct linked_list *item; | 1891 struct linked_list *item; |
1892 | 1892 |
1893 for(item = list; item != NULL; item = item->l_next) | 1893 for(item = list; item != NULL; item = item->l_next) |
1894 rs_fix_thing(THINGPTR(item)); | 1894 rs_fix_thing(THINGPTR(item)); |
1968 rs_write_int(savef, i); | 1968 rs_write_int(savef, i); |
1969 | 1969 |
1970 return(WRITESTAT); | 1970 return(WRITESTAT); |
1971 } | 1971 } |
1972 | 1972 |
1973 int | |
1973 rs_read_object_reference(int inf, struct linked_list *list, | 1974 rs_read_object_reference(int inf, struct linked_list *list, |
1974 struct object **item) | 1975 struct object **item) |
1975 { | 1976 { |
1976 int i; | 1977 int i; |
1977 | 1978 |
2223 fflush(savef); | 2224 fflush(savef); |
2224 | 2225 |
2225 return(WRITESTAT); | 2226 return(WRITESTAT); |
2226 } | 2227 } |
2227 | 2228 |
2229 int | |
2228 rs_restore_file(int inf) | 2230 rs_restore_file(int inf) |
2229 { | 2231 { |
2230 bool junk; | 2232 bool junk; |
2231 int endian = 0x01020304; | 2233 int endian = 0x01020304; |
2232 big_endian = ( *((char *)&endian) == 0x01 ); | 2234 big_endian = ( *((char *)&endian) == 0x01 ); |