(svn r27950) -Merge: Documentation updates from 1.7 branch
[openttd.git] / src / goal_base.h
blob7453196c8ecd314e3a177a612bd051cc4fa6f1b5
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
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.
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.
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/>.
8 */
10 /** @file goal_base.h %Goal base class. */
12 #ifndef GOAL_BASE_H
13 #define GOAL_BASE_H
15 #include "company_type.h"
16 #include "goal_type.h"
17 #include "core/pool_type.hpp"
19 typedef Pool<Goal, GoalID, 64, 64000> GoalPool;
20 extern GoalPool _goal_pool;
22 /** Struct about goals, current and completed */
23 struct Goal : GoalPool::PoolItem<&_goal_pool> {
24 CompanyByte company; ///< Goal is for a specific company; INVALID_COMPANY if it is global
25 GoalTypeByte type; ///< Type of the goal
26 GoalTypeID dst; ///< Index of type
27 char *text; ///< Text of the goal.
28 char *progress; ///< Progress text of the goal.
29 bool completed; ///< Is the goal completed or not?
31 /**
32 * We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
34 inline Goal() { }
36 /**
37 * (Empty) destructor has to be defined else operator delete might be called with NULL parameter
39 inline ~Goal() { free(this->text); free(this->progress); }
42 #define FOR_ALL_GOALS_FROM(var, start) FOR_ALL_ITEMS_FROM(Goal, goal_index, var, start)
43 #define FOR_ALL_GOALS(var) FOR_ALL_GOALS_FROM(var, 0)
45 #endif /* GOAL_BASE_H */