Merge branch 'template_train_replacement' into jgrpp
# Conflicts: # src/economy.cpp # src/network/network_command.cpp # src/saveload/extended_ver_sl.cpp
This commit is contained in:
@@ -68,7 +68,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", NULL, NULL, NULL },
|
||||
{ XSLFI_VEH_LIFETIME_PROFIT, XSCF_NULL, 1, 1, "veh_lifetime_profit", NULL, NULL, NULL },
|
||||
{ XSLFI_LINKGRAPH_DAY_SCALE, XSCF_NULL, 1, 1, "linkgraph_day_scale", NULL, NULL, NULL },
|
||||
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 2, 2, "template_replacement", NULL, NULL, "TRPL,TMPL" },
|
||||
{ XSLFI_TEMPLATE_REPLACEMENT, XSCF_NULL, 3, 3, "template_replacement", NULL, NULL, "TRPL,TMPL" },
|
||||
{ XSLFI_MORE_RAIL_TYPES, XSCF_NULL, 1, 1, "more_rail_types", NULL, NULL, NULL },
|
||||
{ XSLFI_CARGO_TYPE_ORDERS, XSCF_NULL, 2, 2, "cargo_type_orders", NULL, NULL, "ORDX,VEOX" },
|
||||
{ XSLFI_EXTENDED_GAMELOG, XSCF_NULL, 1, 1, "extended_gamelog", NULL, NULL, NULL },
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "../tbtr_template_vehicle.h"
|
||||
#include "../tbtr_template_vehicle_func.h"
|
||||
#include "../train.h"
|
||||
#include "../company_base.h"
|
||||
#include "../core/backup_type.hpp"
|
||||
#include "../core/random_func.hpp"
|
||||
|
||||
@@ -107,6 +108,15 @@ void AfterLoadTemplateVehiclesUpdateImage()
|
||||
SavedRandomSeeds saved_seeds;
|
||||
SaveRandomSeeds(&saved_seeds);
|
||||
|
||||
if (!SlXvIsFeaturePresent(XSLFI_TEMPLATE_REPLACEMENT, 3)) {
|
||||
FOR_ALL_TEMPLATES(tv) {
|
||||
if (tv->Prev() == NULL && !Company::IsValidID(tv->owner)) {
|
||||
// clean up leftover template vehicles which no longer have a valid owner
|
||||
delete tv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FOR_ALL_TEMPLATES(tv) {
|
||||
if (tv->Prev() == NULL) {
|
||||
Backup<CompanyByte> cur_company(_current_company, tv->owner, FILE_LINE);
|
||||
|
Reference in New Issue
Block a user