Mercurial > hg > early-roguelike
comparison rogue4/rooms.c @ 215:1b73a8641b37
rogue4: fix most GCC5 warnings.
Converting all function definitions to ANSI style accounts for most of
the change. This has exposed other problems, such as daemons not
actually being their stated type, that will require more careful
solutions.
author | John "Elwin" Edwards |
---|---|
date | Wed, 27 Jan 2016 19:41:05 -0500 |
parents | 9535a08ddc39 |
children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
214:e5a15b09ce1d | 215:1b73a8641b37 |
---|---|
14 #include <curses.h> | 14 #include <curses.h> |
15 #include "rogue.h" | 15 #include "rogue.h" |
16 | 16 |
17 #define GOLDGRP 1 | 17 #define GOLDGRP 1 |
18 | 18 |
19 void draw_room(struct room *rp); | |
20 void vert(struct room *rp, int startx); | |
21 void horiz(struct room *rp, int starty); | |
22 | |
19 /* | 23 /* |
20 * do_rooms: | 24 * do_rooms: |
21 * Create rooms and corridors with a connectivity graph | 25 * Create rooms and corridors with a connectivity graph |
22 */ | 26 */ |
23 do_rooms() | 27 void |
28 do_rooms(void) | |
24 { | 29 { |
25 register int i; | 30 register int i; |
26 register struct room *rp; | 31 register struct room *rp; |
27 register THING *tp; | 32 register THING *tp; |
28 register int left_out; | 33 register int left_out; |
118 | 123 |
119 /* | 124 /* |
120 * draw_room: | 125 * draw_room: |
121 * Draw a box around a room and lay down the floor | 126 * Draw a box around a room and lay down the floor |
122 */ | 127 */ |
123 draw_room(rp) | 128 void |
124 register struct room *rp; | 129 draw_room(struct room *rp) |
125 { | 130 { |
126 register int y, x; | 131 register int y, x; |
127 | 132 |
128 vert(rp, rp->r_pos.x); /* Draw left side */ | 133 vert(rp, rp->r_pos.x); /* Draw left side */ |
129 vert(rp, rp->r_pos.x + rp->r_max.x - 1); /* Draw right side */ | 134 vert(rp, rp->r_pos.x + rp->r_max.x - 1); /* Draw right side */ |
145 | 150 |
146 /* | 151 /* |
147 * vert: | 152 * vert: |
148 * Draw a vertical line | 153 * Draw a vertical line |
149 */ | 154 */ |
150 vert(rp, startx) | 155 void |
151 register struct room *rp; | 156 vert(struct room *rp, int startx) |
152 register int startx; | |
153 { | 157 { |
154 register int y; | 158 register int y; |
155 | 159 |
156 for (y = rp->r_pos.y + 1; y <= rp->r_max.y + rp->r_pos.y - 1; y++) | 160 for (y = rp->r_pos.y + 1; y <= rp->r_max.y + rp->r_pos.y - 1; y++) |
157 chat(y, startx) = '|'; | 161 chat(y, startx) = '|'; |
159 | 163 |
160 /* | 164 /* |
161 * horiz: | 165 * horiz: |
162 * Draw a horizontal line | 166 * Draw a horizontal line |
163 */ | 167 */ |
164 horiz(rp, starty) | 168 void |
165 register struct room *rp; | 169 horiz(struct room *rp, int starty) |
166 int starty; | |
167 { | 170 { |
168 register int x; | 171 register int x; |
169 | 172 |
170 for (x = rp->r_pos.x; x <= rp->r_pos.x + rp->r_max.x - 1; x++) | 173 for (x = rp->r_pos.x; x <= rp->r_pos.x + rp->r_max.x - 1; x++) |
171 chat(starty, x) = '-'; | 174 chat(starty, x) = '-'; |
173 | 176 |
174 /* | 177 /* |
175 * rnd_pos: | 178 * rnd_pos: |
176 * Pick a random spot in a room | 179 * Pick a random spot in a room |
177 */ | 180 */ |
178 rnd_pos(rp, cp) | 181 void |
179 register struct room *rp; | 182 rnd_pos(struct room *rp, coord *cp) |
180 register coord *cp; | |
181 { | 183 { |
182 cp->x = rp->r_pos.x + rnd(rp->r_max.x - 2) + 1; | 184 cp->x = rp->r_pos.x + rnd(rp->r_max.x - 2) + 1; |
183 cp->y = rp->r_pos.y + rnd(rp->r_max.y - 2) + 1; | 185 cp->y = rp->r_pos.y + rnd(rp->r_max.y - 2) + 1; |
184 } | 186 } |
185 | 187 |
186 /* | 188 /* |
187 * enter_room: | 189 * enter_room: |
188 * Code that is executed whenver you appear in a room | 190 * Code that is executed whenver you appear in a room |
189 */ | 191 */ |
190 enter_room(cp) | 192 void |
191 register coord *cp; | 193 enter_room(coord *cp) |
192 { | 194 { |
193 register struct room *rp; | 195 register struct room *rp; |
194 register int y, x; | 196 register int y, x; |
195 register THING *tp; | 197 register THING *tp; |
196 | 198 |
218 | 220 |
219 /* | 221 /* |
220 * leave_room: | 222 * leave_room: |
221 * Code for when we exit a room | 223 * Code for when we exit a room |
222 */ | 224 */ |
223 leave_room(cp) | 225 void |
224 register coord *cp; | 226 leave_room(coord *cp) |
225 { | 227 { |
226 register int y, x; | 228 register int y, x; |
227 register struct room *rp; | 229 register struct room *rp; |
228 register char floor; | 230 register char floor; |
229 register char ch; | 231 register char ch; |