OpenTTD
goal_base.h
Go to the documentation of this file.
1 /* $Id: goal_base.h 25299 2013-05-27 21:59:11Z zuu $ */
2 
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  */
9 
12 #ifndef GOAL_BASE_H
13 #define GOAL_BASE_H
14 
15 #include "company_type.h"
16 #include "goal_type.h"
17 #include "core/pool_type.hpp"
18 
20 extern GoalPool _goal_pool;
21 
23 struct Goal : GoalPool::PoolItem<&_goal_pool> {
27  char *text;
28  char *progress;
29  bool completed;
30 
34  inline Goal() { }
35 
39  inline ~Goal() { free(this->text); free(this->progress); }
40 };
41 
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)
44 
45 #endif /* GOAL_BASE_H */
Struct about goals, current and completed.
Definition: goal_base.h:23
Goal()
We need an (empty) constructor so struct isn&#39;t zeroed (as C++ standard states)
Definition: goal_base.h:34
Defintion of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle...
GoalTypeID dst
Index of type.
Definition: goal_base.h:26
~Goal()
(Empty) destructor has to be defined else operator delete might be called with NULL parameter ...
Definition: goal_base.h:39
GoalTypeByte type
Type of the goal.
Definition: goal_base.h:25
basic types related to goals
Base class for all PoolItems.
Definition: pool_type.hpp:146
Base class for all pools.
Definition: pool_type.hpp:83
CompanyByte company
Goal is for a specific company; INVALID_COMPANY if it is global.
Definition: goal_base.h:24
char * progress
Progress text of the goal.
Definition: goal_base.h:28
bool completed
Is the goal completed or not?
Definition: goal_base.h:29
Types related to companies.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Definition: depend.cpp:114
char * text
Text of the goal.
Definition: goal_base.h:27
uint32 GoalTypeID
Contains either tile, industry ID, town ID or company ID (or INVALID_GOALTYPE)
Definition: goal_type.h:31