Changeset - r13755:bf4fbd1c24d2
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-11-25 22:58:28
rubidium@openttd.org
(svn r18290) -Codechange: be more strict about what vehicles may use timetables
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/timetable_cmd.cpp
Show inline comments
 
@@ -64,13 +64,13 @@ CommandCost CmdChangeTimetable(TileIndex
 
{
 
	if (!_settings_game.order.timetabling) return CMD_ERROR;
 

	
 
	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);
 
	if (order == NULL) return CMD_ERROR;
 

	
 
	bool packed_time = HasBit(p1, 25);
 
@@ -124,16 +124,17 @@ CommandCost CmdSetVehicleOnTime(TileInde
 
{
 
	if (!_settings_game.order.timetabling) return CMD_ERROR;
 

	
 
	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();
 
}
 

	
 
/**
 
@@ -153,13 +154,13 @@ CommandCost CmdAutofillTimetable(TileInd
 
{
 
	if (!_settings_game.order.timetabling) return CMD_ERROR;
 

	
 
	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)) {
 
			/* Start autofilling the timetable, which clears the
 
			 * "timetable has started" bit. Times are not cleared anymore, but are
 
			 * overwritten when the order is reached now. */
0 comments (0 inline, 0 general)