news_type.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 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 
00021 enum MessageOptionsSpace {
00022   MOS_WIDG_PER_SETTING      = 4,  
00023 
00024   MOS_LEFT_EDGE             = 6,  
00025   MOS_COLUMN_SPACING        = 4,  
00026   MOS_RIGHT_EDGE            = 6,  
00027   MOS_BUTTON_SPACE          = 10, 
00028 
00029   MOS_ABOVE_GLOBAL_SETTINGS = 6,  
00030   MOS_BOTTOM_EDGE           = 6,  
00031 };
00032 
00036 enum NewsType {
00037   NT_ARRIVAL_COMPANY, 
00038   NT_ARRIVAL_OTHER,   
00039   NT_ACCIDENT,        
00040   NT_COMPANY_INFO,    
00041   NT_INDUSTRY_OPEN,   
00042   NT_INDUSTRY_CLOSE,  
00043   NT_ECONOMY,         
00044   NT_INDUSTRY_COMPANY,
00045   NT_INDUSTRY_OTHER,  
00046   NT_INDUSTRY_NOBODY, 
00047   NT_ADVICE,          
00048   NT_NEW_VEHICLES,    
00049   NT_ACCEPTANCE,      
00050   NT_SUBSIDIES,       
00051   NT_GENERAL,         
00052   NT_END,             
00053 };
00054 
00064 enum NewsReferenceType {
00065   NR_NONE,      
00066   NR_TILE,      
00067   NR_VEHICLE,   
00068   NR_STATION,   
00069   NR_INDUSTRY,  
00070   NR_TOWN,      
00071   NR_ENGINE,    
00072 };
00073 
00078 enum NewsFlag {
00079   NFB_INCOLOUR       = 0,                      
00080   NFB_NO_TRANSPARENT = 1,                      
00081   NFB_SHADE          = 2,                      
00082   NFB_WINDOW_LAYOUT  = 3,                      
00083   NFB_WINDOW_LAYOUT_COUNT = 3,                 
00084   NFB_VEHICLE_PARAM0 = 6,                      
00085 
00086   NF_INCOLOUR       = 1 << NFB_INCOLOUR,       
00087   NF_NO_TRANSPARENT = 1 << NFB_NO_TRANSPARENT, 
00088   NF_SHADE          = 1 << NFB_SHADE,          
00089   NF_VEHICLE_PARAM0 = 1 << NFB_VEHICLE_PARAM0, 
00090 
00091   NF_THIN           = 0 << NFB_WINDOW_LAYOUT,  
00092   NF_SMALL          = 1 << NFB_WINDOW_LAYOUT,  
00093   NF_NORMAL         = 2 << NFB_WINDOW_LAYOUT,  
00094   NF_VEHICLE        = 3 << NFB_WINDOW_LAYOUT,  
00095   NF_COMPANY        = 4 << NFB_WINDOW_LAYOUT,  
00096 };
00097 DECLARE_ENUM_AS_BIT_SET(NewsFlag)
00098 
00099 
00100 
00103 enum NewsDisplay {
00104   ND_OFF,        
00105   ND_SUMMARY,    
00106   ND_FULL,       
00107 };
00108 
00112 struct NewsTypeData {
00113   const char * const name;    
00114   const byte age;             
00115   const SoundFx sound;        
00116   NewsDisplay display;        
00117   const StringID description; 
00118 
00126   NewsTypeData(const char *name, byte age, SoundFx sound, NewsDisplay display, StringID description) :
00127     name(name),
00128     age(age),
00129     sound(sound),
00130     display(display),
00131     description(description)
00132   {
00133   }
00134 };
00135 
00137 struct NewsItem {
00138   NewsItem *prev;              
00139   NewsItem *next;              
00140   StringID string_id;          
00141   Date date;                   
00142   NewsType type;               
00143   NewsFlag flags;              
00144 
00145   NewsReferenceType reftype1;  
00146   NewsReferenceType reftype2;  
00147   uint32 ref1;                 
00148   uint32 ref2;                 
00149 
00150   void *free_data;             
00151 
00152   ~NewsItem()
00153   {
00154     free(this->free_data);
00155   }
00156 
00157   uint64 params[10]; 
00158 };
00159 
00166 struct CompanyNewsInformation {
00167   char company_name[64];       
00168   char president_name[64];     
00169   char other_company_name[64]; 
00170 
00171   uint32 face; 
00172   byte colour; 
00173 
00174   void FillData(const struct Company *c, const struct Company *other = NULL);
00175 };
00176 
00177 #endif /* NEWS_TYPE_H */