2011-12-19 21:03:17 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2012-01-01 17:22:32 +00:00
|
|
|
/** @file goal_base.h %Goal base class. */
|
2011-12-19 21:03:17 +00:00
|
|
|
|
|
|
|
#ifndef GOAL_BASE_H
|
|
|
|
#define GOAL_BASE_H
|
|
|
|
|
|
|
|
#include "company_type.h"
|
|
|
|
#include "goal_type.h"
|
|
|
|
#include "core/pool_type.hpp"
|
|
|
|
|
2013-05-27 21:59:11 +00:00
|
|
|
typedef Pool<Goal, GoalID, 64, 64000> GoalPool;
|
2011-12-19 21:03:17 +00:00
|
|
|
extern GoalPool _goal_pool;
|
|
|
|
|
2013-05-26 19:54:43 +00:00
|
|
|
/** Struct about goals, current and completed */
|
2011-12-19 21:03:17 +00:00
|
|
|
struct Goal : GoalPool::PoolItem<&_goal_pool> {
|
2019-04-22 08:10:04 +00:00
|
|
|
CompanyID company; ///< Goal is for a specific company; INVALID_COMPANY if it is global
|
2019-04-22 12:20:24 +00:00
|
|
|
GoalType type; ///< Type of the goal
|
2019-04-22 08:10:04 +00:00
|
|
|
GoalTypeID dst; ///< Index of type
|
|
|
|
char *text; ///< Text of the goal.
|
|
|
|
char *progress; ///< Progress text of the goal.
|
|
|
|
bool completed; ///< Is the goal completed or not?
|
2011-12-19 21:03:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* We need an (empty) constructor so struct isn't zeroed (as C++ standard states)
|
|
|
|
*/
|
2011-12-20 17:57:56 +00:00
|
|
|
inline Goal() { }
|
2011-12-19 21:03:17 +00:00
|
|
|
|
|
|
|
/**
|
2019-04-10 21:07:06 +00:00
|
|
|
* (Empty) destructor has to be defined else operator delete might be called with nullptr parameter
|
2011-12-19 21:03:17 +00:00
|
|
|
*/
|
2013-05-26 19:54:43 +00:00
|
|
|
inline ~Goal() { free(this->text); free(this->progress); }
|
2011-12-19 21:03:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GOAL_BASE_H */
|