forked from tanglewoodforest/src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauction.h
More file actions
67 lines (53 loc) · 1.45 KB
/
auction.h
File metadata and controls
67 lines (53 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef twf_auction_h
#define twf_auction_h
extern auction_array auction_list;
class auction_data: public thing_data
{
public:
pfile_data* seller;
pfile_data* buyer;
int bid;
int proxy;
int time;
int slot;
bool deleted;
auction_data( pfile_data *pfile )
: seller(pfile), buyer(0),
bid(0), proxy(0), time(50),
slot(1), deleted(false)
{
record_new( sizeof( auction_data ), MEM_AUCTION );
valid = AUCTION_DATA;
auction_list += this;
seller->auction += this;
}
virtual ~auction_data( ) {
record_delete( sizeof( auction_data ), MEM_AUCTION );
auction_list -= this;
if( seller )
seller->auction -= this;
}
/*
* From visible_data and thing_data:
*/
virtual int Type ( ) const
{ return AUCTION_DATA; }
virtual void Look_At ( char_data* )
{ return; }
virtual const char *Location ( Content_Array* = 0 )
{ return "auction block"; }
int minimum_bid( ) const {
if( !buyer && !deleted )
return bid;
return max( 21*bid/20, bid+5 );
}
void add_time( ) {
if( time < 30 )
time = max( 5, time+2 );
}
};
int free_balance ( player_data*, auction_data* = 0 );
void clear_auction ( pfile_data* = 0 );
void auction_message ( char_data* );
void auction_update ( void );
#endif // twf_auction_h