Auto separation

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Auto separation

Post by pavel1269 » 18 Jul 2014 15:39

Another auto separation patch. I tried to use the slim auto separation and some other one but I am constantly running into issues I don't like and I don't want to handle them by hand or worse, check if it even works. This version does not need any timetabling, it uses the implicit route times and as such, it handles changes of routes pretty well as it does not need times in timetable to be adjusted by hand. Also I am not setting vehicles to be late to catch up as they probably won't manage that anyway and instead I set others that they are early. The whole synchronization is happening at the first order and as such I heavily recommend to timetable that one, because waiting vehicles will change the implicit value accordingly which is not desired (it makes the whole route looks longer than it is).

Problem(s): -

edit: Problem solved, patch updated.
edit2: Patch which works with my day length patch now included as well.
Attachments
auto_sep_r26686.patch
(10.47 KiB) Downloaded 164 times
auto_sep_r26686-day_length.patch
(11.86 KiB) Downloaded 140 times

User avatar
Pyoro
Tycoon
Tycoon
Posts: 2472
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Auto separation

Post by Pyoro » 14 Sep 2014 11:05

Just wanted to say that it seems to be working. ;) Sort of would've expected the DL one to come with the DL-patch itself, but otherwise straightforward in application and use ^^

User avatar
pavel1269
Route Supervisor
Route Supervisor
Posts: 473
Joined: 03 Dec 2006 13:22
Location: Czech Republic
Contact:

Re: Auto separation

Post by pavel1269 » 14 Sep 2014 19:19

One one hand you are right, the "my DL" compatible version doesn't work standalone and as such it could be merged. On the other hand, if anyone would use my true day length patch already (own patch pack usually I guess), it would just complicate things.

Also thanks for the feedback as now I know at least about one person which is running this patch and it seems to work not just for me :) .

User avatar
Pyoro
Tycoon
Tycoon
Posts: 2472
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Auto separation

Post by Pyoro » 29 Jun 2017 18:28

dunno if anyone is still using this, but it still works with a few small changes:
For src/saveload/order_sl.cpp the CONDVARs need to be VARs

Code: Select all

+		SLE_REF(OrderList, first,              REF_ORDER),
+		SLE_VAR(OrderList, auto_separation,    SLE_BOOL,   200, SL_MAX_VERSION),
+		SLE_VAR(OrderList, separation_valid,   SLE_BOOL,   200, SL_MAX_VERSION),
+		SLE_VAR(OrderList, next_vehicle_ticks, SLE_UINT16, 200, SL_MAX_VERSION),
+		SLE_END()
And the error message thing goes elsewhere now, if I got this right:
Needs to be removed in src/timetable_gui.cpp:

Code: Select all

+
+			case WID_VT_AUTO_SEPARATION:
+				uint32 p2 = 0;
+				if (!v->orders.list->GetAutoSeparated()) SetBit(p2, 0);
+				DoCommandP(0, v->index, p2, CMD_TOGGLE_AUTO_SEPARATION);
+				FOR_ALL_VEHICLES(v) {
+					SetWindowDirty(WC_VEHICLE_TIMETABLE, v->index);
+				}
+				break;
and added in command.cpp:

Code: Select all

+	DEF_CMD(CmdToggleAutoSeparation,							   0, CMDT_ROUTE_MANAGEMENT,	   NULL,			   GetErrConstant<STR_ERROR_CAN_T_TIMETABLE_VEHICLE>), 		   // CMD_TOGGLE_AUTO_SEPARATION

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 5 guests