mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
5 Commits
bc4ed9085d
...
d0c753465d
Author | SHA1 | Date |
---|---|---|
|
d0c753465d | |
|
80a704ba11 | |
|
7a740eefa0 | |
|
4b372b6050 | |
|
22eed9616e |
282
changelog.txt
282
changelog.txt
|
@ -1,3 +1,285 @@
|
|||
14.0-beta1 (2023-02-03)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Order option to unbunch vehicles at depot (#11945)
|
||||
Feature: Infinite money mode (#11902)
|
||||
Feature: Setting to disable the loading speed penalty for trains longer than the station (#11682)
|
||||
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628)
|
||||
Feature: Scalable OpenTTD TrueType font made by Zephyris (#11593)
|
||||
Feature: Toyland-specific river graphics (#11523)
|
||||
Feature: Add zoom level buttons to sprite aligner (#11518)
|
||||
Feature: Add shading to river slopes (#11491)
|
||||
Feature: Place cargo icon on cargo filter dropdowns (#11487)
|
||||
Feature: Mode to display timetable in seconds (#11435)
|
||||
Feature: Setting to influence how many minutes a calendar year takes (#11428)
|
||||
Feature: Base graphics can offer parameters for additional settings (#11347)
|
||||
Feature: Sandbox option to lock station ratings at 100% (#11346)
|
||||
Feature: Setting to use real-time "wallclock" as timekeeping units (#11341)
|
||||
Feature: Setting to automatically restart server based on hours played (#11142)
|
||||
Feature: Add config option to set default company secondary colour for new games (#11068)
|
||||
Feature: Transparency option for cost and income indicators (#11001)
|
||||
Feature: Create group of vehicles from manage vehicle list button (#10890)
|
||||
Feature: Show coverage highlight the same as stations when adding waypoints (#10875)
|
||||
Feature: Show the number of industries already built in the Fund New Industry window (#10806)
|
||||
Feature: Add search filter and name text to build waypoint window (#10786)
|
||||
Feature: Setting to disallow level crossings with competitors (#10755)
|
||||
Feature: Opt-in survey when leaving a game (#10719)
|
||||
Feature: Replace buying/selling company shares with hostile takeovers of AI companies (#10709, #10914)
|
||||
Feature: Settings to scale cargo production of towns and industries (#10606)
|
||||
Feature: Separate rail/road and sea/air velocity units, and add knots (#10594)
|
||||
Feature: Region-based pathfinder for ships (#10543)
|
||||
Feature: Filter engine build menu by name and NewGRF extra text (#10519)
|
||||
Feature: Industry directory text filter (#10518)
|
||||
Feature: Ctrl+Click to reset late counter for the entire vehicle group (#10464)
|
||||
Feature: Orientation of rail and road depots can be changed (#9642)
|
||||
Feature: Display help and manuals in-game (#7786)
|
||||
Feature: [NewGRF] Town production effect and multiplier (#11947)
|
||||
Feature: [NewGRF] Randomize direction of rail vehicle on build based on probability callback (#11489)
|
||||
Feature: [NewGRF] Related Act2 objects for airports and airport tiles (#11282)
|
||||
Feature: [NewGRF] Allow higher max speeds for ships (#10734)
|
||||
Feature: [NewGRF] Increase limit of objects/stations/roadstops per NewGRF (#10672)
|
||||
Feature: [NewGRF] Road stops (#10144)
|
||||
Feature: [Script] Goal destination can be updated (#10817)
|
||||
Add: Argument for console command "restart" to use either current or newgame settings (#11962, #11963)
|
||||
Add: {CURRENCY_SHORT} only did k / m suffix. Add bn / tn and make translatable (#11921)
|
||||
Add: Show in multiplayer the amount of hours a game has been unpaused (#11886)
|
||||
Add: Allow loading heightmaps from command-line (#11870)
|
||||
Add: List_[scenario|heightmap] and load_[scenario|height] console commands (#11867)
|
||||
Add: Latvian Lats currency (#11691)
|
||||
Add: Horizontal scroll for script debug log (#11597)
|
||||
Add: GUI options to select sprite font and AA mode for all fonts (#11593)
|
||||
Add: Website button for basesets in Game Options window, the Game Script settings window and AI settings window (#11512)
|
||||
Add: [Emscripten] Support for bootstrapping (#11109)
|
||||
Add: Hotkey to focus town / industry directory filter box (#11030)
|
||||
Add: Maximum number of companies allowed to the client list (#10523)
|
||||
Add: Use specific error message when vehicle cannot go to station/waypoint (#10494)
|
||||
Add: Show NewGRF name in NewGRF-created errors (#10457)
|
||||
Add: Alternative setting for right-click close window option to exclude pinned windows (#10204)
|
||||
Add: Allow autoreplace with same model vehicle (#7729)
|
||||
Add: [NewGRF] Allow inspection of road tiles and airports (#11282, #11323)
|
||||
Add: [NewGRF] Station variable 6B to get extended station id of nearby tiles (#10953)
|
||||
Add: [NewGRF] String code "9A 21" to display force from textstack (#10782)
|
||||
Add: [NewGRF] Station property 1C/1D to set name/classname (#10672)
|
||||
Add: [Script] Optional filter parameter to ScriptXXXList constructors (#11698,#11663)
|
||||
Add: [Script] AI/GS Time Mode to choose between economy (default) and calendar time (#11603)
|
||||
Add: [Script] Allow to set max loan for each company separately (#11224)
|
||||
Add: [Script] GSIndustry.GetConstructionDate() method (#11145)
|
||||
Add: [Script] Game script control of industry production level and news messages (#11141)
|
||||
Add: [Script] GSAsyncMode to set async mode of gamescript commands (#10913)
|
||||
Add: [Script] GSCompanyMode::IsValid and IsDeity, and enforce valid company/deity mode where applicable (#10536, #10529)
|
||||
Add: [Script] Allow GS to found town with random road layout (#10442)
|
||||
Add: [Script] Create own Randomizer per instance (#10349)
|
||||
Change: Better handle different GUI sizes for most windows, and squash inconsistencies between windows
|
||||
Change: Allow configuring AI slots above the current maximum number of competitors (#11961)
|
||||
Change: Forcefully enable prefixing logs with date (#11930)
|
||||
Change: Position error window closer to cursor on large screens (#11923)
|
||||
Change: Only open story-book in center when a GS does it (#11916)
|
||||
Change: Rebrand Cheats as Sandbox Options (#11874)
|
||||
Change: Make smooth-scrolling based on actual time (#11865)
|
||||
Change: Set smooth-scrolling on by default (#11860)
|
||||
Change: Disable building rail infrastructure if train build limit is zero (#11847)
|
||||
Change: Invalidate music volume when restarting music playback on Windows (#11836)
|
||||
Change: Make street lights transparent with houses (#11828)
|
||||
Change: Redesign script debug window (#11782)
|
||||
Change: Reorganize Settings menu items (#11683)
|
||||
Change: Set amount of smoke/sparks to "realistic" by default (#11624)
|
||||
Change: Show a message in livery window if vehicle type has no groups (#11617)
|
||||
Change: Add distinct tooltips for vehicle group colour schemes (#11617)
|
||||
Change: Move colour selection dropdowns to bottom of window (#11617)
|
||||
Change: Support custom transparency remaps with 32bpp blitters (#11616)
|
||||
Change: Make "middle" the default stopping location for trains in platforms (#11605)
|
||||
Change: Scale sprites to requested highest resolution level (#11600)
|
||||
Change: Allow opening multiple script debug windows by holding Ctrl (#11592)
|
||||
Change: Don't show scoring year in high score table (#11546)
|
||||
Change: Revert pressed-button content shifting introduced in r2161 (#11542)
|
||||
Change: Show rating in station list even with no cargo waiting (#11540)
|
||||
Change: Hide unused cargos from vehicle cargo filter (#11533)
|
||||
Change: Don't restart playback when toggling playlist shuffle (#11504)
|
||||
Change: Increase finance window lines (and underlines) with interface scale (#11459)
|
||||
Change: Move baseset missing/corrupted files label to list item (#11455)
|
||||
Change: Add horizontal scrollbar to Industry Directory window (#11434)
|
||||
Change: Improve layout of airport, dock, object, road/tram stop, train station pickers (#11430)
|
||||
Change: Display cargo lists in sorted cargo order (#11383)
|
||||
Change: Link houses production on industry chain graph by TPE_PASSENGERS or TPE_MAIL cargo (#11378)
|
||||
Change: Passenger subsidies are generated for any TPE_PASSENGER cargo type (#11378)
|
||||
Change: Towns generate cargo based on town production effect (#11378)
|
||||
Change: Always allow expanding towns in Scenario Editor to build new roads (#11377)
|
||||
Change: Don't set vehicle on time if timetable not started (#11359)
|
||||
Change: Store station blocked/wires/pylons flags in map (#11337)
|
||||
Change: Recover when possible from crashes during a crash (#11238)
|
||||
Change: Store crash logs in JSON format (#11232)
|
||||
Change: Remove autosave from settings window; it is already in the Game Options (#11218)
|
||||
Change: Enable "Forbid 90 degree turns" setting by default (#11160)
|
||||
Change: Do not allow mixing road/tram types in powered road type list (#11148)
|
||||
Change: Only show platform stopping location in orders when other than default (#11102)
|
||||
Change: Autorail / autoroad tools can start dragging from invalid tiles (#11089)
|
||||
Change: Only allow buying Exclusive Transport Rights when no one has them (#11076)
|
||||
Change: Remove currency code/symbol suffix from language files (#11061)
|
||||
Change: Add separate setting for server sent commands per frame limit (#11023)
|
||||
Change: Cargo flow legend only shows defined cargo (#10872)
|
||||
Change: Use "Via-Destination-Source" as default station cargodist display (#10851)
|
||||
Change: Preserve orders and related settings where possible when moving engines around in a train (#10799)
|
||||
Change: Standardise unit conversions and allow decimal places (#10795)
|
||||
Change: Use separate names for default stations/roadstops (#10786)
|
||||
Change: [MacOS] Require at least 10.15 to run the game (#10745)
|
||||
Change: Hide all variants from UI when (display) parent is hidden (#10708)
|
||||
Change: Split Game options into General, Graphics and Sound tabs (#10674)
|
||||
Change: Extend entity override manager and station spec lists to support 16 bit IDs (#10672)
|
||||
Change: Base autosaves intervals on real time (instead of game time) (#10655)
|
||||
Change: Allow overbuilding station and waypoint tiles (#10618)
|
||||
Change: Use realtime for Linkgraph update settings (#10610)
|
||||
Change: Make tick length 27 milliseconds (#10607)
|
||||
Change: Increase max cargo age and let min cargo payment approach zero (#10596)
|
||||
Change: Show buy company dialog window even when playing in the AI company (#10459)
|
||||
Change: Use HTTPS for content-service connections (#10448)
|
||||
Change: Big UFO disaster targets current location of a random train (#10290)
|
||||
Change: Remove land generator setting from World Generation GUI (#10093)
|
||||
Change: Build signals to the next junction when dragging regardless of the Ctrl state (#9637)
|
||||
Change: Allow dedicated server to use threaded saves (#10787)
|
||||
Change: [NewGRF] Increase vehicle random data from 8 to 16 bits (#10701)
|
||||
Change: [NewGRF] Read Action 3 IDs as extended-bytes for all features (#10672)
|
||||
Change: [NewGRF] Make Action 3 debug messages more consistent (#10672)
|
||||
Change: [NewGRF] Extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' (#10666)
|
||||
Change: [Script] Replace easy/medium/hard values with default value (#11959)
|
||||
Change: [Script] Limit total script ops that can be consumed by a list valuate (#11670)
|
||||
Change: [Script] Allow GS access to ScriptGroup, ScriptGameSettings.IsDisabledVehicleType, more ScriptCompany and more ScriptOrder functions (#10642)
|
||||
Change: [Script] Improve ScriptText validation error messages (#10545)
|
||||
Change: [Script] Restore support of {RAW_STRING} in ScriptText (#10492)
|
||||
Change: [Script] Validate ScriptText parameters type and amount (#10492)
|
||||
Change: [Script] Automate the ScriptObject reference counting (#10492)
|
||||
Change: [Script] Extract params info from GS strings (#10492)
|
||||
Change: [Script] A ScriptText with too many parameters is now a fatal error (#10483)
|
||||
Change: [Script] Log AI/GS Squirrel crashes in white text for readability (#10375)
|
||||
Fix #11918: Houses should only build next to road stops, not any station type (#11919)
|
||||
Fix #11827: Make text layouter aware of ligatures (#11831)
|
||||
Fix #11752: Characters could be repeated when wrapping multi-line text (#11761)
|
||||
Fix #11748: Decreasing service interval value sufficiently would result in it wrapping around (#11749)
|
||||
Fix #11629: Crash when getting the nearest town for rotated airports (#11631)
|
||||
Fix #11516: Adjust window size by interface scale during ReInit (#11517)
|
||||
Fix #11515: Changing interface scale could have unintended effects on zoom level (#11615)
|
||||
Fix #11442: "Default" colour in group colour window is not updated when changing master colour (#11614)
|
||||
Fix #11437: Flipped shorter rail vehicles disappear in windows (#11446)
|
||||
Fix #11413: Incorrect sorting by industry production (#11414)
|
||||
Fix #11407: Don't steal focus from dropdown menus (#11484)
|
||||
Fix #11402: Make string filter locale-aware (#11426)
|
||||
Fix #11329: Don't assert vehicle list length is non-zero when only asked to set string parameter (#11330)
|
||||
Fix #11315: Sort industries and cargoes by name in industry chain window (#11317)
|
||||
Fix #11307: Incorrect GroupStatistics after selling leading wagon (#11311)
|
||||
Fix #11261: Airport menu selectability after closing window on a class with no available airports (#11344)
|
||||
Fix #11230: Sort by button in group list window could be misaligned (#11231)
|
||||
Fix #11215: Assert in NewGRF parameters window (manual parameter mode) (#11217)
|
||||
Fix #11203: [Linux] Crash when editing CJK characters in edit box (#11204)
|
||||
Fix #11180: Aircraft crashes could point to the wrong tile (#11184)
|
||||
Fix #11164: Don't create duplicate town names when using 'Many random towns' in the scenario editor (#11165)
|
||||
Fix #11162: Second company colour was not consistently applied to articulated vehicles (#11163)
|
||||
Fix #11115: Focus the abandon game/exit game windows (#11125)
|
||||
Fix #11096: Increase priority of error and confirmation windows (#11104)
|
||||
Fix #11087: Disable base graphics/sound dropdown outside main menu (#11091)
|
||||
Fix #11054: Prevent translation of currency codes (#11061)
|
||||
Fix #11026: Use real engine name instead of default name for filtering (#11033)
|
||||
Fix #10982: No help text for gamelog command (#10984)
|
||||
Fix #10880: Crash in object window due to incorrect parameter order (#10881)
|
||||
Fix #10868: Crash when Script tries to load large savegame data (#11029)
|
||||
Fix #10811: Allow dragging vehicle in depot to any free row (#11508)
|
||||
Fix #10660: Sprite Font scale affected by viewport zoom level limits (#10668)
|
||||
Fix #10619: Crash loading linkgraph for older savegames (#10620)
|
||||
Fix #10600: 'Replace Vehicles' didn't show numbers >999 (#10680)
|
||||
Fix #10578: Allow to select any version of AI/GS from GUI (#10604)
|
||||
Fix #10522: Link graph tooltip vertical lines were not handled correctly (#10524)
|
||||
Fix #10511: Don't search for depot every tick if one cannot be found (#11548)
|
||||
Fix #10478: Clarify airport noise control setting texts (#11169)
|
||||
Fix #10452: Prevent long stalls during river generation (#11544)
|
||||
Fix #10430: Display chain window causing assert (#10431)
|
||||
Fix #10343: Don't extend town-disallowed roadtypes (#10347)
|
||||
Fix #10251: [MacOS] Screen looks blue-ish when using newer SDKs (#11207)
|
||||
Fix #10222: Adjust line drawing algorithm (#10491)
|
||||
Fix #10131: Actually cancel downloads when pressing cancel (#10485)
|
||||
Fix #10118: Cycle through current signal group, not just path signals (#11798)
|
||||
Fix #10439: [Script] Validate story page button colour, flags, cursor and vehicle type (#11892)
|
||||
Fix #10438: [Script] Validate story page element type for ScriptStoryPage::NewElement (#11888)
|
||||
Fix #9865: Removing files with the console always failed
|
||||
Fix #9810: Rebuilding a through road stop costs money (#9852)
|
||||
Fix #9722: Crash when pressing hotkeys early in world generation (#11858)
|
||||
Fix #9697: Limit the default width of the Online Players window (#11936)
|
||||
Fix #9642: Keep infrastructure totals when overbuilding road depots (#11229)
|
||||
Fix #9545: Crash when all cargo types are disabled (#11432)
|
||||
Fix #8846: When upgrading NewGRF presets, copy NewGRF parameters only if the NewGRF are compatible (#11348)
|
||||
Fix #8253: Improve profit graph when having lots of money (#11915)
|
||||
Fix #6377: Two tarballs with the same folder in them were considered as one (#11855)
|
||||
Fix #5713: Ships could be sent to unreachable depots (#11768)
|
||||
Fix #4575: Use Latin 'l' in English translation of zloty (#11090)
|
||||
Fix #4415: Land info build date is also renovation date (#11759)
|
||||
Fix: Display rank correctly with more than 15 companies in a league table (#11940)
|
||||
Fix: Extra refit button when train/RV is in a depot (#11904)
|
||||
Fix: Update server listing as offline when unexpected disconnect during refresh (#11891)
|
||||
Fix: Horizontal scale of framerate window switched excessively (#11813)
|
||||
Fix: [Linux] Various issues with resolutions and fullscreen in multi-display setups (#11778, #11779)
|
||||
Fix: Build button text when train purchase window using "Engines" filter (#11755)
|
||||
Fix: One-way state remained after removing road from road and tram tile (#11745)
|
||||
Fix: Draw video driver info at the correct size and text wrap (#10716)
|
||||
Fix: Language genders could not be applied to SCC_INDUSTRY_NAME (#11697)
|
||||
Fix: Spurious cancellations of HTTP content downloads (#11668)
|
||||
Fix: Calculation of initial engine age was inaccurate (#11660)
|
||||
Fix: Prevent underflow if engine base life is less than 8 years (#11635)
|
||||
Fix: Changing default livery did not propagate to group liveries (#11633)
|
||||
Fix: Window width/height was doubly-scaled with automatic DPI switch (#11598)
|
||||
Fix: Don't crash when saving a crashlog save with no main window open (#11586)
|
||||
Fix: Prevent overflow when calculating max town noise (#11564)
|
||||
Fix: Deleting towns did not check for waypoints referencing the town (#11513)
|
||||
Fix: Invalidate playlist window when (un)shuffling playlist (#11504)
|
||||
Fix: Restore original cargo legend 'blob' dimensions (#11480)
|
||||
Fix: Extmidi did not move on to next song after playing ends (#11469)
|
||||
Fix: Server password length in the UI was unnecessarily limited (#11408)
|
||||
Fix: OpenTTD can fail to exit on an error due to mutex locks in threads (#11398)
|
||||
Fix: Scale minimum width for server name by interface scale (#11381)
|
||||
Fix: Server connection was not closed when relay window was closed (#11366)
|
||||
Fix: Upgrading NewGRF presets could result in incomplete display of NewGRF parameters until restart (#11348)
|
||||
Fix: Check for engine variant loops during NewGRF initialization (#11343)
|
||||
Fix: Don't allow industries to produce invalid cargo (#11314)
|
||||
Fix: Also apply cargo filters on shared groups in vehicle listing (#11294)
|
||||
Fix: Only count distance traveled in vehicles for cargo payment (#11283)
|
||||
Fix: Base cargo payment on load/unload tile, instead of station sign location (#11281)
|
||||
Fix: Crash when opening a damaged base-graphics (#11275)
|
||||
Fix: Trivial autoreplace of mixed cargo articulated engines (#11253)
|
||||
Fix: [Emscripten] Config not saved on exit (#11248)
|
||||
Fix: Inaccurate waiting cargo total in station window when using cargodist (#11213)
|
||||
Fix: No fast forward in network was ensured only from GUI side (#11206)
|
||||
Fix: Crash when not passing command-line parameter for -n (#11153)
|
||||
Fix: [Bootstrap] Don't crash when failing to connect to content server (#11122)
|
||||
Fix: Crash when failing to load a game into a dedicated server at startup (#11021)
|
||||
Fix: Don't allow changing settings over the network that are marked as local settings (#11009)
|
||||
Fix: Move no_http_content_downloads and use_relay_service to private settings (#10762)
|
||||
Fix: Extra viewport could not be scrolled with right-click-close (#10644)
|
||||
Fix: Specify units for value of share trading age setting (#10612)
|
||||
Fix: Road type is not available before its introduction date (#10585)
|
||||
Fix: Do not update a RV's Z-position when stationary while turning (#10570)
|
||||
Fix: Don't (briefly) switch from title-only playlist on menu screen (#10553)
|
||||
Fix: Reset content download progress to zero if falling back to TCP (#10485)
|
||||
Fix: Make script goals work with the whole range of ClientIDs (#10435)
|
||||
Fix: [NewGRF] Tile slope missing from road stops varact2 variable 0x42 (#11373)
|
||||
Fix: [NewGRF] House class mappings were not reset between games (#11279)
|
||||
Fix: [NewGRF] Profile didn't stop if there were no events yet (#10816)
|
||||
Fix: [NewGRF] Support more than 256 stations/waypoints/roadstops per class (#10793)
|
||||
Fix: [NewGRF] Var68 for station and roadstop was broken (#10784)
|
||||
Fix: [NewGRF] Object and road stop ignore property handlers (#10525)
|
||||
Fix: [Script] Apply random deviation to settings only at script start (#11944)
|
||||
Fix: [Script] Improve ScriptText validation (#11721)
|
||||
Fix: [Script] GSAdmin.Send() could generate invalid JSON (#11250)
|
||||
Fix: [Script] Crash if squirrel compatibility scripts cannot be parsed (#11589)
|
||||
Fix: [Script] Don't list unavailable road types for game scripts (#10585)
|
||||
Fix: [Script] Game scripts were able to build with non-existing road types (#10539)
|
||||
Fix: [Script] Inconsistent precondition failure return values (#10533)
|
||||
Fix: [Script] Crash when companies disappear (#10529)
|
||||
Fix: [Script] ScriptBase::Rand() return value could return negative values (#10443)
|
||||
Fix: [Script] Incorrect value for GOAL_INVALID (#10436)
|
||||
Fix: [Script] Extend Script::IsValidVehicle to check for primary vehicles (#10386)
|
||||
Remove: "generation_seed" from config, as it was a write-only value (#11927)
|
||||
Remove: Debug redirect over network (#11776)
|
||||
Remove: Officially mark Vista as no longer supported (#11531)
|
||||
Remove: OS/2 and SunOS ports (#11018, #11210)
|
||||
Remove: Obsolete NewGRF text unprinting (#10884)
|
||||
Remove: [Script] CONFIG_RANDOM from AddSetting flags (#11942)
|
||||
|
||||
|
||||
13.4 (2023-07-29)
|
||||
------------------------------------------------------------------------
|
||||
Fix: Setting tree lines drawn incorrectly for RTL languages (#11070)
|
||||
|
|
|
@ -4559,7 +4559,14 @@ STR_ORDER_DROP_GO_ALWAYS_DEPOT :Always go
|
|||
STR_ORDER_DROP_SERVICE_DEPOT :Service if needed
|
||||
STR_ORDER_DROP_HALT_DEPOT :Stop
|
||||
STR_ORDER_DROP_UNBUNCH :Unbunch
|
||||
STR_ORDER_DEPOT_ACTION_TOOLTIP :{BLACK}Select the action to take at this depot
|
||||
|
||||
# Depot action tooltips, one per vehicle type
|
||||
###length VEHICLE_TYPES
|
||||
STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP :{BLACK}Select the action to take at this depot
|
||||
STR_ORDER_ROAD_DEPOT_ACTION_TOOLTIP :{BLACK}Select the action to take at this depot
|
||||
STR_ORDER_SHIP_DEPOT_ACTION_TOOLTIP :{BLACK}Select the action to take at this depot
|
||||
STR_ORDER_HANGAR_ACTION_TOOLTIP :{BLACK}Select the action to take at this hangar
|
||||
###next-name-looks-similar
|
||||
|
||||
STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP :{BLACK}Vehicle data to base jumping on
|
||||
|
||||
|
@ -5105,7 +5112,6 @@ STR_ERROR_UNBUNCHING_NO_FULL_LOAD :{WHITE}... cann
|
|||
STR_ERROR_UNBUNCHING_NO_UNBUNCHING_FULL_LOAD :{WHITE}... cannot unbunch a vehicle with a full load order
|
||||
STR_ERROR_UNBUNCHING_NO_CONDITIONAL :{WHITE}... cannot use conditional orders when vehicle has an unbunching order
|
||||
STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL :{WHITE}... cannot unbunch a vehicle with a conditional order
|
||||
STR_ERROR_UNBUNCHING_NO_SERVICE_IF_NEEDED :{WHITE}... vehicle must always visit the depot to unbunch there
|
||||
|
||||
# Autoreplace related errors
|
||||
STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} is too long after replacement
|
||||
|
|
|
@ -155,7 +155,6 @@ ClientNetworkGameSocketHandler::~ClientNetworkGameSocketHandler()
|
|||
assert(ClientNetworkGameSocketHandler::my_client == this);
|
||||
ClientNetworkGameSocketHandler::my_client = nullptr;
|
||||
|
||||
delete this->savegame;
|
||||
delete this->GetInfo();
|
||||
}
|
||||
|
||||
|
@ -567,7 +566,7 @@ bool ClientNetworkGameSocketHandler::IsConnected()
|
|||
* DEF_CLIENT_RECEIVE_COMMAND has parameter: Packet *p
|
||||
************/
|
||||
|
||||
extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr);
|
||||
extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, std::shared_ptr<struct LoadFilter> lf);
|
||||
|
||||
NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *)
|
||||
{
|
||||
|
@ -810,7 +809,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packe
|
|||
|
||||
if (this->savegame != nullptr) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
|
||||
|
||||
this->savegame = new PacketReader();
|
||||
this->savegame = std::make_shared<PacketReader>();
|
||||
|
||||
_frame_counter = _frame_counter_server = _frame_counter_max = p->Recv_uint32();
|
||||
|
||||
|
@ -864,20 +863,12 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet
|
|||
_network_join_status = NETWORK_JOIN_STATUS_PROCESSING;
|
||||
SetWindowDirty(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
|
||||
|
||||
/*
|
||||
* Make sure everything is set for reading.
|
||||
*
|
||||
* We need the local copy and reset this->savegame because when
|
||||
* loading fails the network gets reset upon loading the intro
|
||||
* game, which would cause us to free this->savegame twice.
|
||||
*/
|
||||
LoadFilter *lf = this->savegame;
|
||||
this->savegame = nullptr;
|
||||
lf->Reset();
|
||||
this->savegame->Reset();
|
||||
|
||||
/* The map is done downloading, load it */
|
||||
ClearErrorMessages();
|
||||
bool load_success = SafeLoad({}, SLO_LOAD, DFT_GAME_FILE, GM_NORMAL, NO_DIRECTORY, lf);
|
||||
bool load_success = SafeLoad({}, SLO_LOAD, DFT_GAME_FILE, GM_NORMAL, NO_DIRECTORY, this->savegame);
|
||||
this->savegame = nullptr;
|
||||
|
||||
/* Long savegame loads shouldn't affect the lag calculation! */
|
||||
this->last_packet = std::chrono::steady_clock::now();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
class ClientNetworkGameSocketHandler : public ZeroedMemoryAllocator, public NetworkGameSocketHandler {
|
||||
private:
|
||||
std::string connection_string; ///< Address we are connected to.
|
||||
struct PacketReader *savegame; ///< Packet reader for reading the savegame.
|
||||
std::shared_ptr<struct PacketReader> savegame; ///< Packet reader for reading the savegame.
|
||||
byte token; ///< The token we need to send back to the server to prove we're the right client.
|
||||
|
||||
/** Status of the connection with the server. */
|
||||
|
|
|
@ -576,7 +576,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
|
|||
Debug(net, 9, "client[{}] SendMap(): first_packet", this->client_id);
|
||||
|
||||
WaitTillSaved();
|
||||
this->savegame = new PacketWriter(this);
|
||||
this->savegame = std::make_shared<PacketWriter>(this);
|
||||
|
||||
/* Now send the _frame_counter and how many packets are coming */
|
||||
Packet *p = new Packet(PACKET_SERVER_MAP_BEGIN);
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
CommandQueue outgoing_queue; ///< The command-queue awaiting delivery
|
||||
size_t receive_limit; ///< Amount of bytes that we can receive at this moment
|
||||
|
||||
struct PacketWriter *savegame; ///< Writer used to write the savegame.
|
||||
std::shared_ptr<struct PacketWriter> savegame; ///< Writer used to write the savegame.
|
||||
NetworkAddress client_address; ///< IP-address of the client (so they can be banned)
|
||||
|
||||
ServerNetworkGameSocketHandler(SOCKET s);
|
||||
|
|
|
@ -966,7 +966,7 @@ static void MakeNewEditorWorld()
|
|||
* @param subdir default directory to look for filename, set to 0 if not needed
|
||||
* @param lf Load filter to use, if nullptr: use filename + subdir.
|
||||
*/
|
||||
bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr)
|
||||
bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, std::shared_ptr<LoadFilter> lf = nullptr)
|
||||
{
|
||||
assert(fop == SLO_LOAD);
|
||||
assert(dft == DFT_GAME_FILE || (lf == nullptr && dft == DFT_OLD_GAME_FILE));
|
||||
|
|
|
@ -1300,9 +1300,6 @@ CommandCost CmdModifyOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
|||
|
||||
case MOF_DEPOT_ACTION:
|
||||
if (data >= DA_END) return CMD_ERROR;
|
||||
/* The vehicle must always go to the depot (not just if it needs servicing) in order to unbunch there. */
|
||||
if ((data == DA_SERVICE) && (order->GetDepotActionType() & ODATFB_UNBUNCH)) return_cmd_error(STR_ERROR_UNBUNCHING_NO_SERVICE_IF_NEEDED);
|
||||
|
||||
/* Check if we are allowed to add unbunching. We are always allowed to remove it. */
|
||||
if (data == DA_UNBUNCH) {
|
||||
/* Only one unbunching order is allowed in a vehicle's orders. If this order already has an unbunching action, no error is needed. */
|
||||
|
@ -1312,8 +1309,6 @@ CommandCost CmdModifyOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID se
|
|||
if (o->IsType(OT_CONDITIONAL)) return_cmd_error(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_CONDITIONAL);
|
||||
/* We don't allow unbunching if the vehicle has a full load order. */
|
||||
if (o->IsType(OT_GOTO_STATION) && o->GetLoadType() & (OLFB_FULL_LOAD | OLF_FULL_LOAD_ANY)) return_cmd_error(STR_ERROR_UNBUNCHING_NO_UNBUNCHING_FULL_LOAD);
|
||||
/* The vehicle must always go to the depot (not just if it needs servicing) in order to unbunch there. */
|
||||
if (o->IsType(OT_GOTO_DEPOT) && o->GetDepotOrderType() & ODTFB_SERVICE) return_cmd_error(STR_ERROR_UNBUNCHING_NO_SERVICE_IF_NEEDED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -785,6 +785,7 @@ public:
|
|||
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR);
|
||||
this->GetWidget<NWidgetCore>(WID_O_DEPOT_ACTION)->tool_tip = STR_ORDER_TRAIN_DEPOT_ACTION_TOOLTIP + v->type;
|
||||
this->FinishInitNested(v->index);
|
||||
|
||||
this->selected_order = -1;
|
||||
|
@ -1614,7 +1615,7 @@ static constexpr NWidgetPart _nested_orders_train_widgets[] = {
|
|||
NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_UNLOAD), SetMinimalSize(93, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0),
|
||||
NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_DEPOT_ACTION), SetMinimalSize(93, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_JUST_STRING, STR_ORDER_DEPOT_ACTION_TOOLTIP), SetResize(1, 0),
|
||||
SetDataTip(STR_JUST_STRING, STR_NULL), SetResize(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_RIGHT),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(93, 12), SetFill(1, 0), SetResize(1, 0), EndContainer(),
|
||||
|
@ -1692,7 +1693,7 @@ static constexpr NWidgetPart _nested_orders_widgets[] = {
|
|||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_REFIT), SetMinimalSize(186, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
|
||||
NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_DEPOT_ACTION), SetMinimalSize(124, 12), SetFill(1, 0),
|
||||
SetDataTip(STR_JUST_STRING, STR_ORDER_DEPOT_ACTION_TOOLTIP), SetResize(1, 0),
|
||||
SetDataTip(STR_JUST_STRING, STR_NULL), SetResize(1, 0),
|
||||
EndContainer(),
|
||||
|
||||
/* Buttons for setting a condition. */
|
||||
|
|
|
@ -88,14 +88,14 @@ struct ReadBuffer {
|
|||
byte buf[MEMORY_CHUNK_SIZE]; ///< Buffer we're going to read from.
|
||||
byte *bufp; ///< Location we're at reading the buffer.
|
||||
byte *bufe; ///< End of the buffer we can read from.
|
||||
LoadFilter *reader; ///< The filter used to actually read.
|
||||
std::shared_ptr<LoadFilter> reader; ///< The filter used to actually read.
|
||||
size_t read; ///< The amount of read bytes so far from the filter.
|
||||
|
||||
/**
|
||||
* Initialise our variables.
|
||||
* @param reader The filter to actually read data.
|
||||
*/
|
||||
ReadBuffer(LoadFilter *reader) : bufp(nullptr), bufe(nullptr), reader(reader), read(0)
|
||||
ReadBuffer(std::shared_ptr<LoadFilter> reader) : bufp(nullptr), bufe(nullptr), reader(reader), read(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ struct MemoryDumper {
|
|||
* Flush this dumper into a writer.
|
||||
* @param writer The filter we want to use.
|
||||
*/
|
||||
void Flush(SaveFilter *writer)
|
||||
void Flush(std::shared_ptr<SaveFilter> writer)
|
||||
{
|
||||
uint i = 0;
|
||||
size_t t = this->GetSize();
|
||||
|
@ -198,11 +198,11 @@ struct SaveLoadParams {
|
|||
int array_index, last_array_index; ///< in the case of an array, the current and last positions
|
||||
bool expect_table_header; ///< In the case of a table, if the header is saved/loaded.
|
||||
|
||||
MemoryDumper *dumper; ///< Memory dumper to write the savegame to.
|
||||
SaveFilter *sf; ///< Filter to write the savegame to.
|
||||
std::unique_ptr<MemoryDumper> dumper; ///< Memory dumper to write the savegame to.
|
||||
std::shared_ptr<SaveFilter> sf; ///< Filter to write the savegame to.
|
||||
|
||||
ReadBuffer *reader; ///< Savegame reading buffer.
|
||||
LoadFilter *lf; ///< Filter to read the savegame from.
|
||||
std::unique_ptr<ReadBuffer> reader; ///< Savegame reading buffer.
|
||||
std::shared_ptr<LoadFilter> lf; ///< Filter to read the savegame from.
|
||||
|
||||
StringID error_str; ///< the translatable error message to show
|
||||
std::string extra_msg; ///< the error message
|
||||
|
@ -2175,9 +2175,6 @@ struct FileReader : LoadFilter {
|
|||
{
|
||||
if (this->file != nullptr) fclose(this->file);
|
||||
this->file = nullptr;
|
||||
|
||||
/* Make sure we don't double free. */
|
||||
_sl.sf = nullptr;
|
||||
}
|
||||
|
||||
size_t Read(byte *buf, size_t size) override
|
||||
|
@ -2213,9 +2210,6 @@ struct FileWriter : SaveFilter {
|
|||
~FileWriter()
|
||||
{
|
||||
this->Finish();
|
||||
|
||||
/* Make sure we don't double free. */
|
||||
_sl.sf = nullptr;
|
||||
}
|
||||
|
||||
void Write(byte *buf, size_t size) override
|
||||
|
@ -2249,7 +2243,7 @@ struct LZOLoadFilter : LoadFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
LZOLoadFilter(LoadFilter *chain) : LoadFilter(chain)
|
||||
LZOLoadFilter(std::shared_ptr<LoadFilter> chain) : LoadFilter(chain)
|
||||
{
|
||||
if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor");
|
||||
}
|
||||
|
@ -2296,7 +2290,7 @@ struct LZOSaveFilter : SaveFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
LZOSaveFilter(SaveFilter *chain, byte) : SaveFilter(chain)
|
||||
LZOSaveFilter(std::shared_ptr<SaveFilter> chain, byte) : SaveFilter(chain)
|
||||
{
|
||||
if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor");
|
||||
}
|
||||
|
@ -2336,7 +2330,7 @@ struct NoCompLoadFilter : LoadFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
NoCompLoadFilter(LoadFilter *chain) : LoadFilter(chain)
|
||||
NoCompLoadFilter(std::shared_ptr<LoadFilter> chain) : LoadFilter(chain)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2352,7 +2346,7 @@ struct NoCompSaveFilter : SaveFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
NoCompSaveFilter(SaveFilter *chain, byte) : SaveFilter(chain)
|
||||
NoCompSaveFilter(std::shared_ptr<SaveFilter> chain, byte) : SaveFilter(chain)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2378,7 +2372,7 @@ struct ZlibLoadFilter : LoadFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
ZlibLoadFilter(LoadFilter *chain) : LoadFilter(chain)
|
||||
ZlibLoadFilter(std::shared_ptr<LoadFilter> chain) : LoadFilter(chain)
|
||||
{
|
||||
memset(&this->z, 0, sizeof(this->z));
|
||||
if (inflateInit(&this->z) != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor");
|
||||
|
@ -2423,7 +2417,7 @@ struct ZlibSaveFilter : SaveFilter {
|
|||
* @param chain The next filter in this chain.
|
||||
* @param compression_level The requested level of compression.
|
||||
*/
|
||||
ZlibSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain)
|
||||
ZlibSaveFilter(std::shared_ptr<SaveFilter> chain, byte compression_level) : SaveFilter(chain)
|
||||
{
|
||||
memset(&this->z, 0, sizeof(this->z));
|
||||
if (deflateInit(&this->z, compression_level) != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor");
|
||||
|
@ -2507,7 +2501,7 @@ struct LZMALoadFilter : LoadFilter {
|
|||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
LZMALoadFilter(LoadFilter *chain) : LoadFilter(chain), lzma(_lzma_init)
|
||||
LZMALoadFilter(std::shared_ptr<LoadFilter> chain) : LoadFilter(chain), lzma(_lzma_init)
|
||||
{
|
||||
/* Allow saves up to 256 MB uncompressed */
|
||||
if (lzma_auto_decoder(&this->lzma, 1 << 28, 0) != LZMA_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor");
|
||||
|
@ -2551,7 +2545,7 @@ struct LZMASaveFilter : SaveFilter {
|
|||
* @param chain The next filter in this chain.
|
||||
* @param compression_level The requested level of compression.
|
||||
*/
|
||||
LZMASaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain), lzma(_lzma_init)
|
||||
LZMASaveFilter(std::shared_ptr<SaveFilter> chain, byte compression_level) : SaveFilter(chain), lzma(_lzma_init)
|
||||
{
|
||||
if (lzma_easy_encoder(&this->lzma, compression_level, LZMA_CHECK_CRC32) != LZMA_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor");
|
||||
}
|
||||
|
@ -2611,8 +2605,8 @@ struct SaveLoadFormat {
|
|||
const char *name; ///< name of the compressor/decompressor (debug-only)
|
||||
uint32_t tag; ///< the 4-letter tag by which it is identified in the savegame
|
||||
|
||||
LoadFilter *(*init_load)(LoadFilter *chain); ///< Constructor for the load filter.
|
||||
SaveFilter *(*init_write)(SaveFilter *chain, byte compression); ///< Constructor for the save filter.
|
||||
std::shared_ptr<LoadFilter> (*init_load)(std::shared_ptr<LoadFilter> chain); ///< Constructor for the load filter.
|
||||
std::shared_ptr<SaveFilter> (*init_write)(std::shared_ptr<SaveFilter> chain, byte compression); ///< Constructor for the save filter.
|
||||
|
||||
byte min_compression; ///< the minimum compression level of this format
|
||||
byte default_compression; ///< the default compression level of this format
|
||||
|
@ -2717,16 +2711,9 @@ static void ResetSaveloadData()
|
|||
*/
|
||||
static inline void ClearSaveLoadState()
|
||||
{
|
||||
delete _sl.dumper;
|
||||
_sl.dumper = nullptr;
|
||||
|
||||
delete _sl.sf;
|
||||
_sl.sf = nullptr;
|
||||
|
||||
delete _sl.reader;
|
||||
_sl.reader = nullptr;
|
||||
|
||||
delete _sl.lf;
|
||||
_sl.lf = nullptr;
|
||||
}
|
||||
|
||||
|
@ -2839,11 +2826,11 @@ void WaitTillSaved()
|
|||
* @param threaded Whether to try to perform the saving asynchronously.
|
||||
* @return Return the result of the action. #SL_OK or #SL_ERROR
|
||||
*/
|
||||
static SaveOrLoadResult DoSave(SaveFilter *writer, bool threaded)
|
||||
static SaveOrLoadResult DoSave(std::shared_ptr<SaveFilter> writer, bool threaded)
|
||||
{
|
||||
assert(!_sl.saveinprogress);
|
||||
|
||||
_sl.dumper = new MemoryDumper();
|
||||
_sl.dumper = std::make_unique<MemoryDumper>();
|
||||
_sl.sf = writer;
|
||||
|
||||
_sl_version = SAVEGAME_VERSION;
|
||||
|
@ -2871,7 +2858,7 @@ static SaveOrLoadResult DoSave(SaveFilter *writer, bool threaded)
|
|||
* @param threaded Whether to try to perform the saving asynchronously.
|
||||
* @return Return the result of the action. #SL_OK or #SL_ERROR
|
||||
*/
|
||||
SaveOrLoadResult SaveWithFilter(SaveFilter *writer, bool threaded)
|
||||
SaveOrLoadResult SaveWithFilter(std::shared_ptr<SaveFilter> writer, bool threaded)
|
||||
{
|
||||
try {
|
||||
_sl.action = SLA_SAVE;
|
||||
|
@ -2888,7 +2875,7 @@ SaveOrLoadResult SaveWithFilter(SaveFilter *writer, bool threaded)
|
|||
* @param load_check Whether to perform the checking ("preview") or actually load the game.
|
||||
* @return Return the result of the action. #SL_OK or #SL_REINIT ("unload" the game)
|
||||
*/
|
||||
static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
||||
static SaveOrLoadResult DoLoad(std::shared_ptr<LoadFilter> reader, bool load_check)
|
||||
{
|
||||
_sl.lf = reader;
|
||||
|
||||
|
@ -2950,7 +2937,7 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
|||
}
|
||||
|
||||
_sl.lf = fmt->init_load(_sl.lf);
|
||||
_sl.reader = new ReadBuffer(_sl.lf);
|
||||
_sl.reader = std::make_unique<ReadBuffer>(_sl.lf);
|
||||
_next_offs = 0;
|
||||
|
||||
if (!load_check) {
|
||||
|
@ -3027,7 +3014,7 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
|
|||
* @param reader The filter to read the savegame from.
|
||||
* @return Return the result of the action. #SL_OK or #SL_REINIT ("unload" the game)
|
||||
*/
|
||||
SaveOrLoadResult LoadWithFilter(LoadFilter *reader)
|
||||
SaveOrLoadResult LoadWithFilter(std::shared_ptr<LoadFilter> reader)
|
||||
{
|
||||
try {
|
||||
_sl.action = SLA_LOAD;
|
||||
|
@ -3114,13 +3101,13 @@ SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop,
|
|||
Debug(desync, 1, "save: {:08x}; {:02x}; {}", TimerGameEconomy::date, TimerGameEconomy::date_fract, filename);
|
||||
if (!_settings_client.gui.threaded_saves) threaded = false;
|
||||
|
||||
return DoSave(new FileWriter(fh), threaded);
|
||||
return DoSave(std::make_shared<FileWriter>(fh), threaded);
|
||||
}
|
||||
|
||||
/* LOAD game */
|
||||
assert(fop == SLO_LOAD || fop == SLO_CHECK);
|
||||
Debug(desync, 1, "load: {}", filename);
|
||||
return DoLoad(new FileReader(fh), fop == SLO_CHECK);
|
||||
return DoLoad(std::make_shared<FileReader>(fh), fop == SLO_CHECK);
|
||||
} catch (...) {
|
||||
/* This code may be executed both for old and new save games. */
|
||||
ClearSaveLoadState();
|
||||
|
|
|
@ -421,8 +421,8 @@ void DoExitSave();
|
|||
|
||||
void DoAutoOrNetsave(FiosNumberedSaveName &counter);
|
||||
|
||||
SaveOrLoadResult SaveWithFilter(struct SaveFilter *writer, bool threaded);
|
||||
SaveOrLoadResult LoadWithFilter(struct LoadFilter *reader);
|
||||
SaveOrLoadResult SaveWithFilter(std::shared_ptr<struct SaveFilter> writer, bool threaded);
|
||||
SaveOrLoadResult LoadWithFilter(std::shared_ptr<struct LoadFilter> reader);
|
||||
|
||||
typedef void AutolengthProc(void *arg);
|
||||
|
||||
|
|
|
@ -13,20 +13,19 @@
|
|||
/** Interface for filtering a savegame till it is loaded. */
|
||||
struct LoadFilter {
|
||||
/** Chained to the (savegame) filters. */
|
||||
LoadFilter *chain;
|
||||
std::shared_ptr<LoadFilter> chain;
|
||||
|
||||
/**
|
||||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
LoadFilter(LoadFilter *chain) : chain(chain)
|
||||
LoadFilter(std::shared_ptr<LoadFilter> chain) : chain(chain)
|
||||
{
|
||||
}
|
||||
|
||||
/** Make sure the writers are properly closed. */
|
||||
virtual ~LoadFilter()
|
||||
{
|
||||
delete this->chain;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,28 +50,27 @@ struct LoadFilter {
|
|||
* @param chain The next filter in this chain.
|
||||
* @tparam T The type of load filter to create.
|
||||
*/
|
||||
template <typename T> LoadFilter *CreateLoadFilter(LoadFilter *chain)
|
||||
template <typename T> std::shared_ptr<LoadFilter> CreateLoadFilter(std::shared_ptr<LoadFilter> chain)
|
||||
{
|
||||
return new T(chain);
|
||||
return std::make_shared<T>(chain);
|
||||
}
|
||||
|
||||
/** Interface for filtering a savegame till it is written. */
|
||||
struct SaveFilter {
|
||||
/** Chained to the (savegame) filters. */
|
||||
SaveFilter *chain;
|
||||
std::shared_ptr<SaveFilter> chain;
|
||||
|
||||
/**
|
||||
* Initialise this filter.
|
||||
* @param chain The next filter in this chain.
|
||||
*/
|
||||
SaveFilter(SaveFilter *chain) : chain(chain)
|
||||
SaveFilter(std::shared_ptr<SaveFilter> chain) : chain(chain)
|
||||
{
|
||||
}
|
||||
|
||||
/** Make sure the writers are properly closed. */
|
||||
virtual ~SaveFilter()
|
||||
{
|
||||
delete this->chain;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,9 +95,9 @@ struct SaveFilter {
|
|||
* @param compression_level The requested level of compression.
|
||||
* @tparam T The type of save filter to create.
|
||||
*/
|
||||
template <typename T> SaveFilter *CreateSaveFilter(SaveFilter *chain, byte compression_level)
|
||||
template <typename T> std::shared_ptr<SaveFilter> CreateSaveFilter(std::shared_ptr<SaveFilter> chain, byte compression_level)
|
||||
{
|
||||
return new T(chain, compression_level);
|
||||
return std::make_shared<T>(chain, compression_level);
|
||||
}
|
||||
|
||||
#endif /* SAVELOAD_FILTER_H */
|
||||
|
|
Loading…
Reference in New Issue