comparison arogue7/trader.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 adfa37e67084
children ad2570b5b21f
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
14 14
15 /* 15 /*
16 * Anything to do with trading posts 16 * Anything to do with trading posts
17 */ 17 */
18 18
19 #include <ctype.h>
20 #include <string.h>
19 #include "curses.h" 21 #include "curses.h"
20 #include "rogue.h" 22 #include "rogue.h"
21 23
22 24 bool open_market(void);
23 25 void trans_line(void);
26 char *typ_name(struct object *obj);
24 27
25 28
26 /* 29 /*
27 * buy_it: 30 * buy_it:
28 * Buy the item on which the hero stands 31 * Buy the item on which the hero stands
29 */ 32 */
30 buy_it() 33 void
34 buy_it(void)
31 { 35 {
32 reg int wh; 36 reg int wh;
33 struct linked_list *item; 37 struct linked_list *item;
34 38
35 if (purse <= 0) { 39 if (purse <= 0) {
77 } 81 }
78 82
79 /* 83 /*
80 * do_post: 84 * do_post:
81 * Put a trading post room and stuff on the screen 85 * Put a trading post room and stuff on the screen
82 */ 86 * startup: True if equipping the player at the beginning of the game
83 do_post(startup) 87 */
84 bool startup; /* True if equipping the player at the beginning of the game */ 88 void
89 do_post(bool startup)
85 { 90 {
86 coord tp; 91 coord tp;
87 reg int i, j, k; 92 reg int i, j, k;
88 reg struct room *rp; 93 reg struct room *rp;
89 reg struct object *op; 94 reg struct object *op;
320 325
321 /* 326 /*
322 * get_worth: 327 * get_worth:
323 * Calculate an objects worth in gold 328 * Calculate an objects worth in gold
324 */ 329 */
325 get_worth(obj) 330 int
326 reg struct object *obj; 331 get_worth(struct object *obj)
327 { 332 {
328 reg int worth, wh; 333 reg int worth, wh;
329 334
330 worth = 0; 335 worth = 0;
331 wh = obj->o_which; 336 wh = obj->o_which;
391 396
392 /* 397 /*
393 * open_market: 398 * open_market:
394 * Retruns TRUE when ok do to transacting 399 * Retruns TRUE when ok do to transacting
395 */ 400 */
396 open_market() 401 bool
402 open_market(void)
397 { 403 {
398 if (trader >= MAXPURCH && !wizard && level != 0) { 404 if (trader >= MAXPURCH && !wizard && level != 0) {
399 msg("The market is closed. The stairs are that-a-way."); 405 msg("The market is closed. The stairs are that-a-way.");
400 return FALSE; 406 return FALSE;
401 } 407 }
406 412
407 /* 413 /*
408 * price_it: 414 * price_it:
409 * Price the object that the hero stands on 415 * Price the object that the hero stands on
410 */ 416 */
411 price_it() 417 bool
418 price_it(void)
412 { 419 {
413 reg struct linked_list *item; 420 reg struct linked_list *item;
414 reg struct object *obj; 421 reg struct object *obj;
415 reg int worth; 422 reg int worth;
416 reg char *str; 423 reg char *str;
443 450
444 /* 451 /*
445 * sell_it: 452 * sell_it:
446 * Sell an item to the trading post 453 * Sell an item to the trading post
447 */ 454 */
448 sell_it() 455 void
456 sell_it(void)
449 { 457 {
450 reg struct linked_list *item; 458 reg struct linked_list *item;
451 reg struct object *obj; 459 reg struct object *obj;
452 reg int wo, ch; 460 reg int wo, ch;
453 461
489 497
490 /* 498 /*
491 * trans_line: 499 * trans_line:
492 * Show how many transactions the hero has left 500 * Show how many transactions the hero has left
493 */ 501 */
494 trans_line() 502 void
503 trans_line(void)
495 { 504 {
496 if (level == 0) 505 if (level == 0)
497 sprintf(prbuf, "You are welcome to spend whatever you have."); 506 sprintf(prbuf, "You are welcome to spend whatever you have.");
498 else if (!wizard) 507 else if (!wizard)
499 sprintf(prbuf,"You have %d transactions remaining.", 508 sprintf(prbuf,"You have %d transactions remaining.",
509 /* 518 /*
510 * typ_name: 519 * typ_name:
511 * Return the name for this type of object 520 * Return the name for this type of object
512 */ 521 */
513 char * 522 char *
514 typ_name(obj) 523 typ_name(struct object *obj)
515 reg struct object *obj;
516 { 524 {
517 static char buff[20]; 525 static char buff[20];
518 reg int wh; 526 reg int wh;
519 527
520 switch (obj->o_type) { 528 switch (obj->o_type) {