goal_base.h

Go to the documentation of this file.
00001 /* $Id$ */
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 "cargo_type.h"
00016 #include "company_type.h"
00017 #include "goal_type.h"
00018 #include "core/pool_type.hpp"
00019 
00020 typedef Pool<Goal, GoalID, 1, MAX_COMPANIES> GoalPool;
00021 extern GoalPool _goal_pool;
00022 
00024 struct Goal : GoalPool::PoolItem<&_goal_pool> {
00025   CompanyByte company; 
00026   GoalTypeByte type;   
00027   GoalTypeID dst;      
00028   char *text;          
00029 
00033   inline Goal() { }
00034 
00038   inline ~Goal() { free(this->text); }
00039 };
00040 
00041 #define FOR_ALL_GOALS_FROM(var, start) FOR_ALL_ITEMS_FROM(Goal, goal_index, var, start)
00042 #define FOR_ALL_GOALS(var) FOR_ALL_GOALS_FROM(var, 0)
00043 
00044 #endif /* GOAL_BASE_H */