Merge branch 'enhanced_viewport_overlay-sx' into jgrpp

This commit is contained in:
Jonathan G Rennison
2015-08-11 21:41:58 +01:00
54 changed files with 6143 additions and 355 deletions

View File

@@ -45,7 +45,7 @@ struct CompanyInfrastructure {
}
};
typedef Pool<Company, CompanyByte, 1, MAX_COMPANIES> CompanyPool;
typedef Pool<Company, CompanyID, 1, MAX_COMPANIES> CompanyPool;
extern CompanyPool _company_pool;

View File

@@ -121,7 +121,7 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index)
item = (Titem *)MallocT<byte>(size);
}
this->data[index] = item;
item->index = (uint)index;
item->index = (Tindex)(uint)index;
return item;
}

View File

@@ -196,9 +196,9 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
# include <ft2build.h>
# include FT_FREETYPE_H
#endif /* WITH_FREETYPE */
#ifdef WITH_ICU
#if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT)
# include <unicode/uversion.h>
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT || WITH_ICU_LAYOUT */
#ifdef WITH_LZMA
# include <lzma.h>
#endif
@@ -241,14 +241,19 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
buffer += seprintf(buffer, last, " FreeType: %d.%d.%d\n", major, minor, patch);
#endif /* WITH_FREETYPE */
#ifdef WITH_ICU
#if defined(WITH_ICU_LAYOUT) || defined(WITH_ICU_SORT)
/* 4 times 0-255, separated by dots (.) and a trailing '\0' */
char buf[4 * 3 + 3 + 1];
UVersionInfo ver;
u_getVersion(ver);
u_versionToString(ver, buf);
buffer += seprintf(buffer, last, " ICU: %s\n", buf);
#endif /* WITH_ICU */
#ifdef WITH_ICU_SORT
buffer += seprintf(buffer, last, " ICU i18n: %s\n", buf);
#endif
#ifdef WITH_ICU_LAYOUT
buffer += seprintf(buffer, last, " ICU lx: %s\n", buf);
#endif
#endif /* WITH_ICU_SORT || WITH_ICU_LAYOUT */
#ifdef WITH_LZMA
buffer += seprintf(buffer, last, " LZMA: %s\n", lzma_version_string());

View File

@@ -186,7 +186,7 @@ static inline void GfxDoDrawLine(void *video, int x, int y, int x2, int y2, int
int grade_x = x2 - x;
/* Clipping rectangle. Slightly extended so we can ignore the width of the line. */
uint extra = CeilDiv(3 * width, 4); // not less then "width * sqrt(2) / 2"
int extra = (int)CeilDiv(3 * width, 4); // not less then "width * sqrt(2) / 2"
Rect clip = { -extra, -extra, screen_width - 1 + extra, screen_height - 1 + extra };
/* prevent integer overflows. */
@@ -586,7 +586,7 @@ int GetStringLineCount(StringID str, int maxw)
*/
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
{
Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)};
Dimension box = {suggestion.width, (uint)GetStringHeight(str, suggestion.width)};
return box;
}
@@ -598,7 +598,7 @@ Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestio
*/
Dimension GetStringMultiLineBoundingBox(const char *str, const Dimension &suggestion)
{
Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)};
Dimension box = {suggestion.width, (uint)GetStringHeight(str, suggestion.width)};
return box;
}

View File

@@ -17,9 +17,9 @@
#include "table/control_codes.h"
#ifdef WITH_ICU
#ifdef WITH_ICU_LAYOUT
#include <unicode/ustring.h>
#endif /* WITH_ICU */
#endif /* WITH_ICU_LAYOUT */
#include "safeguards.h"
@@ -42,7 +42,7 @@ Font::Font(FontSize size, TextColour colour) :
assert(size < FS_END);
}
#ifdef WITH_ICU
#ifdef WITH_ICU_LAYOUT
/* Implementation details of LEFontInstance */
le_int32 Font::getUnitsPerEM() const
@@ -213,7 +213,7 @@ static ParagraphLayouter *GetParagraphLayout(UChar *buff, UChar *buff_end, FontM
return new ICUParagraphLayout(p);
}
#endif /* WITH_ICU */
#endif /* WITH_ICU_LAYOUT */
/*** Paragraph layout ***/
/**
@@ -654,7 +654,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
line.layout->Reflow();
} else {
/* Line is new, layout it */
#ifdef WITH_ICU
#ifdef WITH_ICU_LAYOUT
FontState old_state = state;
const char *old_str = str;

View File

@@ -19,12 +19,12 @@
#include <map>
#include <string>
#ifdef WITH_ICU
#ifdef WITH_ICU_LAYOUT
#include "layout/ParagraphLayout.h"
#define ICU_FONTINSTANCE : public LEFontInstance
#else /* WITH_ICU */
#else /* WITH_ICU_LAYOUT */
#define ICU_FONTINSTANCE
#endif /* WITH_ICU */
#endif /* WITH_ICU_LAYOUT */
/**
* Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
@@ -75,7 +75,7 @@ public:
Font(FontSize size, TextColour colour);
#ifdef WITH_ICU
#ifdef WITH_ICU_LAYOUT
/* Implementation details of LEFontInstance */
le_int32 getUnitsPerEM() const;
@@ -91,7 +91,7 @@ public:
LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
#endif /* WITH_ICU */
#endif /* WITH_ICU_LAYOUT */
};
/** Mapping from index to font. */

View File

@@ -13,9 +13,9 @@
#define LANGUAGE_H
#include "core/smallvec_type.hpp"
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
#include <unicode/coll.h>
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
static const uint8 CASE_GENDER_LEN = 16; ///< The (maximum) length of a case/gender string.
static const uint8 MAX_NUM_GENDERS = 8; ///< Maximum number of supported genders.
@@ -110,9 +110,9 @@ extern LanguageList _languages;
/** The currently loaded language. */
extern const LanguageMetadata *_current_language;
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
extern Collator *_current_collator;
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
bool ReadLanguagePack(const LanguageMetadata *lang);
const LanguageMetadata *GetLanguage(byte newgrflangid);

View File

@@ -25,7 +25,12 @@ int32 SimpleCountedObject::Release()
int32 res = --m_ref_cnt;
assert(res >= 0);
if (res == 0) {
FinalRelease();
try {
FinalRelease(); // may throw, for example ScriptTest/ExecMode
} catch (...) {
delete this;
throw;
}
delete this;
}
return res;

View File

@@ -832,7 +832,7 @@ Point QueryString::GetCaretPosition(const Window *w, int wid) const
int delta = min(0, (right - left) - tb->pixels - 10);
if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs;
Point pt = {left + WD_FRAMERECT_LEFT + tb->caretxoffs + delta, wi->pos_y + WD_FRAMERECT_TOP};
Point pt = {left + WD_FRAMERECT_LEFT + tb->caretxoffs + delta, (int)wi->pos_y + WD_FRAMERECT_TOP};
return pt;
}

View File

@@ -22,6 +22,7 @@
#include "dmusic.h"
#include <windows.h>
#undef FACILITY_DIRECTMUSIC // Needed for newer Windows SDK version.
#include <dmksctrl.h>
#include <dmusici.h>
#include <dmusicc.h>

View File

@@ -223,7 +223,7 @@ struct NewGRFParametersWindow : public Window {
case WID_NP_DESCRIPTION:
/* Minimum size of 4 lines. The 500 is the default size of the window. */
Dimension suggestion = {500 - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT, FONT_HEIGHT_NORMAL * 4 + WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM};
Dimension suggestion = {500 - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT, (uint)FONT_HEIGHT_NORMAL * 4 + WD_TEXTPANEL_TOP + WD_TEXTPANEL_BOTTOM};
for (uint i = 0; i < this->grf_config->param_info.Length(); i++) {
const GRFParameterInfo *par_info = this->grf_config->param_info[i];
if (par_info == NULL) continue;

View File

@@ -322,7 +322,9 @@ static char *PrintModuleInfo(char *output, const char *last, HMODULE mod)
}
#if defined(_MSC_VER)
#pragma warning(disable:4091)
#include <dbghelp.h>
#pragma warning(default:4091)
char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) const
{

View File

@@ -233,7 +233,7 @@ static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, u
p2 |= ddir << 6; // Set the DiagDirecion into p2 bits 6 and 7.
TileArea ta(start_tile, end_tile);
CommandContainer cmdcont = { ta.tile, ta.w | ta.h << 8, p2, cmd, CcRoadStop, 0, "" };
CommandContainer cmdcont = { ta.tile, (uint32)(ta.w | ta.h << 8), p2, cmd, CcRoadStop, 0, "" };
ShowSelectStationIfNeeded(cmdcont, ta);
}

View File

@@ -30,7 +30,7 @@ ScriptExecMode::ScriptExecMode()
this->SetDoCommandMode(&ScriptExecMode::ModeProc, this);
}
ScriptExecMode::~ScriptExecMode()
void ScriptExecMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
@@ -38,5 +38,9 @@ ScriptExecMode::~ScriptExecMode()
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
}
}
}
ScriptExecMode::~ScriptExecMode()
{
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

View File

@@ -46,6 +46,8 @@ public:
* in when the instance was created.
*/
~ScriptExecMode();
virtual void FinalRelease();
};
#endif /* SCRIPT_EXECMODE_HPP */

View File

@@ -371,8 +371,8 @@ static bool NormaliseTileOffset(int32 *tile)
if (!::IsValidTile(tile) || !::IsValidTile(start) || !::IsValidTile(end)) return -1;
if (::DistanceManhattan(tile, start) != 1 || ::DistanceManhattan(tile, end) != 1) return -1;
/* ROAD_NW ROAD_SW ROAD_SE ROAD_NE */
static const TileIndex neighbours[] = {::TileDiffXY(0, -1), ::TileDiffXY(1, 0), ::TileDiffXY(0, 1), ::TileDiffXY(-1, 0)};
/* ROAD_NW ROAD_SW ROAD_SE ROAD_NE */
static const TileIndexDiff neighbours[] = {::TileDiffXY(0, -1), ::TileDiffXY(1, 0), ::TileDiffXY(0, 1), ::TileDiffXY(-1, 0)};
Array *existing = (Array*)alloca(sizeof(Array) + lengthof(neighbours) * sizeof(int32));
existing->size = 0;

View File

@@ -30,7 +30,7 @@ ScriptTestMode::ScriptTestMode()
this->SetDoCommandMode(&ScriptTestMode::ModeProc, this);
}
ScriptTestMode::~ScriptTestMode()
void ScriptTestMode::FinalRelease()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the script already died. */
@@ -38,5 +38,9 @@ ScriptTestMode::~ScriptTestMode()
throw Script_FatalError("Testmode object was removed while it was not the latest *Mode object created.");
}
}
}
ScriptTestMode::~ScriptTestMode()
{
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

View File

@@ -48,6 +48,8 @@ public:
* in when the instance was created.
*/
~ScriptTestMode();
virtual void FinalRelease();
};
#endif /* SCRIPT_TESTMODE_HPP */

View File

@@ -1950,13 +1950,13 @@ struct GameSettingsWindow : Window {
if (this->warn_missing != WHR_NONE) {
const int left = panel->pos_x;
const int right = left + panel->current_x - 1;
const int top = panel->pos_y;
const int top = panel->pos_y + WD_FRAMETEXT_TOP + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) * this->warn_lines / 2;
SetDParam(0, _game_settings_restrict_dropdown[this->filter.min_cat]);
if (this->warn_lines == 1) {
/* If the warning fits at one line, center it. */
DrawString(left + WD_FRAMETEXT_LEFT, right - WD_FRAMETEXT_RIGHT, top + WD_FRAMETEXT_TOP, warn_str, TC_FROMSTRING, SA_HOR_CENTER);
DrawString(left + WD_FRAMETEXT_LEFT, right - WD_FRAMETEXT_RIGHT, top, warn_str, TC_FROMSTRING, SA_HOR_CENTER);
} else {
DrawStringMultiLine(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top + WD_FRAMERECT_TOP, INT32_MAX, warn_str);
DrawStringMultiLine(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, INT32_MAX, warn_str, TC_FROMSTRING, SA_HOR_CENTER);
}
}
}
@@ -2010,7 +2010,7 @@ struct GameSettingsWindow : Window {
{
switch (widget) {
case WID_GS_OPTIONSPANEL: {
int top_pos = r.top + SETTINGTREE_TOP_OFFSET + 1 + this->warn_lines * FONT_HEIGHT_NORMAL;
int top_pos = r.top + SETTINGTREE_TOP_OFFSET + 1 + this->warn_lines * SETTING_HEIGHT;
uint last_row = this->vscroll->GetPosition() + this->vscroll->GetCapacity() - this->warn_lines;
int next_row = GetSettingsTree().Draw(settings_ptr, r.left + SETTINGTREE_LEFT_OFFSET, r.right - SETTINGTREE_RIGHT_OFFSET, top_pos,
this->vscroll->GetPosition(), last_row, this->last_clicked);

View File

@@ -268,7 +268,7 @@ struct SignListWindow : Window, SignList {
Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
resize->height = max<uint>(FONT_HEIGHT_NORMAL, spr_dim.height);
Dimension d = {this->text_offset + WD_FRAMETEXT_RIGHT, WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM};
Dimension d = {(uint)(this->text_offset + WD_FRAMETEXT_RIGHT), WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM};
*size = maxdim(*size, d);
break;
}

View File

@@ -982,7 +982,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
_heightmap_schemes[n].height_colours = ReallocT<uint32>(_heightmap_schemes[n].height_colours, heights);
for (int z = 0; z < heights; z++) {
uint access_index = (_heightmap_schemes[n].colour_count * z) / heights;
size_t access_index = (_heightmap_schemes[n].colour_count * z) / heights;
/* Choose colour by mapping the range (0..max heightlevel) on the complete colour table. */
_heightmap_schemes[n].height_colours[z] = _heightmap_schemes[n].height_colours_base[access_index];
@@ -1307,7 +1307,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt)
case WID_SM_ZOOM_IN:
case WID_SM_ZOOM_OUT: {
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
Point pt = {wid->current_x / 2, wid->current_y / 2};
Point pt = { (int)wid->current_x / 2, (int)wid->current_y / 2};
this->SetZoomLevel((widget == WID_SM_ZOOM_IN) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt);
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
break;

View File

@@ -1412,7 +1412,7 @@ struct StationViewWindow : public Window {
if (!this->IsShaded()) {
/* Draw 'accepted cargo' or 'cargo ratings'. */
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SV_ACCEPT_RATING_LIST);
const Rect r = {wid->pos_x, wid->pos_y, wid->pos_x + wid->current_x - 1, wid->pos_y + wid->current_y - 1};
const Rect r = {(int)wid->pos_x, (int)wid->pos_y, (int)(wid->pos_x + wid->current_x - 1), (int)(wid->pos_y + wid->current_y - 1)};
if (this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
int lines = this->DrawAcceptedCargo(r);
if (lines > this->accepts_lines) { // Resize the widget, and perform re-initialization of the window.
@@ -1440,7 +1440,7 @@ struct StationViewWindow : public Window {
/* Draw waiting cargo. */
NWidgetBase *nwi = this->GetWidget<NWidgetBase>(WID_SV_WAITING);
Rect waiting_rect = {nwi->pos_x, nwi->pos_y, nwi->pos_x + nwi->current_x - 1, nwi->pos_y + nwi->current_y - 1};
Rect waiting_rect = { (int)nwi->pos_x, (int)nwi->pos_y, (int)(nwi->pos_x + nwi->current_x - 1), (int)(nwi->pos_y + nwi->current_y - 1)};
this->DrawEntries(&cargo, waiting_rect, pos, maxrows, 0);
scroll_to_row = INT_MAX;
}

View File

@@ -223,7 +223,9 @@
#include <malloc.h> // alloca()
#define NORETURN __declspec(noreturn)
#define inline __forceinline
#if (_MSC_VER < 1900)
#define inline __forceinline
#endif
#if !defined(WINCE)
#define CDECL _cdecl

View File

@@ -378,7 +378,7 @@ static int TranslateArgumentIdx(int arg, int offset = 0);
static void EmitWordList(Buffer *buffer, const char * const *words, uint nw)
{
buffer->AppendByte(nw);
for (uint i = 0; i < nw; i++) buffer->AppendByte((uint)strlen(words[i]) + 1);
for (uint i = 0; i < nw; i++) buffer->AppendByte((byte)strlen(words[i]) + 1);
for (uint i = 0; i < nw; i++) {
for (uint j = 0; words[i][j] != '\0'; j++) buffer->AppendByte(words[i][j]);
buffer->AppendByte(0);

View File

@@ -25,12 +25,12 @@
#include <errno.h> // required by vsnprintf implementation for MSVC
#endif
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
/* Required by strnatcmp. */
#include <unicode/ustring.h>
#include "language.h"
#include "gfx_func.h"
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
/* The function vsnprintf is used internally to perform the required formatting
* tasks. As such this one must be allowed, and makes sure it's terminated. */
@@ -355,7 +355,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter)
}
#ifdef WIN32
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
/**
* Almost POSIX compliant implementation of \c vsnprintf for VC compiler.
* The difference is in the value returned on output truncation. This
@@ -578,33 +578,20 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
s1 = SkipGarbage(s1);
s2 = SkipGarbage(s2);
}
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
if (_current_collator != NULL) {
UErrorCode status = U_ZERO_ERROR;
int result;
/* We want to use the new faster method for ICU 4.2 and higher. */
#if U_ICU_VERSION_MAJOR_NUM > 4 || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 2)
/* The StringPiece parameter gets implicitly constructed from the char *. */
result = _current_collator->compareUTF8(s1, s2, status);
#else /* The following for 4.0 and lower. */
UChar buffer1[DRAW_STRING_BUFFER];
u_strFromUTF8Lenient(buffer1, lengthof(buffer1), NULL, s1, -1, &status);
UChar buffer2[DRAW_STRING_BUFFER];
u_strFromUTF8Lenient(buffer2, lengthof(buffer2), NULL, s2, -1, &status);
result = _current_collator->compare(buffer1, buffer2, status);
#endif /* ICU version check. */
int result = _current_collator->compareUTF8(s1, s2, status);
if (U_SUCCESS(status)) return result;
}
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
/* Do a normal comparison if ICU is missing or if we cannot create a collator. */
return strcasecmp(s1, s2);
}
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
#include <unicode/utext.h>
#include <unicode/brkiter.h>

View File

@@ -49,9 +49,9 @@ const LanguageMetadata *_current_language = NULL; ///< The currently loaded lang
TextDirection _current_text_dir; ///< Text direction of the currently selected language.
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
Collator *_current_collator = NULL; ///< Collator for the language currently in use.
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
static uint64 _global_string_params_data[20]; ///< Global array of string parameters. To access, use #SetDParam.
static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_decode_parameters
@@ -1334,7 +1334,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (c == NULL) break;
if (c->name != NULL) {
int64 args_array[] = {(uint64)(size_t)c->name};
int64 args_array[] = {(int64)(size_t)c->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1360,7 +1360,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
case SCC_DEPOT_NAME: { // {DEPOT}
VehicleType vt = (VehicleType)args->GetInt32(SCC_DEPOT_NAME);
if (vt == VEH_AIRCRAFT) {
uint64 args_array[] = {args->GetInt32()};
uint64 args_array[] = {(uint64)args->GetInt32()};
WChar types_array[] = {SCC_STATION_NAME};
StringParameters tmp_params(args_array, 1, types_array);
buff = GetStringWithArgs(buff, STR_FORMAT_DEPOT_NAME_AIRCRAFT, &tmp_params, last);
@@ -1369,7 +1369,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
const Depot *d = Depot::Get(args->GetInt32());
if (d->name != NULL) {
int64 args_array[] = {(uint64)(size_t)d->name};
int64 args_array[] = {(int64)(size_t)d->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1385,7 +1385,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (e == NULL) break;
if (e->name != NULL && e->IsEnabled()) {
int64 args_array[] = {(uint64)(size_t)e->name};
int64 args_array[] = {(int64)(size_t)e->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1400,7 +1400,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (g == NULL) break;
if (g->name != NULL) {
int64 args_array[] = {(uint64)(size_t)g->name};
int64 args_array[] = {(int64)(size_t)g->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1437,7 +1437,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (c == NULL) break;
if (c->president_name != NULL) {
int64 args_array[] = {(uint64)(size_t)c->president_name};
int64 args_array[] = {(int64)(size_t)c->president_name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1462,7 +1462,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
}
if (st->name != NULL) {
int64 args_array[] = {(uint64)(size_t)st->name};
int64 args_array[] = {(int64)(size_t)st->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1491,7 +1491,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (t == NULL) break;
if (t->name != NULL) {
int64 args_array[] = {(uint64)(size_t)t->name};
int64 args_array[] = {(int64)(size_t)t->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1505,7 +1505,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (wp == NULL) break;
if (wp->name != NULL) {
int64 args_array[] = {(uint64)(size_t)wp->name};
int64 args_array[] = {(int64)(size_t)wp->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1523,7 +1523,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (v == NULL) break;
if (v->name != NULL) {
int64 args_array[] = {(uint64)(size_t)v->name};
int64 args_array[] = {(int64)(size_t)v->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1549,7 +1549,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
if (si == NULL) break;
if (si->name != NULL) {
int64 args_array[] = {(uint64)(size_t)si->name};
int64 args_array[] = {(int64)(size_t)si->name};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else {
@@ -1849,7 +1849,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
strecpy(_config_language_file, c_file, lastof(_config_language_file));
SetCurrentGrfLangID(_current_language->newgrflangid);
#ifdef WITH_ICU
#ifdef WITH_ICU_SORT
/* Delete previous collator. */
if (_current_collator != NULL) {
delete _current_collator;
@@ -1866,7 +1866,7 @@ bool ReadLanguagePack(const LanguageMetadata *lang)
delete _current_collator;
_current_collator = NULL;
}
#endif /* WITH_ICU */
#endif /* WITH_ICU_SORT */
/* Some lists need to be sorted again after a language change. */
ReconsiderGameScriptLanguage();
@@ -2191,7 +2191,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
/* Update the font with cache */
LoadStringWidthTable(searcher->Monospace());
#if !defined(WITH_ICU)
#if !defined(WITH_ICU_LAYOUT)
/*
* For right-to-left languages we need the ICU library. If
* we do not have support for that library we warn the user
@@ -2211,5 +2211,5 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
SetDParamStr(0, err_str);
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
}
#endif
#endif /* !WITH_ICU_LAYOUT */
}

View File

@@ -13,7 +13,7 @@
#include "../newgrf_engine.h"
/* Helper for filling property tables */
#define NIP(prop, base, variable, type, name) { name, cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type }
#define NIP(prop, base, variable, type, name) { name, (ptrdiff_t)cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type }
#define NIP_END() { NULL, 0, 0, 0, 0 }
/* Helper for filling callback tables */

View File

@@ -9,23 +9,23 @@
/** @file string_colours.h The colour translation of GRF's strings. */
/** Colour mapping for the TextColours. */
/** Colour mapping for #TextColour. */
static const byte _string_colourmap[17] = {
150, // TC_BLUE
12, // TC_SILVER
189, // TC_GOLD
184, // TC_RED
174, // TC_PURPLE
30, // TC_LIGHT_BROWN
195, // TC_ORANGE
209, // TC_GREEN
68, // TC_YELLOW
95, // TC_DARK_GREEN
79, // TC_CREAM
116, // TC_BROWN
15, // TC_WHITE
152, // TC_LIGHT_BLUE
6, // TC_GREY
133, // TC_DARK_BLUE
1, // TC_BLACK
150, // TC_BLUE
12, // TC_SILVER
189, // TC_GOLD
184, // TC_RED
174, // TC_PURPLE
30, // TC_LIGHT_BROWN
195, // TC_ORANGE
209, // TC_GREEN
68, // TC_YELLOW
95, // TC_DARK_GREEN
79, // TC_CREAM
116, // TC_BROWN
15, // TC_WHITE
152, // TC_LIGHT_BLUE
6, // TC_GREY
133, // TC_DARK_BLUE
1, // TC_BLACK
};

View File

@@ -403,7 +403,7 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
}
}
if (c != NULL) c->terraform_limit -= ts.tile_to_new_height.size() << 16;
if (c != NULL) c->terraform_limit -= (uint32)ts.tile_to_new_height.size() << 16;
}
return total_cost;
}

View File

@@ -227,7 +227,7 @@ static void Gunzip(byte **bufp, size_t *sizep)
memset(&z, 0, sizeof(z));
z.next_in = *bufp;
z.avail_in = *sizep;
z.avail_in = (uInt)*sizep;
/* window size = 15, add 32 to enable gzip or zlib header processing */
res = inflateInit2(&z, 15 + 32);

View File

@@ -1545,7 +1545,7 @@ void NWidgetMatrix::SetupSmallestSize(Window *w, bool init_array)
SB(nw->index, 16, 16, 0);
this->head->SetupSmallestSize(w, init_array);
Dimension padding = {this->pip_pre + this->pip_post, this->pip_pre + this->pip_post};
Dimension padding = { (uint)this->pip_pre + this->pip_post, (uint)this->pip_pre + this->pip_post};
Dimension size = {this->head->smallest_x + padding.width, this->head->smallest_y + padding.height};
Dimension fill = {0, 0};
Dimension resize = {this->pip_inter + this->head->smallest_x, this->pip_inter + this->head->smallest_y};

View File

@@ -398,8 +398,8 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
if (auto_width) width = max(width, max_item_width);
Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - width : wi_rect.left), top};
Dimension dw_size = {width, height};
Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - (int)width : wi_rect.left), top};
Dimension dw_size = {width, (uint)height};
new DropdownWindow(w, list, selected, button, instant_close, dw_pos, dw_size, wi_colour, scroll, sync_parent_focus);
}