Mercurial > hg > early-roguelike
comparison srogue/trader.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 | 2128c7dc8a40 |
children | 0250220d8cdd |
comparison
equal
deleted
inserted
replaced
216:b24545357d2e | 217:94a0d9dd5ce1 |
---|---|
9 * | 9 * |
10 * See the file LICENSE.TXT for full copyright and licensing information. | 10 * See the file LICENSE.TXT for full copyright and licensing information. |
11 */ | 11 */ |
12 | 12 |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <string.h> | |
14 #include "rogue.h" | 15 #include "rogue.h" |
15 #include "rogue.ext" | 16 #include "rogue.ext" |
16 | 17 |
17 #define NOTPRICED -1 | 18 #define NOTPRICED -1 |
18 | 19 |
20 bool open_market(void); | |
21 void trans_line(void); | |
22 void draw_maze(void); | |
23 int findcells(int y, int x); | |
24 void rmwall(int newy, int newx, int oldy, int oldx); | |
25 void crankout(void); | |
26 | |
19 /* | 27 /* |
20 * do_post: | 28 * do_post: |
21 * Put a trading post room and stuff on the screen | 29 * Put a trading post room and stuff on the screen |
22 */ | 30 */ |
23 do_post() | 31 void |
32 do_post(void) | |
24 { | 33 { |
25 struct coord tp; | 34 struct coord tp; |
26 reg int i; | 35 reg int i; |
27 reg struct room *rp; | 36 reg struct room *rp; |
28 reg struct object *op; | 37 reg struct object *op; |
64 | 73 |
65 /* | 74 /* |
66 * price_it: | 75 * price_it: |
67 * Price the object that the hero stands on | 76 * Price the object that the hero stands on |
68 */ | 77 */ |
69 price_it() | 78 bool |
79 price_it(void) | |
70 { | 80 { |
71 static char *bargain[] = { | 81 static char *bargain[] = { |
72 "great bargain", | 82 "great bargain", |
73 "quality product", | 83 "quality product", |
74 "exceptional find", | 84 "exceptional find", |
98 | 108 |
99 /* | 109 /* |
100 * buy_it: | 110 * buy_it: |
101 * Buy the item on which the hero stands | 111 * Buy the item on which the hero stands |
102 */ | 112 */ |
103 buy_it() | 113 void |
114 buy_it(void) | |
104 { | 115 { |
105 reg int wh; | 116 reg int wh; |
106 | 117 |
107 if (purse <= 0) { | 118 if (purse <= 0) { |
108 msg("You have no money."); | 119 msg("You have no money."); |
149 | 160 |
150 /* | 161 /* |
151 * sell_it: | 162 * sell_it: |
152 * Sell an item to the trading post | 163 * Sell an item to the trading post |
153 */ | 164 */ |
154 sell_it() | 165 void |
166 sell_it(void) | |
155 { | 167 { |
156 reg struct linked_list *item; | 168 reg struct linked_list *item; |
157 reg struct object *obj; | 169 reg struct object *obj; |
158 reg int wo, ch; | 170 reg int wo, ch; |
159 | 171 |
197 | 209 |
198 /* | 210 /* |
199 * open_market: | 211 * open_market: |
200 * Retruns TRUE when ok do to transacting | 212 * Retruns TRUE when ok do to transacting |
201 */ | 213 */ |
202 open_market() | 214 bool |
215 open_market(void) | |
203 { | 216 { |
204 if (trader >= MAXPURCH) { | 217 if (trader >= MAXPURCH) { |
205 msg("The market is closed. The stairs are that-a-way."); | 218 msg("The market is closed. The stairs are that-a-way."); |
206 return FALSE; | 219 return FALSE; |
207 } | 220 } |
211 | 224 |
212 /* | 225 /* |
213 * get_worth: | 226 * get_worth: |
214 * Calculate an objects worth in gold | 227 * Calculate an objects worth in gold |
215 */ | 228 */ |
216 get_worth(obj) | 229 int |
217 struct object *obj; | 230 get_worth(struct object *obj) |
218 { | 231 { |
219 reg int worth, wh; | 232 reg int worth, wh; |
220 | 233 |
221 worth = 0; | 234 worth = 0; |
222 wh = obj->o_which; | 235 wh = obj->o_which; |
270 | 283 |
271 /* | 284 /* |
272 * trans_line: | 285 * trans_line: |
273 * Show how many transactions the hero has left | 286 * Show how many transactions the hero has left |
274 */ | 287 */ |
275 trans_line() | 288 void |
289 trans_line(void) | |
276 { | 290 { |
277 sprintf(prbuf,"You have %d transactions remaining.",MAXPURCH-trader); | 291 sprintf(prbuf,"You have %d transactions remaining.",MAXPURCH-trader); |
278 mvwaddstr(cw, LINES - 4, 0, prbuf); | 292 mvwaddstr(cw, LINES - 4, 0, prbuf); |
279 } | 293 } |
280 | 294 |
281 /* | 295 /* |
282 * domaze: | 296 * domaze: |
283 * Draw the maze on this level. | 297 * Draw the maze on this level. |
284 */ | 298 */ |
285 do_maze() | 299 void |
300 do_maze(void) | |
286 { | 301 { |
287 struct coord tp; | 302 struct coord tp; |
288 reg int i, least; | 303 reg int i, least; |
289 reg struct room *rp; | 304 reg struct room *rp; |
290 bool treas; | 305 bool treas; |
326 char num_pos; /* number of frontier cells next to you */ | 341 char num_pos; /* number of frontier cells next to you */ |
327 struct cell conn[4]; /* the y,x position of above cell */ | 342 struct cell conn[4]; /* the y,x position of above cell */ |
328 } mborder; | 343 } mborder; |
329 | 344 |
330 char *frontier, *bits; | 345 char *frontier, *bits; |
331 char *moffset(), *foffset(); | 346 char *moffset(int y, int x); |
347 char *foffset(int y, int x); | |
332 int tlines, tcols; | 348 int tlines, tcols; |
333 | 349 |
334 /* | 350 /* |
335 * draw_maze: | 351 * draw_maze: |
336 * Generate and draw the maze on the screen | 352 * Generate and draw the maze on the screen |
337 */ | 353 */ |
338 draw_maze() | 354 void |
355 draw_maze(void) | |
339 { | 356 { |
340 reg int i, j, more; | 357 reg int i, j, more; |
341 reg char *ptr; | 358 reg char *ptr; |
342 | 359 |
343 tlines = (LINES - 3) / 2; | 360 tlines = (LINES - 3) / 2; |
370 /* | 387 /* |
371 * moffset: | 388 * moffset: |
372 * Calculate memory address for bits | 389 * Calculate memory address for bits |
373 */ | 390 */ |
374 char * | 391 char * |
375 moffset(y, x) | 392 moffset(int y, int x) |
376 int y, x; | |
377 { | 393 { |
378 char *ptr; | 394 char *ptr; |
379 | 395 |
380 ptr = bits + (y * (COLS - 1)) + x; | 396 ptr = bits + (y * (COLS - 1)) + x; |
381 return ptr; | 397 return ptr; |
384 /* | 400 /* |
385 * foffset: | 401 * foffset: |
386 * Calculate memory address for frontier | 402 * Calculate memory address for frontier |
387 */ | 403 */ |
388 char * | 404 char * |
389 foffset(y, x) | 405 foffset(int y, int x) |
390 int y, x; | |
391 { | 406 { |
392 char *ptr; | 407 char *ptr; |
393 | 408 |
394 ptr = frontier + (y * tcols) + x; | 409 ptr = frontier + (y * tcols) + x; |
395 return ptr; | 410 return ptr; |
397 | 412 |
398 /* | 413 /* |
399 * findcells: | 414 * findcells: |
400 * Figure out cells to open up | 415 * Figure out cells to open up |
401 */ | 416 */ |
402 findcells(y,x) | 417 int |
403 int x, y; | 418 findcells(int y, int x) |
404 { | 419 { |
405 reg int rtpos, i; | 420 reg int rtpos, i; |
406 | 421 |
407 *foffset(y, x) = FALSE; | 422 *foffset(y, x) = FALSE; |
408 mborder.num_pos = 0; | 423 mborder.num_pos = 0; |
448 | 463 |
449 /* | 464 /* |
450 * rmwall: | 465 * rmwall: |
451 * Removes appropriate walls from the maze | 466 * Removes appropriate walls from the maze |
452 */ | 467 */ |
453 rmwall(newy, newx, oldy, oldx) | 468 void |
454 int newy, newx, oldy, oldx; | 469 rmwall(int newy, int newx, int oldy, int oldx) |
455 { | 470 { |
456 reg int xdif,ydif; | 471 reg int xdif,ydif; |
457 | 472 |
458 xdif = newx - oldx; | 473 xdif = newx - oldx; |
459 ydif = newy - oldy; | 474 ydif = newy - oldy; |
465 | 480 |
466 /* | 481 /* |
467 * crankout: | 482 * crankout: |
468 * Does actual drawing of maze to window | 483 * Does actual drawing of maze to window |
469 */ | 484 */ |
470 crankout() | 485 void |
486 crankout(void) | |
471 { | 487 { |
472 reg int x, y, i; | 488 reg int x, y, i; |
473 | 489 |
474 for (y = 0; y < LINES - 3; y++) { | 490 for (y = 0; y < LINES - 3; y++) { |
475 move(y + 1, 0); | 491 move(y + 1, 0); |