src/currency.h
author miham
Tue, 15 Jul 2008 23:27:28 +0000
changeset 11149 f3ff534dded8
parent 10835 976b9d25c2be
permissions -rw-r--r--
(svn r13707) -Update: WebTranslator2 update to 2008-07-16 01:21:36
brazilian_portuguese - 3 fixed by tucalipe (3)
bulgarian - 78 fixed, 230 changed by thetitan (3), groupsky (305)
catalan - 3 fixed by arnaullv (3)
dutch - 3 fixed by webfreakz (3)
italian - 3 changed by lorenzodv (3)
korean - 4 fixed, 5 changed by leejaeuk5 (9)
russian - 3 fixed by Smoky555 (3)
slovenian - 4 fixed by Necrolyte (4)
spanish - 3 fixed by eusebio (3)
swedish - 4 fixed by daishan (4)
ukrainian - 2 fixed by mad (2)
/* $Id$ */

/** @file currency.h Functions to handle different currencies. */

#ifndef CURRENCY_H
#define CURRENCY_H

#include "date_type.h"
#include "strings_type.h"

enum {
	CF_NOEURO = 0,
	CF_ISEURO = 1,
	NUM_CURRENCY = 28,
	CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1
};

struct CurrencySpec {
	uint16 rate;
	char separator;
	Year to_euro;
	char prefix[16];
	char suffix[16];
	/**
	 * The currency symbol is represented by two possible values, prefix and suffix
	 * Usage of one or the other is determined by symbol_pos.
	 * 0 = prefix
	 * 1 = suffix
	 * 2 = both : Special case only for custom currency.
	 *            It is not a spec from Newgrf,
	 *            rather a way to let users do what they want with custom curency
	 */
	byte symbol_pos;
	StringID name;
};


extern CurrencySpec _currency_specs[NUM_CURRENCY];

// XXX small hack, but makes the rest of the code a bit nicer to read
#define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
#define _currency ((const CurrencySpec*)&_currency_specs[_game_mode == GM_MENU ? _settings_newgame.locale.currency : _settings_game.locale.currency])

uint GetMaskOfAllowedCurrencies();
void CheckSwitchToEuro();
void ResetCurrencies(bool preserve_custom = true);
StringID* BuildCurrencyDropdown();
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);

#endif /* CURRENCY_H */