Mercurial > hg > openttd
annotate src/goal_base.h @ 18782:d14680ee0033 draft
(svn r23630) -Add: a Goal GUI to show your current goals
author | truebrain <truebrain@openttd.org> |
---|---|
date | Mon, 19 Dec 2011 21:03:17 +0000 |
parents | |
children | c99e695378ce |
rev | line source |
---|---|
18782
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
2 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
3 /* |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
4 * This file is part of OpenTTD. |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
8 */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
9 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
10 /** @file goal_base.h Goal base class. */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
11 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
12 #ifndef GOAL_BASE_H |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
13 #define GOAL_BASE_H |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
14 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
15 #include "cargo_type.h" |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
16 #include "company_type.h" |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
17 #include "goal_type.h" |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
18 #include "core/pool_type.hpp" |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
19 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
20 typedef Pool<Goal, GoalID, 1, MAX_COMPANIES> GoalPool; |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
21 extern GoalPool _goal_pool; |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
22 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
23 /** Struct about subsidies, offered and awarded */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
24 struct Goal : GoalPool::PoolItem<&_goal_pool> { |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
25 CompanyByte company; ///< Goal is for a specific company; INVALID_COMPANY if it is global |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
26 GoalTypeByte type; ///< Type of the goal |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
27 GoalTypeID dst; ///< Index of type |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
28 char *text; ///< Text of the goal. |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
29 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
30 /** |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
31 * We need an (empty) constructor so struct isn't zeroed (as C++ standard states) |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
32 */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
33 FORCEINLINE Goal() { } |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
34 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
35 /** |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
36 * (Empty) destructor has to be defined else operator delete might be called with NULL parameter |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
37 */ |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
38 FORCEINLINE ~Goal() { free(this->text); } |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
39 }; |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
40 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
41 #define FOR_ALL_GOALS_FROM(var, start) FOR_ALL_ITEMS_FROM(Goal, goal_index, var, start) |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
42 #define FOR_ALL_GOALS(var) FOR_ALL_GOALS_FROM(var, 0) |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
43 |
d14680ee0033
(svn r23630) -Add: a Goal GUI to show your current goals
truebrain <truebrain@openttd.org>
parents:
diff
changeset
|
44 #endif /* GOAL_BASE_H */ |