goal_base.h

Go to the documentation of this file.
00001 /* $Id: goal_base.h 25299 2013-05-27 21:59:11Z zuu $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef GOAL_BASE_H
00013 #define GOAL_BASE_H
00014 
00015 #include "company_type.h"
00016 #include "goal_type.h"
00017 #include "core/pool_type.hpp"
00018 
00019 typedef Pool<Goal, GoalID, 64, 64000> GoalPool;
00020 extern GoalPool _goal_pool;
00021 
00023 struct Goal : GoalPool::PoolItem<&_goal_pool> {
00024   CompanyByte company; 
00025   GoalTypeByte type;   
00026   GoalTypeID dst;      
00027   char *text;          
00028   char *progress;      
00029   bool completed;      
00030 
00034   inline Goal() { }
00035 
00039   inline ~Goal() { free(this->text); free(this->progress); }
00040 };
00041 
00042 #define FOR_ALL_GOALS_FROM(var, start) FOR_ALL_ITEMS_FROM(Goal, goal_index, var, start)
00043 #define FOR_ALL_GOALS(var) FOR_ALL_GOALS_FROM(var, 0)
00044 
00045 #endif /* GOAL_BASE_H */