summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-25 22:58:28 +0000
committerrubidium <rubidium@openttd.org>2009-11-25 22:58:28 +0000
commitd3a925af42e8e5ce01a63a57dfd57c0ed99a6c96 (patch)
tree3bd3e0c9f09c79618cfcad21170ef4de51da38a9 /src
parentbd39a3b4c485f4a850e6e515b5216c91042e7edc (diff)
downloadopenttd-d3a925af42e8e5ce01a63a57dfd57c0ed99a6c96.tar.xz
(svn r18290) -Codechange: be more strict about what vehicles may use timetables
Diffstat (limited to 'src')
-rw-r--r--src/timetable_cmd.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 66e2da480..e8018a0ca 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -67,7 +67,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1, u
VehicleID veh = GB(p1, 0, 16);
Vehicle *v = Vehicle::GetIfValid(veh);
- if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v == NULL || !CheckOwnership(v->owner) || !v->IsPrimaryVehicle()) return CMD_ERROR;
VehicleOrderID order_number = GB(p1, 16, 8);
Order *order = v->GetOrder(order_number);
@@ -127,10 +127,11 @@ CommandCost CmdSetVehicleOnTime(TileIndex tile, DoCommandFlag flags, uint32 p1,
VehicleID veh = GB(p1, 0, 16);
Vehicle *v = Vehicle::GetIfValid(veh);
- if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v == NULL || !CheckOwnership(v->owner) || !v->IsPrimaryVehicle()) return CMD_ERROR;
if (flags & DC_EXEC) {
v->lateness_counter = 0;
+ SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
}
return CommandCost();
@@ -156,7 +157,7 @@ CommandCost CmdAutofillTimetable(TileIndex tile, DoCommandFlag flags, uint32 p1,
VehicleID veh = GB(p1, 0, 16);
Vehicle *v = Vehicle::GetIfValid(veh);
- if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v == NULL || !CheckOwnership(v->owner) || !v->IsPrimaryVehicle()) return CMD_ERROR;
if (flags & DC_EXEC) {
if (HasBit(p2, 0)) {