townname_type.h

Go to the documentation of this file.
00001 /* $Id: townname_type.h 26313 2014-02-06 21:06:59Z rubidium $ */
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 
00015 #ifndef TOWNNAME_TYPE_H
00016 #define TOWNNAME_TYPE_H
00017 
00018 #include "newgrf_townname.h"
00019 #include "town_type.h"
00020 #include <set>
00021 #include <string>
00022 
00023 typedef std::set<std::string> TownNames;
00024 
00029 struct TownNameParams {
00030   uint32 grfid; 
00031   uint16 type;  
00032 
00037   TownNameParams(byte town_name)
00038   {
00039     extern int _nb_orig_names;
00040     bool grf = town_name >= _nb_orig_names;
00041     this->grfid = grf ? GetGRFTownNameId(town_name - _nb_orig_names) : 0;
00042     this->type = grf ? GetGRFTownNameType(town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + town_name;
00043   }
00044 
00045   TownNameParams(const Town *t);
00046 };
00047 
00048 #endif /* TOWNNAME_TYPE_H */