1
0
Fork 0

Compare commits

...

7 Commits

Author SHA1 Message Date
Peter Nelson a32c72fd8d
Merge 3600a42e55 into 1d38cbafcb 2025-07-13 23:12:27 +00:00
Peter Nelson 1d38cbafcb Codechange: Use unique_ptr for ScriptInfo instances.
Replaces raw pointers, slightly.
2025-07-14 00:10:14 +01:00
Peter Nelson 992d58d799 Codechange: Pass ScriptInfo by reference to IsSameScript. 2025-07-14 00:10:14 +01:00
Peter Nelson 8f34b7a821 Codechange: Keep Squirrel engine in unique_ptr. 2025-07-14 00:10:14 +01:00
Peter Nelson bf6d0c4934
Codechange: Don't pre-fill font metrics when loading fonts. (#14436)
Each font cache implementation sets its own metrics based on the loaded font, so there is no need to pre-fill with (unscaled, invalid) default metrics.
2025-07-13 23:38:31 +01:00
Michael Lutz 3c4fb21a5e
Fix: [Win32] Link failure with newer Windows SDK version due to WinRT changes. (#14432) 2025-07-13 22:34:32 +01:00
Peter Nelson 3600a42e55
Update: Changelog for 15.0-beta3 2025-07-10 22:19:46 +01:00
10 changed files with 218 additions and 53 deletions

View File

@ -1,5 +1,141 @@
## 15.x
### 15.0-beta3 (2025-07-01)
- Add: Buttons to change picker preview image height. (#14373)
- Add: Show and sort online content version in content list. (#14355)
- Add: Hover on graph legend to highlight line. (#14314)
- Add: Allow separate expansion of town buildings and roads in scenario editor. (#14341)
- Add: [Script] Cloning ScriptList (#14305)
- Add: [Script] Framework for cloning selected ScriptObject
- Add: Badge dropdown filters and configuration.for picker and vehicle windows. (#14021)
- Add: Configuration of NewGRF badges for picker and vehicle windows. (#13993)
- Add: [Script] GSBaseStation::GetOwner (#13406)
- Add: [Script] ScriptVehicleList_Waypoint (#13456)
- Add: [NewGRF] All callbacks returning D0xx strings, have now the option to return any string id via register 0x100. (#14224)
- Add: [NewGRF] Special value 0x7FFE for VarAction2 results specifying 'return calculated result'. (#14149)
- Add: [NewGRF] Special value 0x7FFF for Action2 references specifying explicit 'callback/sprite-resolving failed'. (#14149)
- Add: [NewGRF] Add purchase list Action3 CID for houses, industries, industry tiles, airports and airport tiles. (#14121)
- Add: "Many random towns" button in scenario editor now prompts for the number of towns, with defaults based on new game settings (#14158)
- Add: [BaseSet] Allow basesets to set minor and patch versions in obg/obs/obm files. (#14169)
- Add: Limit height of settings description, and add scrollbar. (#14102)
- Add: [NewGRF] Provide random bits in var10 of house callback 1C 'construction stage changed'. (#14095)
- Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080)
- Add: Add scrollbar to infrastructure window. (#14056)
- Change: Make truncation ellipsis translatable. (#14417)
- Change: Improve sprite ellipsis appearance. (#14404)
- Change: New company face definition system and UI. (#14319)
- Change: Consistent toolbar sizes with dedicated NWidgetParts. (#14344)
- Change: [Script] Don't allow scripts to instantiate ScriptEvent (#14276)
- Change: [Script] ScriptVehicleList_Station accepts an optional VehicleType parameter (#14260)
- Change: Remove Apply button from NewGRF config window when unneeded. (#14254)
- Change: Remove extra close buttons from some windows. (#14124)
- Change: Move OpenTTD version to intro viewport. (#14233)
- Change: [NewGRF] Increase the textstack for all callbacks to 16 registers.
- Change: Rearrange buttons in the intro screen, remove unnecessary ones.
- Change: [Script] Remove the limit of 20 parameters to a Script Text string. (#14193)
- Change: [NewGRF] Animation-trigger 'construction stage changed' of houses and industries now also triggers at construction start. (#14089)
- Change: [Script] Reject scripts using negative version (#14096)
- Change: [NewGRF] Provide shared random bits in multi-tile animation-triggers of airport tiles and objects, just like for other features. (#14090)
- Change: Move Game Options toggles to before label, add Off/On text. (#14097)
- Change: Remove minimum width from advanced settings panel of Game Options window. (#14088)
- Change: Merge Game Options and Game Settings together. (#13242)
- Change: Enhance visibility of disabled bool button. (#14071)
- Change: Use scaled instead of fixed dimensions for framerate graphs. (#14039)
- Change: Include dragged train in depot tile length display. (#14060)
- Change: Use standard boolean toggle buttons for game options toggles. (#14051)
- Change: "setting" console command now shows default value (#14061)
- Change: Allow Double-Ctrl+Click on default size box to clear saved size. (#14055)
- Change: Don't select content when toggling its download status. (#14059)
- Fix: Scale graph gridlines and axes with GUI scale (#12131)
- Fix #14396: Industry production graph showed zero instead of N/A. (#14416)
- Fix #14375: When loading config, validate timekeeping mode and minutes per year (#14405)
- Fix #14377: Make house picker window remember house protection state when closed (#14406)
- Fix #14385: [Strgen] Don't count parameters more than one time (#14413)
- Fix #14360: Don't reuse strings for Low/Medium/High setting values (#14409)
- Fix: Include sort button width in content list header minimal size. (#14402)
- Fix: Don't draw truncation ellipsis if it's too wide. (#14401)
- Fix: Don't include ellipsis width in RTL truncation offset. (#14400)
- Fix 319caef58f: Buildings with non-zero subtile offsets broken in house picker. (#14390)
- Fix #14081: Check if removed item is a savegame (#14371)
- Fix: Allow object picker to resize if there are no classes. (#14372)
- Fix: Train path reservations on different railtypes could join leading to train crashes. (#14366)
- Fix #14362, 4b677e8256: Class with non static methods may have a default constructor (#14363)
- Fix #14356, ff7eb996e6: Incorrect sprite group chosen for stations and road stops. (#14359)
- Fix 0455627d16: Order backups were no longer created when selling vehicles. (#14352)
- Fix: [Script] Make ScriptOrder functions aware of road waypoints (#13419)
- Fix: Wrong error message about script Save() returned value (#14334)
- Fix: Drag drop line position when dragging NewGRF from file to active panel (#14316)
- Fix 4c8f1b0f81: Hidden-by-facility station signs were not ignored when handling clicks. (#14326)
- Fix: [Script] SQOpsLimiter had no effect for native valuator/filter (#14322)
- Fix bd1a3fe0b7: Crash if loading compatibility scripts fails. (#14318)
- Fix 5664b1e2f6: Upgrade button in NewGRF window no longer worked. (#14315)
- Fix #14295, 0455627d16: v->cur_implicit_order_index is never INVALID_VEH_ORDER_ID (#14296)
- Fix 0455627d16: Incorrect script order position mapping. (#14294)
- Fix #14234, 5aa4ad5135: Crash due to unexpected NUL char in string. (#14235)
- Fix: Clear rail vehicle flipped flag if reverse probability callback returns false. (#14281)
- Fix #14271, 7fd0e6c27d: Crash due to incorrect parameter index in string. (#14272)
- Fix: Restore the behaviour when entering numbers in query windows: clamp integers out of range to the maximum valid value. (#14268)
- Fix b2c57123: [Script] Conversion from ScriptEvent to ScriptEventCompanyTown subclasses (#14274)
- Fix f8bdc1e612: Empty first parameter of EncodedString was skipped. (#14273)
- Fix #14256, dfd9fbf873: Company finance windows not updated when paused. (#14258)
- Fix 0829604b4f: Dragging of selected order was still not possible. (#14259)
- Fix 0ce30d05c8: Replacing a dropdown list could reposition it partially off-screen. (#14261)
- Fix 3cf9b159: Incorrect tile colour in smallmap for snowy MP_CLEAR tiles in vegetation mode (#14257)
- Fix #14251: Out-of-bounds writes via TextRefStack. (#14255)
- Fix 51a7edd: NewGRF debug sprite picker was broken. (#14246)
- Fix #14241, 6e10584: Invalid string parameters in subsidies list window (#14243)
- Fix #13854: 40bpp-anim blitter recolouring failed for 32bpp pixels without mask channel. (#14242)
- Fix #14234, 16b4e73: Skip PLURAL data if parameter is invalid. (#14236)
- Fix #14216, d030d17: RealSpriteGroups referencing CallbackResultSpriteGroups were always treated as callback-failure. (#14218)
- Fix: Closing the Game Options window closes all textfile windows. (#14210)
- Fix: Zoom-scroll extra viewports only if the mouse cursor is over the viewport. (#14209)
- Fix: Changing monospace font didn't refresh the monospace width cache. (#14185)
- Fix #14098: Use 64-bit type for MIDI realtime informatio [to allow longer tracks to play]. (#14144)
- Fix: [NewGRF] If Action123 does not resolve in a valid SpriteSet, prefer drawing the default sprite instead of an invalid sprite. (#14143)
- Fix: Crash/Undefined behaviour in station view window. (#14183)
- Fix: Small order list arrow was wrong direction for RTL text. (#14174)
- Fix: [Script] Access to enum/consts defined outside of main.nut (#14176)
- Fix: Handle \t when loading GS strings from savegame (#14180)
- Fix bf8a241f: Handle \t in trailing whitespaces (#14178)
- Fix 66733e2a: Textbuf was broken, and did not insert any input. (#14173)
- Fix #14170, 7fd0e6c27d: Missing spaces for timetabled order strings. (#14172)
- Fix 261e09a549: Compilation failure with Fluidsynth enabled. (#14167)
- Fix #14166, dfd9fbf873: Loan was no longer invalidated when refreshing finance window. (#14168)
- Fix: [NewGRF] Computed VarAction2 callback results were not always properly masked to 15 bit results. (#14138)
- Fix: [NewGRF] The result of Action123 evaluation affected rerandomisation in a weird corner case. (#14139)
- Fix: [NewGRF] AI station construction callback did not work for stations with ID >= 0x100. (#14142)
- Fix: Out-of-bounds read, if NewGRF stations provided no spritesets. (#14140)
- Fix: List Ctrl+Click behaviour for vehicle details tooltip (#14127)
- Fix 29ceaf0a8: checking std::optional against nullptr caused crash (#14133)
- Fix #14125, 828e808444: NewGRF sounds were not loaded. (#14130)
- Fix #14104, 67a0fcc: Don't base timetable timing decisions on client settings. (#14105)
- Fix 5575379: Crash with default airports. (#14120)
- Fix: Road vehicle blocking and train collissions used slightly inconsistent distance thresholds. (#14114)
- Fix: [NewGRF] Cargo-types for airport-tile animation-triggers were not properly translated. (#14092)
- Fix: [NewGRF] For animation-triggers which do not supply a cargo-type in var18, the var18 bits should remain empty. (#14091)
- Fix #14107: Mark the company value in the company view window dirty when it changes. (#14112)
- Fix #14107: Invalidate all shared vehicle windows when changing group. (#14110)
- Fix: Focus settings filter box (only) when the tab becomes active. (#14100)
- Fix 2b80812922: Map size column in server list may be too wide. (#14094)
- Fix: [NewGRF] Randomisation-trigger 'path reservation' did not work for waypoints. (#14076)
- Fix a4dc7249ee: Changing language or interface scale could hang. (#14087)
- Fix: [NewGRF] For roadstop multi-tile-animation-triggers, the upper 16 bits were not the same for all tiles. (#14084)
- Fix f5ffd47: Don't skip separator while reading a record (#14083)
- Fix c7d6934816: Town view caption lost "(City)" flag. (#14082)
- Fix e114ed357d: Incorrect test of object flags allowed HQ to be removed. (#14062)
- Fix: Odd drawing and crash if scrollbar is not tall enough. (#14052)
- Fix #14044: Negative string parameters from GS were rendered as zero. (#14049)
- Fix: Incorrect string display for autoreplace wagon removal status. (#14038)
- Fix e49150f9ca: House picker crashes if selection is not available. (#14030)
- Fix: [NewGRF] Strange things happened, when using the synchronised tile loop animation trigger for houses. (#14011)
- Fix: [NewGRF] PrepareLayout worked on a copy of the data resulting in bad sprite layouts. (#14013)
- Fix: [NewGRF] Animation speed properties of houses and stations had wrong default. (#14005)
- Fix: [NewGRF] Roadstop animation/randomisation was not triggered on vehicle arrival. (#14003)
- Fix #13954: Plotting graphs with limited data to the right. (#13956)
- Fix: Don't display badges if the class has no name. (#13994)
- Revert 0853c1979b: Button to toggle showing advanced signal types (#9617) (#14219)
### 15.0-beta2 (2025-04-13)
- Feature: Snow-covered rocks are now visible (#13627)

View File

@ -90,7 +90,7 @@ template <> SQInteger PushClassName<AIInfo, ScriptType::AI>(HSQUIRRELVM vm) { sq
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
sq_setinstanceup(vm, 2, nullptr);
/* Register the AI to the base system */
info->GetScanner()->RegisterScript(info);
info->GetScanner()->RegisterScript(std::unique_ptr<AIInfo>{info});
return 0;
}
@ -136,22 +136,21 @@ bool AIInfo::CanLoadFromVersion(int version) const
/* static */ SQInteger AILibrary::Constructor(HSQUIRRELVM vm)
{
/* Create a new library */
AILibrary *library = new AILibrary();
auto library = std::make_unique<AILibrary>();
SQInteger res = ScriptInfo::Constructor(vm, *library);
if (res != 0) {
delete library;
return res;
}
/* Cache the category */
if (!library->CheckMethod("GetCategory") || !library->engine->CallStringMethod(library->SQ_instance, "GetCategory", &library->category, MAX_GET_OPS)) {
delete library;
return SQ_ERROR;
}
/* Register the Library to the base system */
library->GetScanner()->RegisterScript(library);
ScriptScanner *scanner = library->GetScanner();
scanner->RegisterScript(std::move(library));
return 0;
}

View File

@ -29,7 +29,7 @@ void AIScannerInfo::Initialize()
{
ScriptScanner::Initialize("AIScanner");
ScriptAllocatorScope alloc_scope(this->engine);
ScriptAllocatorScope alloc_scope(this->engine.get());
/* Create the dummy AI */
this->main_script = "%_dummy";

View File

@ -22,9 +22,10 @@
#include "safeguards.h"
/** Default heights for the different sizes of fonts. */
static const int _default_font_height[FS_END] = {10, 6, 18, 10};
static const int _default_font_ascender[FS_END] = { 8, 5, 15, 8};
/** Default unscaled heights for the different sizes of fonts. */
/* static */ const int FontCache::DEFAULT_FONT_HEIGHT[FS_END] = {10, 6, 18, 10};
/** Default unscaled ascenders for the different sizes of fonts. */
/* static */ const int FontCache::DEFAULT_FONT_ASCENDER[FS_END] = {8, 5, 15, 8};
FontCacheSettings _fcsettings;
@ -32,8 +33,7 @@ FontCacheSettings _fcsettings;
* Create a new font cache.
* @param fs The size of the font.
*/
FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs), height(_default_font_height[fs]),
ascender(_default_font_ascender[fs]), descender(_default_font_ascender[fs] - _default_font_height[fs])
FontCache::FontCache(FontSize fs) : parent(FontCache::Get(fs)), fs(fs)
{
assert(this->parent == nullptr || this->fs == this->parent->fs);
FontCache::caches[this->fs] = this;
@ -50,7 +50,7 @@ FontCache::~FontCache()
int FontCache::GetDefaultFontHeight(FontSize fs)
{
return _default_font_height[fs];
return FontCache::DEFAULT_FONT_HEIGHT[fs];
}
/**

View File

@ -23,9 +23,9 @@ protected:
static FontCache *caches[FS_END]; ///< All the font caches.
FontCache *parent; ///< The parent of this font cache.
const FontSize fs; ///< The size of the font.
int height; ///< The height of the font.
int ascender; ///< The ascender value of the font.
int descender; ///< The descender value of the font.
int height = 0; ///< The height of the font.
int ascender = 0; ///< The ascender value of the font.
int descender = 0; ///< The descender value of the font.
public:
FontCache(FontSize fs);
@ -33,6 +33,11 @@ public:
static void InitializeFontCaches();
/** Default unscaled font heights. */
static const int DEFAULT_FONT_HEIGHT[FS_END];
/** Default unscaled font ascenders. */
static const int DEFAULT_FONT_ASCENDER[FS_END];
static int GetDefaultFontHeight(FontSize fs);
/**

View File

@ -78,7 +78,7 @@ template <> SQInteger PushClassName<GameInfo, ScriptType::GS>(HSQUIRRELVM vm) {
/* Remove the link to the real instance, else it might get deleted by RegisterGame() */
sq_setinstanceup(vm, 2, nullptr);
/* Register the Game to the base system */
info->GetScanner()->RegisterScript(info);
info->GetScanner()->RegisterScript(std::unique_ptr<GameInfo>{info});
return 0;
}
@ -106,22 +106,21 @@ bool GameInfo::CanLoadFromVersion(int version) const
/* static */ SQInteger GameLibrary::Constructor(HSQUIRRELVM vm)
{
/* Create a new library */
GameLibrary *library = new GameLibrary();
auto library = std::make_unique<GameLibrary>();
SQInteger res = ScriptInfo::Constructor(vm, *library);
if (res != 0) {
delete library;
return res;
}
/* Cache the category */
if (!library->CheckMethod("GetCategory") || !library->engine->CallStringMethod(library->SQ_instance, "GetCategory", &library->category, MAX_GET_OPS)) {
delete library;
return SQ_ERROR;
}
/* Register the Library to the base system */
library->GetScanner()->RegisterScript(library);
ScriptScanner *scanner = library->GetScanner();
scanner->RegisterScript(std::move(library));
return 0;
}

View File

@ -92,8 +92,8 @@ GameLibrary *GameScannerLibrary::FindLibrary(const std::string &library, int ver
std::string library_name = fmt::format("{}.{}", library, version);
/* Check if the library + version exists */
ScriptInfoList::iterator it = this->info_list.find(library_name);
auto it = this->info_list.find(library_name);
if (it == this->info_list.end()) return nullptr;
return static_cast<GameLibrary *>((*it).second);
return static_cast<GameLibrary *>(it->second);
}

View File

@ -44,10 +44,7 @@ bool ScriptScanner::AddFile(const std::string &filename, size_t, const std::stri
return true;
}
ScriptScanner::ScriptScanner() :
engine(nullptr)
{
}
ScriptScanner::ScriptScanner() = default;
void ScriptScanner::ResetEngine()
{
@ -58,7 +55,7 @@ void ScriptScanner::ResetEngine()
void ScriptScanner::Initialize(std::string_view name)
{
this->engine = new Squirrel(name);
this->engine = std::make_unique<Squirrel>(name);
this->RescanDir();
@ -68,8 +65,6 @@ void ScriptScanner::Initialize(std::string_view name)
ScriptScanner::~ScriptScanner()
{
this->Reset();
delete this->engine;
}
void ScriptScanner::RescanDir()
@ -83,15 +78,12 @@ void ScriptScanner::RescanDir()
void ScriptScanner::Reset()
{
for (const auto &item : this->info_list) {
delete item.second;
}
this->info_list.clear();
this->info_single_list.clear();
this->info_vector.clear();
}
void ScriptScanner::RegisterScript(ScriptInfo *info)
void ScriptScanner::RegisterScript(std::unique_ptr<ScriptInfo> &&info)
{
std::string script_original_name = this->GetScriptName(*info);
std::string script_name = fmt::format("{}.{}", script_original_name, info->GetVersion());
@ -99,7 +91,6 @@ void ScriptScanner::RegisterScript(ScriptInfo *info)
/* Check if GetShortName follows the rules */
if (info->GetShortName().size() != 4) {
Debug(script, 0, "The script '{}' returned a string from GetShortName() which is not four characters. Unable to load the script.", info->GetName());
delete info;
return;
}
@ -111,7 +102,6 @@ void ScriptScanner::RegisterScript(ScriptInfo *info)
#else
if (it->second->GetMainScript() == info->GetMainScript()) {
#endif
delete info;
return;
}
@ -120,20 +110,20 @@ void ScriptScanner::RegisterScript(ScriptInfo *info)
Debug(script, 1, " 2: {}", info->GetMainScript());
Debug(script, 1, "The first is taking precedence.");
delete info;
return;
}
this->info_list[script_name] = info;
ScriptInfo *script_info = this->info_vector.emplace_back(std::move(info)).get();
this->info_list[script_name] = script_info;
if (!info->IsDeveloperOnly() || _settings_client.gui.ai_developer_tools) {
if (!script_info->IsDeveloperOnly() || _settings_client.gui.ai_developer_tools) {
/* Add the script to the 'unique' script list, where only the highest version
* of the script is registered. */
auto it = this->info_single_list.find(script_original_name);
if (it == this->info_single_list.end()) {
this->info_single_list[script_original_name] = info;
} else if (it->second->GetVersion() < info->GetVersion()) {
it->second = info;
this->info_single_list[script_original_name] = script_info;
} else if (it->second->GetVersion() < script_info->GetVersion()) {
it->second = script_info;
}
}
}
@ -195,17 +185,17 @@ struct ScriptFileChecksumCreator : FileScanner {
* @param info The script to get the shortname and md5 sum from.
* @return True iff they're the same.
*/
static bool IsSameScript(const ContentInfo &ci, bool md5sum, ScriptInfo *info, Subdirectory dir)
static bool IsSameScript(const ContentInfo &ci, bool md5sum, const ScriptInfo &info, Subdirectory dir)
{
uint32_t id = 0;
auto str = std::string_view{info->GetShortName()}.substr(0, 4);
auto str = std::string_view{info.GetShortName()}.substr(0, 4);
for (size_t j = 0; j < str.size(); j++) id |= static_cast<uint8_t>(str[j]) << (8 * j);
if (id != ci.unique_id) return false;
if (!md5sum) return true;
ScriptFileChecksumCreator checksum(dir);
const auto &tar_filename = info->GetTarFile();
const auto &tar_filename = info.GetTarFile();
TarList::iterator iter;
if (!tar_filename.empty() && (iter = _tar_list[dir].find(tar_filename)) != _tar_list[dir].end()) {
/* The main script is in a tar file, so find all files that
@ -224,7 +214,7 @@ static bool IsSameScript(const ContentInfo &ci, bool md5sum, ScriptInfo *info, S
/* There'll always be at least 1 path separator character in a script
* main script name as the search algorithm requires the main script to
* be in a subdirectory of the script directory; so <dir>/<path>/main.nut. */
const std::string &main_script = info->GetMainScript();
const std::string &main_script = info.GetMainScript();
std::string path = main_script.substr(0, main_script.find_last_of(PATHSEPCHAR));
checksum.Scan(".nut", path);
}
@ -235,7 +225,7 @@ static bool IsSameScript(const ContentInfo &ci, bool md5sum, ScriptInfo *info, S
bool ScriptScanner::HasScript(const ContentInfo &ci, bool md5sum)
{
for (const auto &item : this->info_list) {
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return true;
if (IsSameScript(ci, md5sum, *item.second, this->GetDirectory())) return true;
}
return false;
}
@ -243,7 +233,7 @@ bool ScriptScanner::HasScript(const ContentInfo &ci, bool md5sum)
std::optional<std::string_view> ScriptScanner::FindMainScript(const ContentInfo &ci, bool md5sum)
{
for (const auto &item : this->info_list) {
if (IsSameScript(ci, md5sum, item.second, this->GetDirectory())) return item.second->GetMainScript();
if (IsSameScript(ci, md5sum, *item.second, this->GetDirectory())) return item.second->GetMainScript();
}
return std::nullopt;
}

View File

@ -13,7 +13,7 @@
#include "../fileio_func.h"
#include "../string_func.h"
typedef std::map<std::string, class ScriptInfo *, CaseInsensitiveComparator> ScriptInfoList; ///< Type for the list of scripts.
using ScriptInfoList = std::map<std::string, class ScriptInfo *, CaseInsensitiveComparator>; ///< Type for the list of scripts.
/** Scanner to help finding scripts. */
class ScriptScanner : public FileScanner {
@ -26,7 +26,7 @@ public:
/**
* Get the engine of the main squirrel handler (it indexes all available scripts).
*/
class Squirrel *GetEngine() { return this->engine; }
class Squirrel *GetEngine() { return this->engine.get(); }
/**
* Get the current main script the ScanDir is currently tracking.
@ -51,7 +51,7 @@ public:
/**
* Register a ScriptInfo to the scanner.
*/
void RegisterScript(class ScriptInfo *info);
void RegisterScript(std::unique_ptr<class ScriptInfo> &&info);
/**
* Get the list of registered scripts to print on the console.
@ -84,11 +84,13 @@ public:
void RescanDir();
protected:
class Squirrel *engine; ///< The engine we're scanning with.
std::unique_ptr<class Squirrel> engine; ///< The engine we're scanning with.
std::string main_script; ///< The full path of the script.
std::string tar_file; ///< If, which tar file the script was in.
ScriptInfoList info_list; ///< The list of all script.
std::vector<std::unique_ptr<ScriptInfo>> info_vector;
ScriptInfoList info_list; ///< The list of all script.
ScriptInfoList info_single_list; ///< The list of all unique script. The best script (highest version) is shown.
/**

View File

@ -401,6 +401,40 @@ static void CancelIMEComposition(HWND hwnd)
HandleTextInput({}, true);
}
#if defined(_MSC_VER) && defined(NTDDI_WIN10_RS4)
/* We only use WinRT functions on Windows 10 or later. Unfortunately, newer Windows SDKs are now
* linking the two functions below directly instead of using dynamic linking as previously.
* To avoid any runtime linking errors on Windows 7 or older, we stub in our own dynamic
* linking trampoline. */
static LibraryLoader _combase("combase.dll");
extern "C" int32_t __stdcall WINRT_IMPL_RoOriginateLanguageException(int32_t error, void *message, void *languageException) noexcept
{
typedef BOOL(WINAPI *PFNRoOriginateLanguageException)(int32_t, void *, void *);
static PFNRoOriginateLanguageException RoOriginateLanguageException = _combase.GetFunction("RoOriginateLanguageException");
if (RoOriginateLanguageException != nullptr) {
return RoOriginateLanguageException(error, message, languageException);
} else {
return TRUE;
}
}
extern "C" int32_t __stdcall WINRT_IMPL_RoGetActivationFactory(void *classId, winrt::guid const &iid, void **factory) noexcept
{
typedef BOOL(WINAPI *PFNRoGetActivationFactory)(void *, winrt::guid const &, void **);
static PFNRoGetActivationFactory RoGetActivationFactory = _combase.GetFunction("RoGetActivationFactory");
if (RoGetActivationFactory != nullptr) {
return RoGetActivationFactory(classId, iid, factory);
} else {
*factory = nullptr;
return winrt::impl::error_class_not_available;
}
}
#endif
static bool IsDarkModeEnabled()
{
/* Only build if SDK is Windows 10 1803 or later. */