Rework ChoosePylonPosition to simplify the loop
[openttd/fttd.git] / src / goal_base.h
blob4bdef546082a80c259120ec5bbfd756c51be36f7
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 /** Struct about goals, current and completed */
20 struct Goal : PooledItem <Goal, GoalID, 64, 64000> {
21 CompanyByte company; ///< Goal is for a specific company; INVALID_COMPANY if it is global
22 GoalTypeByte type; ///< Type of the goal
23 GoalTypeID dst; ///< Index of type
24 char *text; ///< Text of the goal.
25 char *progress; ///< Progress text of the goal.
26 bool completed; ///< Is the goal completed or not?
28 /**
29 * We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
31 inline Goal() { }
33 /**
34 * (Empty) destructor has to be defined else operator delete might be called with NULL parameter
36 inline ~Goal() { free(this->text); free(this->progress); }
39 #define FOR_ALL_GOALS_FROM(var, start) FOR_ALL_ITEMS_FROM(Goal, goal_index, var, start)
40 #define FOR_ALL_GOALS(var) FOR_ALL_GOALS_FROM(var, 0)
42 #endif /* GOAL_BASE_H */