equal
deleted
inserted
replaced
126 |
126 |
127 /** |
127 /** |
128 * get a mask of the allowed currencies depending on the year |
128 * get a mask of the allowed currencies depending on the year |
129 * @return mask of currencies |
129 * @return mask of currencies |
130 */ |
130 */ |
131 uint GetMaskOfAllowedCurrencies(void) |
131 uint GetMaskOfAllowedCurrencies() |
132 { |
132 { |
133 uint mask = 0; |
133 uint mask = 0; |
134 uint i; |
134 uint i; |
135 |
135 |
136 for (i = 0; i < NUM_CURRENCY; i++) { |
136 for (i = 0; i < NUM_CURRENCY; i++) { |
145 } |
145 } |
146 |
146 |
147 /** |
147 /** |
148 * Verify if the currency chosen by the user is about to be converted to Euro |
148 * Verify if the currency chosen by the user is about to be converted to Euro |
149 **/ |
149 **/ |
150 void CheckSwitchToEuro(void) |
150 void CheckSwitchToEuro() |
151 { |
151 { |
152 if (_currency_specs[_opt.currency].to_euro != CF_NOEURO && |
152 if (_currency_specs[_opt.currency].to_euro != CF_NOEURO && |
153 _currency_specs[_opt.currency].to_euro != CF_ISEURO && |
153 _currency_specs[_opt.currency].to_euro != CF_ISEURO && |
154 _cur_year >= _currency_specs[_opt.currency].to_euro) { |
154 _cur_year >= _currency_specs[_opt.currency].to_euro) { |
155 _opt.currency = 2; // this is the index of euro above. |
155 _opt.currency = 2; // this is the index of euro above. |
159 |
159 |
160 /** |
160 /** |
161 * Called only from newgrf.c. Will fill _currency_specs array with |
161 * Called only from newgrf.c. Will fill _currency_specs array with |
162 * default values from origin_currency_specs |
162 * default values from origin_currency_specs |
163 **/ |
163 **/ |
164 void ResetCurrencies(void) |
164 void ResetCurrencies() |
165 { |
165 { |
166 memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs)); |
166 memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs)); |
167 } |
167 } |
168 |
168 |
169 /** |
169 /** |
170 * Build a list of currency names StringIDs to use in a dropdown list |
170 * Build a list of currency names StringIDs to use in a dropdown list |
171 * @return Pointer to a (static) array of StringIDs |
171 * @return Pointer to a (static) array of StringIDs |
172 */ |
172 */ |
173 StringID* BuildCurrencyDropdown(void) |
173 StringID* BuildCurrencyDropdown() |
174 { |
174 { |
175 /* Allow room for all currencies, plus a terminator entry */ |
175 /* Allow room for all currencies, plus a terminator entry */ |
176 static StringID names[CUSTOM_CURRENCY_ID]; |
176 static StringID names[NUM_CURRENCY + 1]; |
177 uint i; |
177 uint i; |
178 |
178 |
179 /* Add each name */ |
179 /* Add each name */ |
180 for (i = 0; i < NUM_CURRENCY; i++) { |
180 for (i = 0; i < NUM_CURRENCY; i++) { |
181 names[i] = _currency_specs[i].name; |
181 names[i] = _currency_specs[i].name; |