author | celestar |
Tue, 19 Jun 2007 07:21:01 +0000 | |
branch | gamebalance |
changeset 9913 | e79cd19772dd |
parent 9903 | dc85aaa556ae |
permissions | -rw-r--r-- |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
1 |
/* $Id$ */ |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
2 |
|
9888
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
3 |
/** |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
4 |
* @file economy_new.h |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
5 |
* Definition file for the economy of the game. |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
6 |
*/ |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
7 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
8 |
#ifndef ECONOMY_NEW_H |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
9 |
#define ECONOMY_NEW_H |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
10 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
11 |
#include "debug.h" // debug outputs |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
12 |
#include "fixedt.h" // FixedT data types |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
13 |
#include "date.h" // current year / date |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
14 |
#include "variables.h" // difficulty |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
15 |
#include "functions.h" // RandomRange |
9901
a922f277ebfd
(svn r9408) [gamebalance] -Feature: The new economic data is stored in the savegame from now on. I'll try to make sure that intra-branch compability is maintained in the future for easier testing. Newer trunk games (as soon as trunk bumps the saveload revision) will not load however.
celestar
parents:
9893
diff
changeset
|
16 |
#include "saveload.h" // Saveload stuff |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
17 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
18 |
/** |
9901
a922f277ebfd
(svn r9408) [gamebalance] -Feature: The new economic data is stored in the savegame from now on. I'll try to make sure that intra-branch compability is maintained in the future for easier testing. Newer trunk games (as soon as trunk bumps the saveload revision) will not load however.
celestar
parents:
9893
diff
changeset
|
19 |
* A Base Class used for economic entities in the game that use an activity level. |
9886
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
20 |
*/ |
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
21 |
class EconomicObject { |
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
22 |
protected: |
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
23 |
FixedT<int64, 16> m_activity_level; ///< Economic Activity Level, an indicator for the GDP per capita of the map |
9888
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
24 |
|
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
25 |
public: |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
26 |
/** |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
27 |
* Destructors for EconomicObjects. It is virtual because at least one of the methods |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
28 |
* (or member functions) is virtual; thus a non-virtual destructor will cause a |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
29 |
* compiler warning |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
30 |
*/ |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
31 |
virtual ~EconomicObject() {} |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
32 |
|
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
33 |
/** |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
34 |
* Used to set the activity level from outside |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
35 |
*/ |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
36 |
virtual void SetActivity() {} |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
37 |
|
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
38 |
/** |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
39 |
* Obtains the activity level of the object |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
40 |
* @return the economic activity |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
41 |
*/ |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
42 |
FixedT<int64, 16> GetActivity() const { return m_activity_level; } |
9886
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
43 |
}; |
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
44 |
|
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
45 |
/** |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
46 |
* Handles all the economic data and events |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
47 |
*/ |
9893
1f207c0b7345
(svn r9280) [gamebalance] -Feature: The amount of passengers and mail now depends on the activity of a town. Also note that the general scheme of how passengers (and mail) are generated has been changed: The amount now correlates linearly to the population of a house.
celestar
parents:
9888
diff
changeset
|
48 |
class CEconomy : public EconomicObject { |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
49 |
public: |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
50 |
/** |
9903
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
51 |
* Enumerator for the different costs for operations a player can perform. |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
52 |
* Should be used to access the array of prices. |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
53 |
*/ |
9903
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
54 |
enum Price { |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
55 |
STATION_VALUE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
56 |
PRICE_RAIL_BUILD, /**< Cost of placing a single piece of track (a vertical or horizontal one. |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
57 |
* @todo make sure the longer pieces of track cost a bit more |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
58 |
*/ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
59 |
BUILD_ROAD, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
60 |
BUILD_SIGNALS, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
61 |
BUILD_BRIDGE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
62 |
BUILD_TRAIN_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
63 |
BUILD_ROAD_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
64 |
BUILD_SHIP_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
65 |
BUILD_TUNNEL, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
66 |
TRAIN_STATION_TRACK, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
67 |
TRAIN_STATION_LENGTH, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
68 |
BUILD_AIRPORT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
69 |
BUILD_BUS_STATION, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
70 |
BUILD_TRUCK_STATION, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
71 |
BUILD_DOCK, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
72 |
BUILD_RAILVEHICLE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
73 |
BUILD_RAILWAGON, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
74 |
AIRCRAFT_BASE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
75 |
ROADVEH_BASE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
76 |
SHIP_BASE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
77 |
BUILD_TREES, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
78 |
TERRAFORM, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
79 |
CLEAR_1, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
80 |
PURCHASE_LAND, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
81 |
CLEAR_2, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
82 |
CLEAR_3, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
83 |
REMOVE_TREES, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
84 |
PRICE_RAIL_REMOVE, /**< cost for removing a piece of track. Less than for building because one |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
85 |
* might be able to reuse stuff |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
86 |
*/ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
87 |
REMOVE_SIGNALS, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
88 |
CLEAR_BRIDGE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
89 |
REMOVE_TRAIN_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
90 |
REMOVE_ROAD_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
91 |
REMOVE_SHIP_DEPOT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
92 |
CLEAR_TUNNEL, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
93 |
CLEAR_WATER, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
94 |
REMOVE_RAIL_STATION, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
95 |
REMOVE_AIRPORT, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
96 |
REMOVE_BUS_STATION, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
97 |
REMOVE_TRUCK_STATION, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
98 |
REMOVE_DOCK, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
99 |
REMOVE_HOUSE, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
100 |
REMOVE_ROAD, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
101 |
RUNNING_RAIL0, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
102 |
RUNNING_RAIL1, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
103 |
RUNNING_RAIL2, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
104 |
AIRCRAFT_RUNNING, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
105 |
ROADVEH_RUNNING, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
106 |
SHIP_RUNNING, |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
107 |
BUILD_INDUSTRY, |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
108 |
|
9903
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
109 |
MAX_PRICE ///< end marker; use with for loops and arrays for example |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
110 |
}; |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
111 |
|
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
112 |
|
9903
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
113 |
private: |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
114 |
FixedT<int32, 16> m_basic_growth; ///< Basic growth number, depends solely on difficulty setting |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
115 |
byte m_long_term_cycle; ///< The period of the long-term cycle suggested by Kondratiev |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
116 |
byte m_short_term_cycle; ///< The period of the short-term cycle (see Juglar, others) |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
117 |
FixedT<int32, 16> m_long_term_ampl; ///< Amplitude of the long-term cycle |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
118 |
FixedT<int32, 16> m_short_term_ampl; ///< Amplitude of the short-term cycle |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
119 |
|
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
120 |
FixedT<int32, 16> m_prices[MAX_PRICE]; ///< Cost of operations for the player. Positive for cost, negative for income |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
121 |
|
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
122 |
public: |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
123 |
CEconomy(); |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
124 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
125 |
/** |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
126 |
* Removes an economy. |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
127 |
*/ |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
128 |
~CEconomy() { |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
129 |
DEBUG(eco, 3, "Ending economy"); |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
130 |
} |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
131 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
132 |
/** |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
133 |
* Adjusts the economic settings on a yearly level. |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
134 |
*/ |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
135 |
void YearlyLoop() |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
136 |
{ |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
137 |
FixedT<int32, 16> growth = m_basic_growth; |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
138 |
growth += GetCyclicGrowth(); |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
139 |
DEBUG(eco, 3, "Entering the yearly loop for economy"); |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
140 |
m_activity_level *= growth; |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
141 |
DEBUG(eco, 4, "Set global EAL to %.3f", (double)m_activity_level); |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
142 |
} |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
143 |
|
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
144 |
/** |
9885
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
145 |
* Adds random events to the economic growth. This should call a random event every |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
146 |
* 20 months. Well at least it should if RandomRange would be distributed in a |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
147 |
* linear fashion. Note that there's one event in RandomEvents with a value of |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
148 |
* -100 that doesn't have a positive "partner". This one simulates a big crash |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
149 |
* or any other catastrohic event (war, disease, terrorism, whatever). |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
150 |
* @todo Add news events for higher modifications in the economy (=> 2%) |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
151 |
*/ |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
152 |
void MonthlyLoop() |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
153 |
{ |
9888
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
154 |
AdjustActivityByTowns(); |
9885
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
155 |
/* Modifications of the global economic activity one-tenth of a percent */ |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
156 |
static const int RandomEvents[] = {-1, 1, -2, 2, -5, 5, -10, 10, -12, 12, -15, 15, -20, 20, -25, 25, 32, -32, 50, -50, -100}; |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
157 |
/* I didn't use the 19, because it hardly ever is the return of RandomRange for whatever reason */ |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
158 |
if (RandomRange(20) != 18) return; |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
159 |
|
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
160 |
FixedT<int32, 16> mod( RandomEvents[RandomRange(lengthof(RandomEvents))], 1000); |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
161 |
mod += 1; |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
162 |
|
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
163 |
m_activity_level *= mod; |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
164 |
DEBUG(eco, 5, "Added a random event with a value of %f, adjusted EAL to %f", (double)mod, (double)m_activity_level); |
9888
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
165 |
|
9885
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
166 |
} |
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
167 |
|
9888
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
168 |
void AdjustActivityByTowns(); |
7cf72895ca8c
(svn r9152) [gamebalance] -Add: Towns now have an economic activity level so that poorer and richer towns can occur on the map
celestar
parents:
9886
diff
changeset
|
169 |
|
9901
a922f277ebfd
(svn r9408) [gamebalance] -Feature: The new economic data is stored in the savegame from now on. I'll try to make sure that intra-branch compability is maintained in the future for easier testing. Newer trunk games (as soon as trunk bumps the saveload revision) will not load however.
celestar
parents:
9893
diff
changeset
|
170 |
static const SaveLoad eco_desc[]; |
a922f277ebfd
(svn r9408) [gamebalance] -Feature: The new economic data is stored in the savegame from now on. I'll try to make sure that intra-branch compability is maintained in the future for easier testing. Newer trunk games (as soon as trunk bumps the saveload revision) will not load however.
celestar
parents:
9893
diff
changeset
|
171 |
|
9903
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
172 |
/** |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
173 |
* Saves and Loads the prices from the savegame |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
174 |
*/ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
175 |
void SaveLoad_PRIC() |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
176 |
{ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
177 |
uint16 dummy[MAX_PRICE]; |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
178 |
SlArray(m_prices, MAX_PRICE, SLE_INT32); |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
179 |
SlArray(dummy, MAX_PRICE, SLE_UINT16); |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
180 |
} |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
181 |
|
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
182 |
int32 GetPrice(Price operation, TileIndex tile = INVALID_TILE, bool release = false) const; |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
183 |
|
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
184 |
/** |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
185 |
* Manually sets the price of an operation, used while loading games |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
186 |
* @param operation The operation which to set the price for |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
187 |
* @param value The new price of the operation |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
188 |
*/ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
189 |
void SetPrice(int operation, int32 value) |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
190 |
{ |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
191 |
assert(operation < MAX_PRICE); |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
192 |
DEBUG(eco, 4, "Setting price of operation %d to %f", (int)operation, (double) value); |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
193 |
m_prices[operation] = value; |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
194 |
} |
dc85aaa556ae
(svn r9534) [gamebalance] -Codechange: Made the prices a member of the Economy and removed all global variables concerning prices (INCOMPLETE).
celestar
parents:
9901
diff
changeset
|
195 |
|
9886
67b675b827c1
(svn r9143) [gamebalance] -Codechange: Class housekeeping (make a member private) and put the activity level in a separate base class, because other entities like towns will need it as well.
celestar
parents:
9885
diff
changeset
|
196 |
private: |
9885
84104c79839f
(svn r9141) [gamebalance] -Add: Random events that can occur monthly and affect the economy as a whole (i.e. are not local to a town or industry)
celestar
parents:
9884
diff
changeset
|
197 |
/** |
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
198 |
* Computes the modification of economic growth by cyclic events |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
199 |
* @return The growth modification |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
200 |
*/ |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
201 |
FixedT<int32, 16> GetCyclicGrowth() const |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
202 |
{ |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
203 |
FixedT<int32, 16> long_term (PI * 2 * (_cur_year - 1800), m_long_term_cycle); |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
204 |
FixedT<int32, 16> short_term(PI * 2 * (_cur_year - 1800), m_short_term_cycle); |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
205 |
|
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
206 |
DEBUG(eco, 5, "Cyclic Growth is %.4f", (double)(m_long_term_ampl * cos(long_term) + m_short_term_ampl * cos(short_term))); |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
207 |
return ( m_long_term_ampl * cos(long_term) + m_short_term_ampl * cos(short_term) ); |
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
208 |
} |
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
209 |
}; |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
210 |
|
9884
c1169958d5ff
(svn r9139) [gamebalance] -Add: Cyclic Modifications to the economic activity based on the works of Kondratiev and Juglar
celestar
parents:
9883
diff
changeset
|
211 |
|
9881
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
212 |
extern CEconomy *_eco; |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
213 |
void InitializeEconomy(); |
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
214 |
|
fbb3eab0e186
(svn r9114) [gamebalance] -Add: Added the new economy, with the ability to adjust growth in the difficulty window. The economy doesn't do anything yet, it just exists.
celestar
parents:
diff
changeset
|
215 |
#endif /* ECONOMY_NEW_H */ |