OpenTTD Source 20250312-master-gcdcc6b491d
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#include "strings_type.h"
17
19extern GoalPool _goal_pool;
20
22struct Goal : GoalPool::PoolItem<&_goal_pool> {
23 CompanyID company = CompanyID::Invalid();
28 bool completed = false;
29
33 Goal() { }
35
39 ~Goal() { }
40
41 static bool IsValidGoalDestination(CompanyID company, GoalType type, GoalTypeID dest);
42};
43
44#endif /* GOAL_BASE_H */
Container for an encoded string, created by GetEncodedString.
Types related to companies.
basic types related to goals
GoalType
Types of goal destinations.
Definition goal_type.h:27
@ GT_NONE
Destination is not linked.
Definition goal_type.h:28
uint32_t GoalTypeID
Contains either tile, industry ID, town ID, company ID, or story page ID.
Definition goal_type.h:36
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
Types related to strings.
Struct about goals, current and completed.
Definition goal_base.h:22
~Goal()
(Empty) destructor has to be defined else operator delete might be called with nullptr parameter
Definition goal_base.h:39
EncodedString progress
Progress text of the goal.
Definition goal_base.h:27
EncodedString text
Text of the goal.
Definition goal_base.h:26
bool completed
Is the goal completed or not?
Definition goal_base.h:28
GoalType type
Type of the goal.
Definition goal_base.h:24
GoalTypeID dst
Index of type.
Definition goal_base.h:25
CompanyID company
Goal is for a specific company; CompanyID::Invalid() if it is global.
Definition goal_base.h:23
Goal()
We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
Definition goal_base.h:33
Base class for all PoolItems.
Base class for all pools.