currency.h

Go to the documentation of this file.
00001 /* $Id: currency.h 21695 2011-01-02 00:34:21Z 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 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 static const uint NUM_CURRENCY = 29;
00021 static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1;
00022 
00023 struct CurrencySpec {
00024   uint16 rate;
00025   char separator[8];
00026   Year to_euro;
00027   char prefix[16];
00028   char suffix[16];
00038   byte symbol_pos;
00039   StringID name;
00040 };
00041 
00042 
00043 extern CurrencySpec _currency_specs[NUM_CURRENCY];
00044 
00045 /* XXX small hack, but makes the rest of the code a bit nicer to read */
00046 #define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
00047 #define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
00048 
00049 uint GetMaskOfAllowedCurrencies();
00050 void CheckSwitchToEuro();
00051 void ResetCurrencies(bool preserve_custom = true);
00052 StringID *BuildCurrencyDropdown();
00053 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
00054 
00055 #endif /* CURRENCY_H */