OpenTTD Source  12.0-beta2
goal_base.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef GOAL_BASE_H
11 #define GOAL_BASE_H
12 
13 #include "company_type.h"
14 #include "goal_type.h"
15 #include "core/pool_type.hpp"
16 
18 extern GoalPool _goal_pool;
19 
21 struct Goal : GoalPool::PoolItem<&_goal_pool> {
25  char *text;
26  char *progress;
27  bool completed;
28 
32  inline Goal() { }
33 
37  inline ~Goal() { free(this->text); free(this->progress); }
38 };
39 
40 #endif /* GOAL_BASE_H */
Goal
Struct about goals, current and completed.
Definition: goal_base.h:21
goal_type.h
Goal::dst
GoalTypeID dst
Index of type.
Definition: goal_base.h:24
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
Goal::Goal
Goal()
We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
Definition: goal_base.h:32
Goal::~Goal
~Goal()
(Empty) destructor has to be defined else operator delete might be called with nullptr parameter
Definition: goal_base.h:37
Goal::progress
char * progress
Progress text of the goal.
Definition: goal_base.h:26
Pool
Base class for all pools.
Definition: pool_type.hpp:81
Goal::completed
bool completed
Is the goal completed or not?
Definition: goal_base.h:27
Goal::company
CompanyID company
Goal is for a specific company; INVALID_COMPANY if it is global.
Definition: goal_base.h:22
GoalTypeID
uint32 GoalTypeID
Contains either tile, industry ID, town ID or company ID (or INVALID_GOALTYPE)
Definition: goal_type.h:35
pool_type.hpp
GoalType
GoalType
Types of goal destinations.
Definition: goal_type.h:26
free
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Definition: stdafx.h:460
Pool::PoolItem
Base class for all PoolItems.
Definition: pool_type.hpp:234
Goal::type
GoalType type
Type of the goal.
Definition: goal_base.h:23
company_type.h
Goal::text
char * text
Text of the goal.
Definition: goal_base.h:25