Merge branch 'template_train_replacement' into template_train_replacement-sx

This commit is contained in:
Jonathan G Rennison
2016-03-21 21:18:56 +00:00
4 changed files with 20 additions and 1 deletions

View File

@@ -3,6 +3,8 @@
#include "../tbtr_template_vehicle.h"
#include "../tbtr_template_vehicle_func.h"
#include "../train.h"
#include "../core/backup_type.hpp"
#include "../core/random_func.hpp"
#include "saveload.h"
@@ -100,8 +102,12 @@ void AfterLoadTemplateVehiclesUpdateImage()
{
TemplateVehicle *tv;
SavedRandomSeeds saved_seeds;
SaveRandomSeeds(&saved_seeds);
FOR_ALL_TEMPLATES(tv) {
if (tv->Prev() == NULL) {
Backup<CompanyByte> cur_company(_current_company, tv->owner, FILE_LINE);
StringID err;
Train* t = VirtualTrainFromTemplateVehicle(tv, err);
if (t != NULL) {
@@ -123,8 +129,11 @@ void AfterLoadTemplateVehiclesUpdateImage()
}
delete t;
}
cur_company.Restore();
}
}
RestoreRandomSeeds(saved_seeds);
}
extern const ChunkHandler _template_vehicle_chunk_handlers[] = {