Fix AfterLoadTemplateVehiclesUpdateImage clobbering the random seeds.

This broke MP games with template replacement trains.
This commit is contained in:
Jonathan G Rennison
2016-03-21 21:18:04 +00:00
parent 6741c98f6b
commit 31136bac50

View File

@@ -4,6 +4,7 @@
#include "../tbtr_template_vehicle_func.h" #include "../tbtr_template_vehicle_func.h"
#include "../train.h" #include "../train.h"
#include "../core/backup_type.hpp" #include "../core/backup_type.hpp"
#include "../core/random_func.hpp"
#include "saveload.h" #include "saveload.h"
@@ -101,6 +102,9 @@ void AfterLoadTemplateVehiclesUpdateImage()
{ {
TemplateVehicle *tv; TemplateVehicle *tv;
SavedRandomSeeds saved_seeds;
SaveRandomSeeds(&saved_seeds);
FOR_ALL_TEMPLATES(tv) { FOR_ALL_TEMPLATES(tv) {
if (tv->Prev() == NULL) { if (tv->Prev() == NULL) {
Backup<CompanyByte> cur_company(_current_company, tv->owner, FILE_LINE); Backup<CompanyByte> cur_company(_current_company, tv->owner, FILE_LINE);
@@ -128,6 +132,8 @@ void AfterLoadTemplateVehiclesUpdateImage()
cur_company.Restore(); cur_company.Restore();
} }
} }
RestoreRandomSeeds(saved_seeds);
} }
extern const ChunkHandler _template_vehicle_chunk_handlers[] = { extern const ChunkHandler _template_vehicle_chunk_handlers[] = {