TBTR: Fix virtual trains being created at load using wrong company.

Fix virtual trains showing up in company engine counts.
This commit is contained in:
Jonathan G Rennison
2016-03-21 18:22:29 +00:00
parent cf638e836a
commit 6741c98f6b
4 changed files with 14 additions and 1 deletions

View File

@@ -919,6 +919,10 @@ CommandCost CmdVirtualTrainFromTemplateVehicle(TileIndex tile, DoCommandFlag fla
return CMD_ERROR;
}
if (tv->owner != _current_company) {
return CMD_ERROR;
}
bool should_execute = (flags & DC_EXEC) != 0;
if (should_execute) {
@@ -940,6 +944,8 @@ Train* VirtualTrainFromTemplateVehicle(TemplateVehicle* tv, StringID &err)
CommandCost c;
Train *tmp, *head, *tail;
assert(tv->owner == _current_company);
head = CmdBuildVirtualRailVehicle(tv->engine_type, true, err);
if (!head) return NULL;