Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -52,7 +52,7 @@ class CrashLogOSX : public CrashLog {
|
||||
char filename_save[MAX_PATH]; ///< Path of crash.sav
|
||||
char filename_screenshot[MAX_PATH]; ///< Path of crash.(png|bmp|pcx)
|
||||
|
||||
/* virtual */ char *LogOSVersion(char *buffer, const char *last) const
|
||||
char *LogOSVersion(char *buffer, const char *last) const override
|
||||
{
|
||||
int ver_maj, ver_min, ver_bug;
|
||||
GetMacOSVersion(&ver_maj, &ver_min, &ver_bug);
|
||||
@@ -71,7 +71,7 @@ class CrashLogOSX : public CrashLog {
|
||||
);
|
||||
}
|
||||
|
||||
/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const
|
||||
char *LogError(char *buffer, const char *last, const char *message) const override
|
||||
{
|
||||
return buffer + seprintf(buffer, last,
|
||||
"Crash reason:\n"
|
||||
@@ -83,7 +83,7 @@ class CrashLogOSX : public CrashLog {
|
||||
);
|
||||
}
|
||||
|
||||
/* virtual */ char *LogStacktrace(char *buffer, const char *last) const
|
||||
char *LogStacktrace(char *buffer, const char *last) const override
|
||||
{
|
||||
/* As backtrace() is only implemented in 10.5 or later,
|
||||
* we're rolling our own here. Mostly based on
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
};
|
||||
|
||||
/** A single line worth of VisualRuns. */
|
||||
class CoreTextLine : public AutoDeleteSmallVector<CoreTextVisualRun *, 4>, public ParagraphLayouter::Line {
|
||||
class CoreTextLine : public AutoDeleteSmallVector<CoreTextVisualRun *>, public ParagraphLayouter::Line {
|
||||
public:
|
||||
CoreTextLine(CTLineRef line, const FontMap &fontMapping, const CoreTextParagraphLayoutFactory::CharType *buff)
|
||||
{
|
||||
@@ -75,18 +75,18 @@ public:
|
||||
|
||||
/* Extract font information for this run. */
|
||||
CFRange chars = CTRunGetStringRange(run);
|
||||
FontMap::const_iterator map = fontMapping.Begin();
|
||||
while (map < fontMapping.End() - 1 && map->first <= chars.location) map++;
|
||||
auto map = fontMapping.begin();
|
||||
while (map < fontMapping.end() - 1 && map->first <= chars.location) map++;
|
||||
|
||||
*this->Append() = new CoreTextVisualRun(run, map->second, buff);
|
||||
this->push_back(new CoreTextVisualRun(run, map->second, buff));
|
||||
}
|
||||
CFRelease(line);
|
||||
}
|
||||
|
||||
virtual int GetLeading() const;
|
||||
virtual int GetWidth() const;
|
||||
virtual int CountRuns() const { return this->Length(); }
|
||||
virtual const VisualRun *GetVisualRun(int run) const { return *this->Get(run); }
|
||||
virtual int CountRuns() const { return this->size(); }
|
||||
virtual const VisualRun *GetVisualRun(int run) const { return this->at(run); }
|
||||
|
||||
int GetInternalCharLength(WChar c) const
|
||||
{
|
||||
@@ -137,8 +137,8 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
|
||||
if (length == 0) return NULL;
|
||||
|
||||
/* Can't layout our in-built sprite fonts. */
|
||||
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
|
||||
if (i->second->fc->IsBuiltInFont()) return NULL;
|
||||
for (const auto &i : fontMapping) {
|
||||
if (i.second->fc->IsBuiltInFont()) return NULL;
|
||||
}
|
||||
|
||||
/* Make attributed string with embedded font information. */
|
||||
@@ -152,31 +152,31 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
|
||||
/* Apply font and colour ranges to our string. This is important to make sure
|
||||
* that we get proper glyph boundaries on style changes. */
|
||||
int last = 0;
|
||||
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
|
||||
if (i->first - last == 0) continue;
|
||||
for (const auto &i : fontMapping) {
|
||||
if (i.first - last == 0) continue;
|
||||
|
||||
if (_font_cache[i->second->fc->GetSize()] == NULL) {
|
||||
if (_font_cache[i.second->fc->GetSize()] == NULL) {
|
||||
/* Cache font information. */
|
||||
CFStringRef font_name = CFStringCreateWithCString(kCFAllocatorDefault, i->second->fc->GetFontName(), kCFStringEncodingUTF8);
|
||||
_font_cache[i->second->fc->GetSize()] = CTFontCreateWithName(font_name, i->second->fc->GetFontSize(), NULL);
|
||||
CFStringRef font_name = CFStringCreateWithCString(kCFAllocatorDefault, i.second->fc->GetFontName(), kCFStringEncodingUTF8);
|
||||
_font_cache[i.second->fc->GetSize()] = CTFontCreateWithName(font_name, i.second->fc->GetFontSize(), NULL);
|
||||
CFRelease(font_name);
|
||||
}
|
||||
CFAttributedStringSetAttribute(str, CFRangeMake(last, i->first - last), kCTFontAttributeName, _font_cache[i->second->fc->GetSize()]);
|
||||
CFAttributedStringSetAttribute(str, CFRangeMake(last, i.first - last), kCTFontAttributeName, _font_cache[i.second->fc->GetSize()]);
|
||||
|
||||
CGColorRef color = CGColorCreateGenericGray((uint8)i->second->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
|
||||
CFAttributedStringSetAttribute(str, CFRangeMake(last, i->first - last), kCTForegroundColorAttributeName, color);
|
||||
CGColorRef color = CGColorCreateGenericGray((uint8)i.second->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
|
||||
CFAttributedStringSetAttribute(str, CFRangeMake(last, i.first - last), kCTForegroundColorAttributeName, color);
|
||||
CGColorRelease(color);
|
||||
|
||||
/* Install a size callback for our special sprite glyphs. */
|
||||
for (ssize_t c = last; c < i->first; c++) {
|
||||
for (ssize_t c = last; c < i.first; c++) {
|
||||
if (buff[c] >= SCC_SPRITE_START && buff[c] <= SCC_SPRITE_END) {
|
||||
CTRunDelegateRef del = CTRunDelegateCreate(&_sprite_font_callback, (void *)(size_t)(buff[c] | (i->second->fc->GetSize() << 24)));
|
||||
CTRunDelegateRef del = CTRunDelegateCreate(&_sprite_font_callback, (void *)(size_t)(buff[c] | (i.second->fc->GetSize() << 24)));
|
||||
CFAttributedStringSetAttribute(str, CFRangeMake(c, 1), kCTRunDelegateAttributeName, del);
|
||||
CFRelease(del);
|
||||
}
|
||||
}
|
||||
|
||||
last = i->first;
|
||||
last = i.first;
|
||||
}
|
||||
CFAttributedStringEndEditing(str);
|
||||
|
||||
@@ -243,8 +243,8 @@ CoreTextParagraphLayout::CoreTextVisualRun::CoreTextVisualRun(CTRunRef run, Font
|
||||
int CoreTextParagraphLayout::CoreTextLine::GetLeading() const
|
||||
{
|
||||
int leading = 0;
|
||||
for (const CoreTextVisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
||||
leading = max(leading, (*run)->GetLeading());
|
||||
for (const CoreTextVisualRun * const &run : *this) {
|
||||
leading = max(leading, run->GetLeading());
|
||||
}
|
||||
|
||||
return leading;
|
||||
@@ -256,11 +256,11 @@ int CoreTextParagraphLayout::CoreTextLine::GetLeading() const
|
||||
*/
|
||||
int CoreTextParagraphLayout::CoreTextLine::GetWidth() const
|
||||
{
|
||||
if (this->Length() == 0) return 0;
|
||||
if (this->size() == 0) return 0;
|
||||
|
||||
int total_width = 0;
|
||||
for (const CoreTextVisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
||||
total_width += (*run)->GetAdvance();
|
||||
for (const CoreTextVisualRun * const &run : *this) {
|
||||
total_width += run->GetAdvance();
|
||||
}
|
||||
|
||||
return total_width;
|
||||
|
||||
@@ -140,7 +140,7 @@ class CrashLogUnix : public CrashLog {
|
||||
void *signal_instruction_ptr;
|
||||
#endif
|
||||
|
||||
/* virtual */ char *LogOSVersion(char *buffer, const char *last) const
|
||||
char *LogOSVersion(char *buffer, const char *last) const override
|
||||
{
|
||||
struct utsname name;
|
||||
if (uname(&name) < 0) {
|
||||
@@ -160,7 +160,7 @@ class CrashLogUnix : public CrashLog {
|
||||
);
|
||||
}
|
||||
|
||||
/* virtual */ char *LogOSVersionDetail(char *buffer, const char *last) const
|
||||
char *LogOSVersionDetail(char *buffer, const char *last) const override
|
||||
{
|
||||
struct utsname name;
|
||||
if (uname(&name) < 0) return buffer;
|
||||
@@ -177,7 +177,7 @@ class CrashLogUnix : public CrashLog {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const
|
||||
char *LogError(char *buffer, const char *last, const char *message) const override
|
||||
{
|
||||
buffer += seprintf(buffer, last,
|
||||
"Crash reason:\n"
|
||||
@@ -247,7 +247,7 @@ class CrashLogUnix : public CrashLog {
|
||||
*
|
||||
* Also log GDB information if available
|
||||
*/
|
||||
/* virtual */ char *LogRegisters(char *buffer, const char *last) const
|
||||
char *LogRegisters(char *buffer, const char *last) const
|
||||
{
|
||||
buffer = LogGdbInfo(buffer, last);
|
||||
|
||||
@@ -387,7 +387,7 @@ class CrashLogUnix : public CrashLog {
|
||||
* Note that GCC complains about 'buffer' being clobbered by the longjmp.
|
||||
* This is not an issue as we save/restore it explicitly, so silence the warning.
|
||||
*/
|
||||
/* virtual */ char *LogStacktrace(char *buffer, const char *last) const
|
||||
char *LogStacktrace(char *buffer, const char *last) const override
|
||||
{
|
||||
buffer += seprintf(buffer, last, "Stacktrace:\n");
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
static const uint MAX_SYMBOL_LEN = 512;
|
||||
static const uint MAX_FRAMES = 64;
|
||||
|
||||
/* printf format specification for 32/64-bit addresses. */
|
||||
#ifdef _M_AMD64
|
||||
#define PRINTF_PTR "0x%016IX"
|
||||
@@ -48,14 +45,14 @@ class CrashLogWindows : public CrashLog {
|
||||
/** Information about the encountered exception */
|
||||
EXCEPTION_POINTERS *ep;
|
||||
|
||||
/* virtual */ char *LogOSVersion(char *buffer, const char *last) const;
|
||||
/* virtual */ char *LogError(char *buffer, const char *last, const char *message) const;
|
||||
/* virtual */ char *LogStacktrace(char *buffer, const char *last) const;
|
||||
/* virtual */ char *LogRegisters(char *buffer, const char *last) const;
|
||||
/* virtual */ char *LogModules(char *buffer, const char *last) const;
|
||||
char *LogOSVersion(char *buffer, const char *last) const override;
|
||||
char *LogError(char *buffer, const char *last, const char *message) const override;
|
||||
char *LogStacktrace(char *buffer, const char *last) const override;
|
||||
char *LogRegisters(char *buffer, const char *last) const override;
|
||||
char *LogModules(char *buffer, const char *last) const override;
|
||||
public:
|
||||
#if defined(_MSC_VER) || defined(WITH_DBGHELP)
|
||||
/* virtual */ int WriteCrashDump(char *filename, const char *filename_last) const;
|
||||
int WriteCrashDump(char *filename, const char *filename_last) const override;
|
||||
char *AppendDecodedStacktrace(char *buffer, const char *last) const;
|
||||
#else
|
||||
char *AppendDecodedStacktrace(char *buffer, const char *last) const { return buffer; }
|
||||
@@ -329,6 +326,9 @@ static char *PrintModuleInfo(char *output, const char *last, HMODULE mod)
|
||||
|
||||
#if defined(_MSC_VER) || defined(WITH_DBGHELP)
|
||||
#if defined(_MSC_VER)
|
||||
static const uint MAX_SYMBOL_LEN = 512;
|
||||
static const uint MAX_FRAMES = 64;
|
||||
|
||||
#pragma warning(disable:4091)
|
||||
#endif
|
||||
#include <dbghelp.h>
|
||||
|
||||
@@ -106,12 +106,12 @@ public:
|
||||
};
|
||||
|
||||
/** A single line worth of VisualRuns. */
|
||||
class UniscribeLine : public AutoDeleteSmallVector<UniscribeVisualRun *, 4>, public ParagraphLayouter::Line {
|
||||
class UniscribeLine : public AutoDeleteSmallVector<UniscribeVisualRun *>, public ParagraphLayouter::Line {
|
||||
public:
|
||||
virtual int GetLeading() const;
|
||||
virtual int GetWidth() const;
|
||||
virtual int CountRuns() const { return this->Length(); }
|
||||
virtual const VisualRun *GetVisualRun(int run) const { return *this->Get(run); }
|
||||
virtual int CountRuns() const { return this->size(); }
|
||||
virtual const VisualRun *GetVisualRun(int run) const { return this->at(run); }
|
||||
|
||||
int GetInternalCharLength(WChar c) const
|
||||
{
|
||||
@@ -282,8 +282,8 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
if (length == 0) return NULL;
|
||||
|
||||
/* Can't layout our in-built sprite fonts. */
|
||||
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
|
||||
if (i->second->fc->IsBuiltInFont()) return NULL;
|
||||
for (auto const &pair : fontMapping) {
|
||||
if (pair.second->fc->IsBuiltInFont()) return NULL;
|
||||
}
|
||||
|
||||
/* Itemize text. */
|
||||
@@ -296,12 +296,12 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
|
||||
int cur_pos = 0;
|
||||
std::vector<SCRIPT_ITEM>::iterator cur_item = items.begin();
|
||||
for (FontMap::const_iterator i = fontMapping.Begin(); i != fontMapping.End(); i++) {
|
||||
while (cur_pos < i->first && cur_item != items.end() - 1) {
|
||||
for (auto const &i : fontMapping) {
|
||||
while (cur_pos < i.first && cur_item != items.end() - 1) {
|
||||
/* Add a range that spans the intersection of the remaining item and font run. */
|
||||
int stop_pos = min(i->first, (cur_item + 1)->iCharPos);
|
||||
int stop_pos = min(i.first, (cur_item + 1)->iCharPos);
|
||||
assert(stop_pos - cur_pos > 0);
|
||||
ranges.push_back(UniscribeRun(cur_pos, stop_pos - cur_pos, i->second, cur_item->a));
|
||||
ranges.push_back(UniscribeRun(cur_pos, stop_pos - cur_pos, i.second, cur_item->a));
|
||||
|
||||
/* Shape the range. */
|
||||
if (!UniscribeShapeRun(buff, ranges.back())) {
|
||||
@@ -424,7 +424,7 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
if (!UniscribeShapeRun(this->text_buffer, run)) return NULL;
|
||||
}
|
||||
|
||||
*line->Append() = new UniscribeVisualRun(run, cur_pos);
|
||||
line->push_back(new UniscribeVisualRun(run, cur_pos));
|
||||
cur_pos += run.total_advance;
|
||||
}
|
||||
|
||||
@@ -448,8 +448,8 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
int UniscribeParagraphLayout::UniscribeLine::GetLeading() const
|
||||
{
|
||||
int leading = 0;
|
||||
for (const UniscribeVisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
||||
leading = max(leading, (*run)->GetLeading());
|
||||
for (const UniscribeVisualRun *run : *this) {
|
||||
leading = max(leading, run->GetLeading());
|
||||
}
|
||||
|
||||
return leading;
|
||||
@@ -462,8 +462,8 @@ int UniscribeParagraphLayout::UniscribeLine::GetLeading() const
|
||||
int UniscribeParagraphLayout::UniscribeLine::GetWidth() const
|
||||
{
|
||||
int length = 0;
|
||||
for (const UniscribeVisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
||||
length += (*run)->GetAdvance();
|
||||
for (const UniscribeVisualRun *run : *this) {
|
||||
length += run->GetAdvance();
|
||||
}
|
||||
|
||||
return length;
|
||||
|
||||
Reference in New Issue
Block a user