From 0f6c5ee622e80522840df22c70b39cfa9482a0b2 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 11 Jul 2019 03:12:44 +0100 Subject: [PATCH 1/5] Fix saveload exception handling when gamelog action in progress --- src/gamelog.cpp | 5 +++++ src/saveload/saveload.cpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 46f86bcadf..8a809bd18f 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -65,6 +65,11 @@ void GamelogStopAction() if (print) GamelogPrintDebug(5); } +void GamelogStopActionIfStarted() +{ + if (_gamelog_action_type != GLAT_NONE) GamelogStopAction(); +} + /** * Frees the memory allocated by a gamelog */ diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index c76bfa67d8..6711b947b1 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -2663,6 +2663,9 @@ static inline void ClearSaveLoadState() delete _sl.lf; _sl.lf = nullptr; + + extern void GamelogStopActionIfStarted(); + GamelogStopActionIfStarted(); } /** From bba36aef1b2f6fbbe5fcb58daaebb7ff0bb39965 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 11 Jul 2019 03:15:40 +0100 Subject: [PATCH 2/5] TBTR: Check for mixed virtual/non-virtual consists on load --- src/saveload/vehicle_sl.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 3405066d38..69d9f9fa31 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -252,8 +252,13 @@ void AfterLoadVehicles(bool part_of_load) FOR_ALL_VEHICLES(v) { /* Reinstate the previous pointer */ - if (v->Next() != NULL) v->Next()->previous = v; - if (v->NextShared() != NULL) v->NextShared()->previous_shared = v; + if (v->Next() != nullptr) { + v->Next()->previous = v; + if (HasBit(v->subtype, GVSF_VIRTUAL) != HasBit(v->Next()->subtype, GVSF_VIRTUAL)) { + SlErrorCorrupt("Mixed virtual/non-virtual vehicle consist"); + } + } + if (v->NextShared() != nullptr) v->NextShared()->previous_shared = v; if (part_of_load) v->fill_percent_te_id = INVALID_TE_ID; v->first = NULL; From 4cf60613dfe5ab7581f05f971b990d119e14b373 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 11 Jul 2019 18:21:52 +0100 Subject: [PATCH 3/5] Delete windows before switching to GM_MENU mode in LoadIntroGame See: https://github.com/OpenTTD/OpenTTD/issues/7635 --- src/openttd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openttd.cpp b/src/openttd.cpp index af2b02082f..a407cbd555 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -403,6 +403,9 @@ static void ShutdownGame() */ static void LoadIntroGame(bool load_newgrfs = true) { + Window *v; + FOR_ALL_WINDOWS_FROM_FRONT(v) delete v; + _game_mode = GM_MENU; if (load_newgrfs) ResetGRFConfig(false); From eab5db97692c82afc11465887c9a16f698461ed4 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 11 Jul 2019 18:46:48 +0100 Subject: [PATCH 4/5] Fix corruption of conditional order targets when loading SpringPP savegames --- src/saveload/afterload.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 23e23f159a..55976e9dc9 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3464,7 +3464,9 @@ bool AfterLoadGame() /* convert wait for cargo orders to ordinary load if possible */ Order *order; FOR_ALL_ORDERS(order) { - if (order->GetLoadType() == static_cast(1)) order->SetLoadType(OLF_LOAD_IF_POSSIBLE); + if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_LOADING) || order->IsType(OT_IMPLICIT)) && order->GetLoadType() == static_cast(1)) { + order->SetLoadType(OLF_LOAD_IF_POSSIBLE); + } } } From 8b1fb60dea81279cab1f3a5aa8e25b993edffa1c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 13 Jul 2019 18:23:03 +0100 Subject: [PATCH 5/5] Version: Committing version data for tag: jgrpp-0.31.3 --- .ottdrev-vc | 4 ++-- README.md | 2 +- jgrpp-changelog.md | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.ottdrev-vc b/.ottdrev-vc index 7565d463ba..40abd5e45e 100644 --- a/.ottdrev-vc +++ b/.ottdrev-vc @@ -1,2 +1,2 @@ -jgrpp-0.31.2 20190617 0 7271fdda4c6aed75823b6efeab4971cfdc0e257d 1 0 -60c2f928566480ba695361b25e6181f58f54b6cd848625d0a3ba856f5a7cf898 - +jgrpp-0.31.3 20190711 0 eab5db97692c82afc11465887c9a16f698461ed4 1 0 +316e7b69e51a6cd40c766278bf4d4ffb0c833ac5466e13b1abce2f14c68ad124 - diff --git a/README.md b/README.md index a5f3f6ebac..b22b77f685 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## JGR's Patchpack version 0.31.2 +## JGR's Patchpack version 0.31.3 This is a collection of patches applied to [OpenTTD](http://www.openttd.org/) diff --git a/jgrpp-changelog.md b/jgrpp-changelog.md index 419d09ad98..9776d9be68 100644 --- a/jgrpp-changelog.md +++ b/jgrpp-changelog.md @@ -2,6 +2,15 @@ * * * +### v0.31.3 (2019-07-13) +* Fix the target order number of conditional order jumps being loaded incorrectly from SpringPP savegames. +* Fix order backups not being restored when using buy and refit. +* Fix rendering error when waypoint sign is moved. +* Fix virtual trains in the template train replacement editing window reserving a unit number. +* Re-add previously removed group collapse and expand all buttons. +* Fix compilation on MSVC. +* Bump trunk base from commit 66cd32a252ee0edab11448b560371878b2189223 to commit 21edf67f89c60351d5a0d84625455aa296b6b950. + ### v0.31.2 (2019-06-18) * Fix through load orders which use full load any cargo, with multi-cargo trains. * Fix PBS reservations not being shortened or extended when adding or removing signals to bridges/tunnels.