(svn r21048) [1.0] -Backport from trunk:

- Change: Make it possible to make .tar.xz bundles (r21042)
- Fix: Do not let the resize button go past the bottom of the screen [FS#4176] (r21015)
- Fix: The detailed performance rating window could be too narrow [FS#4102] (r21010)
- Fix: For the compact notation 1.000.000k and 1.000M would be shown depending on the initial (and later rounded) value. Make everything that would round to 1.000.000k be drawn as 1.000M as well (r21009)
- Fix: Do not consider the text direction character when searching for missing glyphs (r21007)
This commit is contained in:
rubidium 2010-10-27 20:17:45 +00:00
parent c377b3f57a
commit c17be0f8f4
5 changed files with 36 additions and 5 deletions

View File

@ -139,6 +139,13 @@ bundle_lzma: bundle
$(Q)cd "$(BUNDLES_DIR)/.lzma" && tar --lzma -c$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.lzma" "$(BUNDLE_NAME)"
$(Q)rm -rf "$(BUNDLES_DIR)/.lzma"
bundle_xz: bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.xz'
$(Q)mkdir -p "$(BUNDLES_DIR)/.xz/$(BUNDLE_NAME)"
$(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.xz/$(BUNDLE_NAME)/"
$(Q)cd "$(BUNDLES_DIR)/.xz" && tar --xz -c$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.xz" "$(BUNDLE_NAME)"
$(Q)rm -rf "$(BUNDLES_DIR)/.xz"
bundle_lha: bundle
@echo '[BUNDLE] Creating $(BUNDLE_NAME).lha'
$(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)"

View File

@ -23,6 +23,7 @@
#include "gfx_func.h"
#include "sortlist_type.h"
#include "core/geometry_func.hpp"
#include "currency.h"
#include "table/strings.h"
#include "table/sprites.h"
@ -1234,8 +1235,24 @@ struct PerformanceRatingDetailWindow : Window {
/* At this number we are roughly at the max; it can become wider,
* but then you need at 1000 times more money. At that time you're
* not that interested anymore in the last few digits anyway. */
uint max = 999999999; // nine 9s
* not that interested anymore in the last few digits anyway.
* The 500 is because 999 999 500 to 999 999 999 are rounded to
* 1 000 M, and not 999 999 k. Use negative numbers to account for
* the negative income/amount of money etc. as well. */
int max = -(999999999 - 500);
/* Scale max for the display currency. Prior to rendering the value
* is converted into the display currency, which may cause it to
* raise significantly. We need to compensate for that since {{CURRCOMPACT}}
* is used, which can produce quite short renderings of very large
* values. Otherwise the calculated width could be too narrow.
* Note that it doesn't work if there was a currency with an exchange
* rate greater than max.
* When the currency rate is more than 1000, the 999 999 k becomes at
* least 999 999 M which roughly is equally long. Furthermore if the
* exchange rate is that high, 999 999 k is usually not enough anymore
* to show the different currency numbers. */
if (_currency->rate < 1000) max /= _currency->rate;
SetDParam(0, max);
SetDParam(1, max);
uint score_detail_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY).width;

View File

@ -381,7 +381,7 @@ struct GameOptionsWindow : Window {
case GOW_CURRENCY_DROPDOWN: // Currency
if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
this->opt->locale.currency = index;
MarkWholeScreenDirty();
ReInitAllWindows();
break;
case GOW_DISTANCE_DROPDOWN: // Measuring units

View File

@ -333,7 +333,9 @@ static char *FormatGenericCurrency(char *buff, const CurrencySpec *spec, Money n
/* for huge numbers, compact the number into k or M */
if (compact) {
if (number >= 1000000000) {
/* Take care of the 'k' rounding. Having 1 000 000 k
* and 1 000 M is inconsistent, so always use 1 000 M. */
if (number >= 1000000000 - 500) {
number = (number + 500000) / 1000000;
multiplier = "M";
} else if (number >= 1000000) {
@ -1549,7 +1551,7 @@ static bool FindMissingGlyphs(const char **str)
text++;
} else if (c == SCC_SETXY) {
text += 2;
} else if (IsPrintable(c) && c != '?' && GetGlyph(FS_NORMAL, c) == question_mark) {
} else if (IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(FS_NORMAL, c) == question_mark) {
/* The character is printable, but not in the normal font. This is the case we were testing for. */
return true;
}

View File

@ -1652,6 +1652,11 @@ static bool HandleWindowDragging()
if (w->resize.step_width == 0) x = 0;
if (w->resize.step_height == 0) y = 0;
/* Check the resize button won't go past the bottom of the screen */
if (w->top + w->height + y > _screen.height) {
y = _screen.height - w->height - w->top;
}
/* X and Y has to go by step.. calculate it.
* The cast to int is necessary else x/y are implicitly casted to
* unsigned int, which won't work. */