summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-06-09 19:04:53 +0000
committerfrosch <frosch@openttd.org>2016-06-09 19:04:53 +0000
commitee9a54c0a03770d340eb2a63582943e26f2c1cfe (patch)
tree52f85be805f196135bebb994a92e11d179160ea7 /src
parent4bd149d05af56849d68d34e73230bf32209cbd80 (diff)
downloadopenttd-ee9a54c0a03770d340eb2a63582943e26f2c1cfe.tar.xz
(svn r27598) -Fix: Company 0 could accept engine previews before they were offered.
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 9f9abcde0..56fab3e65 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -85,6 +85,7 @@ Engine::Engine(VehicleType type, EngineID base)
this->type = type;
this->grf_prop.local_id = base;
this->list_position = base;
+ this->preview_company = INVALID_COMPANY;
/* Check if this base engine is within the original engine data range */
if (base >= _engine_counts[type]) {
@@ -902,7 +903,7 @@ CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32
CommandCost CmdWantEnginePreview(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Engine *e = Engine::GetIfValid(p1);
- if (e == NULL || e->preview_company != _current_company) return CMD_ERROR;
+ if (e == NULL || !(e->flags & ENGINE_EXCLUSIVE_PREVIEW) || e->preview_company != _current_company) return CMD_ERROR;
if (flags & DC_EXEC) AcceptEnginePreview(p1, _current_company);