From adaf9769fc8c99922939e7b7ab7872eb40754eda Mon Sep 17 00:00:00 2001
From: koroal <98806009+koroal@users.noreply.github.com>
Date: Tue, 29 Nov 2022 14:40:57 +0300
Subject: [PATCH 1/4] FIX invert schedule function not working properly

The middle pair of waypoints didn't swap when there
were an even number of waypoints in the schedule.
---
 src/simutrans/dataobj/schedule.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/simutrans/dataobj/schedule.cc b/src/simutrans/dataobj/schedule.cc
index b5bb5684b..097b15b23 100644
--- a/src/simutrans/dataobj/schedule.cc
+++ b/src/simutrans/dataobj/schedule.cc
@@ -492,7 +492,7 @@ void schedule_t::add_return_way(bool append_mirror)
 	else {
 		// invert
 		if(  entries.get_count()>1  ) {
-			for(  uint8 i=0;  i<(entries.get_count()-1)/2;  i++  ) {
+			for(  uint8 i=0;  i<entries.get_count()/2;  i++  ) {
 				schedule_entry_t temp = entries[i];
 				entries[i] = entries[entries.get_count()-i-1];
 				entries[ entries.get_count()-i-1] = temp;
-- 
2.38.1

