diff --git a/src/order_base.h b/src/order_base.h index 79c5e96e1f..cd6b56c078 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -1049,7 +1049,7 @@ public: void DebugCheckSanity() const; #endif bool CheckOrderListIndexing() const; - + inline std::vector &GetScheduledDispatchScheduleSet() { return this->dispatch_schedules; } inline const std::vector &GetScheduledDispatchScheduleSet() const { return this->dispatch_schedules; } diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 4d3509e863..5c0067b7df 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -43,6 +43,7 @@ #include "date_func.h" #include "3rdparty/nlohmann/json.hpp" #include "command_aux.h" +#include "rev.h" #include "table/strings.h" @@ -925,9 +926,13 @@ void OrderList::MoveOrder(int from, int to) std::string OrderList::ToJSONString() { + nlohmann::json json; - auto& SD_data = this->GetScheduledDispatchScheduleSet(); + json["version"] = ORDERLIST_JSON_OUTPUT_VERSION; + json["source"] = std::string(_openttd_revision); + + auto& SD_data = this->GetScheduledDispatchScheduleSet(); auto& headJson = json["head"]; for (unsigned int i = 0; auto &SD : SD_data) { diff --git a/src/order_type.h b/src/order_type.h index 8d2d36ebed..ee988a161c 100644 --- a/src/order_type.h +++ b/src/order_type.h @@ -313,6 +313,8 @@ enum CloneOptions { CO_UNSHARE = 2 }; +const uint8_t ORDERLIST_JSON_OUTPUT_VERSION = 1; + struct Order; struct OrderList;