2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
|
|
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file timetable.h Functions related to time tabling. */
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
#ifndef TIMETABLE_H
|
|
|
|
#define TIMETABLE_H
|
|
|
|
|
2009-11-21 12:43:09 +00:00
|
|
|
#include "date_type.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "vehicle_type.h"
|
2020-07-09 01:09:46 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <tuple>
|
2009-11-21 12:43:09 +00:00
|
|
|
|
2007-06-20 19:26:25 +00:00
|
|
|
void ShowTimetableWindow(const Vehicle *v);
|
|
|
|
void UpdateVehicleTimetable(Vehicle *v, bool travelling);
|
2021-11-24 02:12:19 +00:00
|
|
|
void SetTimetableParams(int first_param, Ticks ticks, bool long_mode = false);
|
2022-01-15 00:21:31 +00:00
|
|
|
void SetTimetableWindowsDirty(const Vehicle *v, bool include_scheduled_dispatch = false);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2020-07-09 01:09:46 +00:00
|
|
|
struct TimetableProgress {
|
|
|
|
VehicleID id;
|
|
|
|
int order_count;
|
|
|
|
int order_ticks;
|
|
|
|
int cumulative_ticks;
|
|
|
|
|
|
|
|
bool IsValidForSeparation() const { return this->cumulative_ticks >= 0; }
|
2021-08-04 16:33:12 +00:00
|
|
|
bool operator<(const TimetableProgress& other) const { return std::tie(this->order_count, this->order_ticks, this->id) < std::tie(other.order_count, other.order_ticks, other.id); }
|
2020-07-09 01:09:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<TimetableProgress> PopulateSeparationState(const Vehicle *v_start);
|
|
|
|
|
2007-06-20 19:26:25 +00:00
|
|
|
#endif /* TIMETABLE_H */
|