]> git.pond.sub.org Git - empserver/blob - include/commodity.h
Generation numbers to catch write back of stale copies
[empserver] / include / commodity.h
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  commodity.h: Definitions for buy/market/sell commands in a time delay
29  *               market
30  *
31  *  Known contributors to this file:
32  *     Pat Loney, 1992
33  *     Steve McClure, 1996
34  */
35
36 #ifndef COMMODITY_H
37 #define COMMODITY_H
38
39 #include <time.h>
40 #include "types.h"
41 #include "item.h"
42
43 struct comstr {
44     /* initial part must match struct empobj */
45     signed ef_type: 8;
46     unsigned com_seqno: 12;
47     unsigned com_generation: 12;
48     int com_uid;
49     time_t com_timestamp;
50     natid com_owner;
51     /* end of part matching struct empobj */
52     i_type com_type;
53     int com_amount;
54     float com_price;
55     int com_maxbidder;
56     time_t com_markettime;
57     coord com_x;
58     coord com_y;
59     coord sell_x;
60     coord sell_y;
61 };
62
63 #define getcomm(n, p) ef_read(EF_COMM, (n), (p))
64 #define putcomm(n, p) ef_write(EF_COMM, (n), (p))
65
66 #endif