Merge branch 'master' into jgrpp

# Conflicts:
#	src/vehicle_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-04-04 23:39:29 +01:00
3 changed files with 58 additions and 0 deletions

View File

@@ -32,6 +32,7 @@
#include "ship.h"
#include "newgrf.h"
#include "company_base.h"
#include "core/random_func.hpp"
#include "tbtr_template_vehicle.h"
#include "tbtr_template_vehicle_func.h"
@@ -139,6 +140,11 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
DoCommandFlag subflags = flags;
if (refitting) subflags |= DC_EXEC;
/* Vehicle construction needs random bits, so we have to save the random
* seeds to prevent desyncs. */
SavedRandomSeeds saved_seeds;
if (flags != subflags) SaveRandomSeeds(&saved_seeds);
Vehicle *v = NULL;
switch (type) {
case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;
@@ -187,6 +193,8 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
}
}
if (flags != subflags) RestoreRandomSeeds(saved_seeds);
return value;
}