OpenTTD Source: src/goal_base.h Source File

OpenTTD Source 15.0-beta1

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
17typedef Pool<Goal, GoalID, 64, 64000> GoalPool;
18extern GoalPool _goal_pool;
19
21 struct Goal : GoalPool::PoolItem<&_goal_pool> {
22 CompanyID company;
23 GoalType type;
24 GoalTypeID dst;
25 std::string text;
26 std::string progress;
27 bool completed;
28
32 inline Goal() { }
33
37 inline ~Goal() { }
38
39 static bool IsValidGoalDestination(CompanyID company, GoalType type, GoalTypeID dest);
40};
41
42#endif /* GOAL_BASE_H */
company_type.h
Types related to companies.
Owner
Owner
Enum for all companies/owners.
Definition company_type.h:18
goal_type.h
basic types related to goals
GoalType
GoalType
Types of goal destinations.
Definition goal_type.h:26
GoalTypeID
uint32_t GoalTypeID
Contains either tile, industry ID, town ID, company ID, or story page ID.
Definition goal_type.h:35
pool_type.hpp
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
Goal
Struct about goals, current and completed.
Definition goal_base.h:21
Goal::~Goal
~Goal()
(Empty) destructor has to be defined else operator delete might be called with nullptr parameter
Definition goal_base.h:37
Goal::completed
bool completed
Is the goal completed or not?
Definition goal_base.h:27
Goal::type
GoalType type
Type of the goal.
Definition goal_base.h:23
Goal::dst
GoalTypeID dst
Index of type.
Definition goal_base.h:24
Goal::text
std::string text
Text of the goal.
Definition goal_base.h:25
Goal::company
CompanyID company
Goal is for a specific company; INVALID_COMPANY if it is global.
Definition goal_base.h:22
Goal::progress
std::string progress
Progress text of the goal.
Definition goal_base.h:26
Goal::Goal
Goal()
We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
Definition goal_base.h:32
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:237
Pool
Base class for all pools.
Definition pool_type.hpp:80