From 140b4f73aa4fedc61b15cbbf3ab7eb9b8ebb90e1 Mon Sep 17 00:00:00 2001 From: Daniel Trujillo Date: Fri, 24 Jun 2016 08:44:54 +0200 Subject: [PATCH] Add other-than-selected currency support to format_currency_2dp This commit adds support for formatting currency strings using other than the selected currency. --- src/localisation/localisation.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index 7d95ea4822..18113cf7bb 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -476,9 +476,9 @@ void format_currency(char **dest, long long value) } } -void format_currency_2dp(char **dest, long long value) +void format_any_currency_2dp(char **dest, long long value, int currencyIndex) { - const currency_descriptor *currencyDesc = &CurrencyDescriptors[gConfigGeneral.currency_format]; + const currency_descriptor *currencyDesc = &CurrencyDescriptors[currencyIndex]; int rate = currencyDesc->rate; value *= rate; @@ -517,6 +517,11 @@ void format_currency_2dp(char **dest, long long value) } } +void format_currency_2dp(char **dest, long long value) +{ + format_any_currency_2dp(dest, value, gConfigGeneral.currency_format); +} + void format_date(char **dest, uint16 value) { uint16 args[] = { date_get_month(value), date_get_year(value) + 1 };