Skip to content

Commit

Permalink
(svn r27598) -Fix: Company 0 could accept engine previews before they…
Browse files Browse the repository at this point in the history
… were offered.
  • Loading branch information
frosch123 committed Jun 9, 2016
1 parent 4bd149d commit ee9a54c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit ee9a54c

Please sign in to comment.