# currency.h

Go to the documentation of this file.

    00001 /* $Id: currency.h 17248 2009-08-21 20:21:05Z rubidium $ */
    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 enum {
    00019   CF_NOEURO = 0,
    00020   CF_ISEURO = 1,
    00021   NUM_CURRENCY = 29,
    00022   CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1
    00023 };
    00024
    00025 struct CurrencySpec {
    00026   uint16 rate;
    00027   char separator[8];
    00028   Year to_euro;
    00029   char prefix[16];
    00030   char suffix[16];
    00040   byte symbol_pos;
    00041   StringID name;
    00042 };
    00043
    00044
    00045 extern CurrencySpec _currency_specs[NUM_CURRENCY];
    00046
    00047 /* XXX small hack, but makes the rest of the code a bit nicer to read */
    00048 #define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
    00049 #define _currency ((const CurrencySpec*)&_currency_specs[_game_mode == GM_MENU ? _settings_newgame.locale.currency : _settings_game.locale.currency])
    00050
    00051 uint GetMaskOfAllowedCurrencies();
    00052 void CheckSwitchToEuro();
    00053 void ResetCurrencies(bool preserve_custom = true);
    00054 StringID *BuildCurrencyDropdown();
    00055 byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
    00056
    00057 #endif /* CURRENCY_H */