currency.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 CURRENCY_H
00013 #define CURRENCY_H
00014 
00015 #include "date_type.h"
00016 #include "strings_type.h"
00017 
00018 static const int CF_NOEURO = 0; 
00019 static const int CF_ISEURO = 1; 
00020 
00026 enum Currencies {
00027   CURRENCY_GBP,       
00028   CURRENCY_USD,       
00029   CURRENCY_EUR,       
00030   CURRENCY_JPY,       
00031   CURRENCY_ATS,       
00032   CURRENCY_BEF,       
00033   CURRENCY_CHF,       
00034   CURRENCY_CZK,       
00035   CURRENCY_DEM,       
00036   CURRENCY_DKK,       
00037   CURRENCY_ESP,       
00038   CURRENCY_FIM,       
00039   CURRENCY_FRF,       
00040   CURRENCY_GRD,       
00041   CURRENCY_HUF,       
00042   CURRENCY_ISK,       
00043   CURRENCY_ITL,       
00044   CURRENCY_NLG,       
00045   CURRENCY_NOK,       
00046   CURRENCY_PLN,       
00047   CURRENCY_RON,       
00048   CURRENCY_RUR,       
00049   CURRENCY_SIT,       
00050   CURRENCY_SEK,       
00051   CURRENCY_YTL,       
00052   CURRENCY_SKK,       
00053   CURRENCY_BRL,       
00054   CURRENCY_EEK,       
00055   CURRENCY_LTL,       
00056   CURRENCY_KRW,       
00057   CURRENCY_ZAR,       
00058   CURRENCY_CUSTOM,    
00059   CURRENCY_GEL,       
00060   CURRENCY_IRR,       
00061   CURRENCY_END,       
00062 };
00063 
00065 struct CurrencySpec {
00066   uint16 rate;
00067   char separator[8];
00068   Year to_euro;      
00069   char prefix[16];
00070   char suffix[16];
00080   byte symbol_pos;
00081   StringID name;
00082 };
00083 
00084 extern CurrencySpec _currency_specs[CURRENCY_END];
00085 
00086 /* XXX small hack, but makes the rest of the code a bit nicer to read */
00087 #define _custom_currency (_currency_specs[CURRENCY_CUSTOM])
00088 #define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
00089 
00090 uint64 GetMaskOfAllowedCurrencies();
00091 void CheckSwitchToEuro();
00092 void ResetCurrencies(bool preserve_custom = true);
00093 StringID *BuildCurrencyDropdown();
00094 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
00095 
00096 #endif /* CURRENCY_H */