news_type.h

Go to the documentation of this file.
00001 /* $Id: news_type.h 19105 2010-02-12 16:42:29Z yexo $ */
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 NEWS_TYPE_H
00013 #define NEWS_TYPE_H
00014 
00015 #include "core/enum_type.hpp"
00016 #include "date_type.h"
00017 #include "strings_type.h"
00018 #include "sound_type.h"
00019 
00023 enum NewsType {
00024   NT_ARRIVAL_COMPANY, 
00025   NT_ARRIVAL_OTHER,   
00026   NT_ACCIDENT,        
00027   NT_COMPANY_INFO,    
00028   NT_INDUSTRY_OPEN,   
00029   NT_INDUSTRY_CLOSE,  
00030   NT_ECONOMY,         
00031   NT_INDUSTRY_COMPANY,
00032   NT_INDUSTRY_OTHER,  
00033   NT_INDUSTRY_NOBODY, 
00034   NT_ADVICE,          
00035   NT_NEW_VEHICLES,    
00036   NT_ACCEPTANCE,      
00037   NT_SUBSIDIES,       
00038   NT_GENERAL,         
00039   NT_END,             
00040 };
00041 
00045 enum NewsSubtype {
00046   NS_ARRIVAL_COMPANY,  
00047   NS_ARRIVAL_OTHER,    
00048   NS_ACCIDENT,         
00049   NS_COMPANY_TROUBLE,  
00050   NS_COMPANY_MERGER,   
00051   NS_COMPANY_BANKRUPT, 
00052   NS_COMPANY_NEW,      
00053   NS_INDUSTRY_OPEN,    
00054   NS_INDUSTRY_CLOSE,   
00055   NS_ECONOMY,          
00056   NS_INDUSTRY_COMPANY, 
00057   NS_INDUSTRY_OTHER,   
00058   NS_INDUSTRY_NOBODY,  
00059   NS_ADVICE,           
00060   NS_NEW_VEHICLES,     
00061   NS_ACCEPTANCE,       
00062   NS_SUBSIDIES,        
00063   NS_GENERAL,          
00064   NS_END,              
00065 };
00066 
00076 enum NewsReferenceType {
00077   NR_NONE,      
00078   NR_TILE,      
00079   NR_VEHICLE,   
00080   NR_STATION,   
00081   NR_INDUSTRY,  
00082   NR_TOWN,      
00083   NR_ENGINE     
00084 };
00085 
00090 enum NewsFlag {
00091   NFB_INCOLOUR       = 0, 
00092   NFB_NO_TRANSPARENT = 1, 
00093   NFB_SHADE          = 2, 
00094 
00095   NF_NONE           = 0,      
00096   NF_INCOLOUR       = 1 << 0, 
00097   NF_NO_TRANSPARENT = 1 << 1, 
00098   NF_SHADE          = 1 << 2, 
00099 };
00100 DECLARE_ENUM_AS_BIT_SET(NewsFlag);
00101 
00102 
00106 enum NewsDisplay {
00107   ND_OFF,        
00108   ND_SUMMARY,    
00109   ND_FULL,       
00110 };
00111 
00115 struct NewsTypeData {
00116   const char * const name;    
00117   const byte age;             
00118   const SoundFx sound;        
00119   NewsDisplay display;        
00120   const StringID description; 
00121 
00122   NewsTypeData(const char *name, byte age, SoundFx sound, StringID description) :
00123     name(name),
00124     age(age),
00125     sound(sound),
00126     display(ND_FULL),
00127     description(description)
00128   {
00129   }
00130 };
00131 
00132 struct NewsItem {
00133   NewsItem *prev;              
00134   NewsItem *next;              
00135   StringID string_id;          
00136   Date date;                   
00137   NewsSubtype subtype;         
00138   NewsFlag flags;              
00139 
00140   NewsReferenceType reftype1;  
00141   NewsReferenceType reftype2;  
00142   uint32 ref1;                 
00143   uint32 ref2;                 
00144 
00145   void *free_data;             
00146 
00147   ~NewsItem()
00148   {
00149     free(this->free_data);
00150   }
00151 
00152   uint64 params[10];
00153 };
00154 
00161 struct CompanyNewsInformation {
00162   char company_name[64];       
00163   char president_name[64];     
00164   char other_company_name[64]; 
00165 
00166   uint32 face; 
00167   byte colour; 
00168 
00169   void FillData(const struct Company *c, const struct Company *other = NULL);
00170 };
00171 
00172 #endif /* NEWS_TYPE_H */

Generated on Wed Feb 17 23:06:49 2010 for OpenTTD by  doxygen 1.6.1