train_cmd.c
changeset 3411 72993ac027ea
parent 3390 ae4b0872dc78
child 3455 fc1fb215e35b
equal deleted inserted replaced
3410:84e2294eac5a 3411:72993ac027ea
   721 
   721 
   722 	rvi = RailVehInfo(p1);
   722 	rvi = RailVehInfo(p1);
   723 	e = GetEngine(p1);
   723 	e = GetEngine(p1);
   724 
   724 
   725 	/* Check if depot and new engine uses the same kind of tracks */
   725 	/* Check if depot and new engine uses the same kind of tracks */
   726 	if (!IsCompatibleRail(e->railtype, GetRailType(tile))) return CMD_ERROR;
   726 	/* We need to see if the engine got power on the tile to avoid eletric engines in non-electric depots */
       
   727 	if (!HasPowerOnRail(e->railtype, GetRailType(tile))) return CMD_ERROR;
   727 
   728 
   728 	if (rvi->flags & RVI_WAGON) return CmdBuildRailWagon(p1, tile, flags);
   729 	if (rvi->flags & RVI_WAGON) return CmdBuildRailWagon(p1, tile, flags);
   729 
   730 
   730 	value = EstimateTrainCost(rvi);
   731 	value = EstimateTrainCost(rvi);
   731 
   732