(svn r10875) [NewGRF_ports] -Fix: Terminals were not being selected from the right terminal groups when there was more than one terminal group. NewGRF_ports
authorrichk
Mon, 13 Aug 2007 09:18:12 +0000
branchNewGRF_ports
changeset 6803 fa73eb091452
parent 6802 7e514feeb604
child 6804 2772178ef0d7
(svn r10875) [NewGRF_ports] -Fix: Terminals were not being selected from the right terminal groups when there was more than one terminal group.
-Change: ChooseTerminal and ChooseHelipad now indicated by heading = 0x7E, and 0x7D respectively.
src/aircraft_cmd.cpp
--- a/src/aircraft_cmd.cpp	Sun Aug 12 21:50:07 2007 +0000
+++ b/src/aircraft_cmd.cpp	Mon Aug 13 09:18:12 2007 +0000
@@ -2041,7 +2041,7 @@
 		AirportFTA *temp = apc->layout[v->u.air.pos].next;
 
 		while (temp != NULL) {
-			if (temp->heading == 255) {
+			if (temp->heading == 0x7E) {
 				if (!st->airport_flags.HasBlocks(&temp->reserveblock)) {
 					/* read which group do we want to go to?
 					 * (the first free group) */
@@ -2056,15 +2056,12 @@
 					}
 
 					uint group_end = group_start + apc->terminals[target_group];
-					if (FreeTerminal(v, group_start, group_end)) return true;
+					if (FreeTerminal(v, group_start + 1, group_end)) return true;
 				}
-			} else {
-				/* once the heading isn't 255, we've exhausted the possible blocks.
-				 * So we cannot move */
-				return false;
 			}
 			temp = temp->next;
 		}
+		return false;
 	}
 
 	/* if there is only 1 terminalgroup, all terminals are checked (starting from 1 to max) */
@@ -2090,7 +2087,7 @@
 		AirportFTA* temp = apc->layout[v->u.air.pos].next;
 
 		while (temp != NULL) {
-			if (temp->heading == 255) {
+			if (temp->heading == 0x7D) {
 				if (!st->airport_flags.HasBlocks(&temp->reserveblock)) {
 
 					/* read which group do we want to go to?
@@ -2108,13 +2105,10 @@
 					uint group_end = group_start + apc->helipads[target_group];
 					if (FreeTerminal(v, group_start, group_end)) return true;
 				}
-			} else {
-				/* once the heading isn't 255, we've exhausted the possible blocks.
-				 * So we cannot move */
-				return false;
 			}
 			temp = temp->next;
 		}
+		return false;
 	} else {
 		/* only 1 helicoptergroup, check all helipads
 		 * The blocks for helipads start after the last terminal (MAX_TERMINALS) */