# news_type.h

Go to the documentation of this file.

    00001 /* $Id: news_type.h 24843 2012-12-23 21:07:12Z frosch $ */
    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
    00123   NewsTypeData(const char *name, byte age, SoundFx sound) :
    00124     name(name),
    00125     age(age),
    00126     sound(sound)
    00127   {
    00128   }
    00129
    00130   NewsDisplay GetDisplay() const;
    00131 };
    00132
    00134 struct NewsItem {
    00135   NewsItem *prev;
    00136   NewsItem *next;
    00137   StringID string_id;
    00138   Date date;
    00139   NewsType type;
    00140   NewsFlag flags;
    00141
    00142   NewsReferenceType reftype1;
    00143   NewsReferenceType reftype2;
    00144   uint32 ref1;
    00145   uint32 ref2;
    00146
    00147   void *free_data;
    00148
    00149   ~NewsItem()
    00150   {
    00151     free(this->free_data);
    00152   }
    00153
    00154   uint64 params[10];
    00155 };
    00156
    00163 struct CompanyNewsInformation {
    00164   char company_name[64];
    00165   char president_name[64];
    00166   char other_company_name[64];
    00167
    00168   uint32 face;
    00169   byte colour;
    00170
    00171   void FillData(const struct Company *c, const struct Company *other = NULL);
    00172 };
    00173
    00174 #endif /* NEWS_TYPE_H */