# 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
    00058 enum NewsSubtype {
    00059   NS_ARRIVAL_COMPANY,
    00060   NS_ARRIVAL_OTHER,
    00061   NS_ACCIDENT,
    00062   NS_COMPANY_TROUBLE,
    00063   NS_COMPANY_MERGER,
    00064   NS_COMPANY_BANKRUPT,
    00065   NS_COMPANY_NEW,
    00066   NS_INDUSTRY_OPEN,
    00067   NS_INDUSTRY_CLOSE,
    00068   NS_ECONOMY,
    00069   NS_INDUSTRY_COMPANY,
    00070   NS_INDUSTRY_OTHER,
    00071   NS_INDUSTRY_NOBODY,
    00072   NS_ADVICE,
    00073   NS_NEW_VEHICLES,
    00074   NS_ACCEPTANCE,
    00075   NS_SUBSIDIES,
    00076   NS_GENERAL,
    00077   NS_END,
    00078 };
    00079
    00089 enum NewsReferenceType {
    00090   NR_NONE,
    00091   NR_TILE,
    00092   NR_VEHICLE,
    00093   NR_STATION,
    00094   NR_INDUSTRY,
    00095   NR_TOWN,
    00096   NR_ENGINE,
    00097 };
    00098
    00103 enum NewsFlag {
    00104   NFB_INCOLOUR       = 0,
    00105   NFB_NO_TRANSPARENT = 1,
    00106   NFB_SHADE          = 2,
    00107
    00108   NF_NONE           = 0,
    00109   NF_INCOLOUR       = 1 << 0,
    00110   NF_NO_TRANSPARENT = 1 << 1,
    00111   NF_SHADE          = 1 << 2,
    00112 };
    00113 DECLARE_ENUM_AS_BIT_SET(NewsFlag)
    00114
    00115
    00116
    00119 enum NewsDisplay {
    00120   ND_OFF,
    00121   ND_SUMMARY,
    00122   ND_FULL,
    00123 };
    00124
    00128 struct NewsTypeData {
    00129   const char * const name;
    00130   const byte age;
    00131   const SoundFx sound;
    00132   NewsDisplay display;
    00133   const StringID description;
    00134
    00142   NewsTypeData(const char *name, byte age, SoundFx sound, NewsDisplay display, StringID description) :
    00143     name(name),
    00144     age(age),
    00145     sound(sound),
    00146     display(display),
    00147     description(description)
    00148   {
    00149   }
    00150 };
    00151
    00153 struct NewsItem {
    00154   NewsItem *prev;
    00155   NewsItem *next;
    00156   StringID string_id;
    00157   Date date;
    00158   NewsSubtype subtype;
    00159   NewsFlag flags;
    00160
    00161   NewsReferenceType reftype1;
    00162   NewsReferenceType reftype2;
    00163   uint32 ref1;
    00164   uint32 ref2;
    00165
    00166   void *free_data;
    00167
    00168   ~NewsItem()
    00169   {
    00170     free(this->free_data);
    00171   }
    00172
    00173   uint64 params[10];
    00174 };
    00175
    00182 struct CompanyNewsInformation {
    00183   char company_name[64];
    00184   char president_name[64];
    00185   char other_company_name[64];
    00186
    00187   uint32 face;
    00188   byte colour;
    00189
    00190   void FillData(const struct Company *c, const struct Company *other = NULL);
    00191 };
    00192
    00193 #endif /* NEWS_TYPE_H */