]> git.stg.codes - stg.git/blob - include/stg/corp_conf.h
Added resetable corp conf.
[stg.git] / include / stg / corp_conf.h
1 /*
2  *    This program is free software; you can redistribute it and/or modify
3  *    it under the terms of the GNU General Public License as published by
4  *    the Free Software Foundation; either version 2 of the License, or
5  *    (at your option) any later version.
6  *
7  *    This program is distributed in the hope that it will be useful,
8  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *    GNU General Public License for more details.
11  *
12  *    You should have received a copy of the GNU General Public License
13  *    along with this program; if not, write to the Free Software
14  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16
17 /*
18  *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
19  */
20
21 #ifndef CORP_CONF_H
22 #define CORP_CONF_H
23
24 #include "resetable.h"
25
26 #include <string>
27
28 struct CORP_CONF
29 {
30 CORP_CONF() : name(), cash(0) {}
31 CORP_CONF(const std::string & n) : name(n), cash(0) {}
32 CORP_CONF(const std::string & n, double c) : name(n), cash(c) {}
33
34 std::string name;
35 double      cash;
36 };
37
38 struct CORP_CONF_RES
39 {
40 CORP_CONF_RES()
41     : name(), cash()
42 {}
43
44 CORP_CONF_RES & operator=(const CORP_CONF & conf)
45 {
46 name = conf.name;
47 cash = conf.cash;
48 return *this;
49 }
50
51 CORP_CONF GetData() const
52 {
53 CORP_CONF cc;
54 cc.name = name.data();
55 cc.cash = cash.data();
56 return cc;
57 }
58
59 RESETABLE<std::string> name;
60 RESETABLE<double>      cash;
61 };
62
63 inline
64 bool operator==(const CORP_CONF & a, const CORP_CONF & b)
65 {
66 return a.name == b.name;
67 }
68
69 #endif //CORP_CONF_H