165 |
165 |
166 // check depot first |
166 // check depot first |
167 if (_patches.gotodepot) { |
167 if (_patches.gotodepot) { |
168 switch (GetTileType(tile)) { |
168 switch (GetTileType(tile)) { |
169 case MP_RAILWAY: |
169 case MP_RAILWAY: |
170 if (v->type == VEH_Train && _map_owner[tile] == _local_player) { |
170 if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) { |
171 if ((_map5[tile]&0xFC)==0xC0) { |
171 if ((_map5[tile]&0xFC)==0xC0) { |
172 order.type = OT_GOTO_DEPOT; |
172 order.type = OT_GOTO_DEPOT; |
173 order.flags = OF_PART_OF_ORDERS; |
173 order.flags = OF_PART_OF_ORDERS; |
174 order.station = GetDepotByTile(tile)->index; |
174 order.station = GetDepotByTile(tile)->index; |
175 return order; |
175 return order; |
176 } |
176 } |
177 } |
177 } |
178 break; |
178 break; |
179 |
179 |
180 case MP_STREET: |
180 case MP_STREET: |
181 if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && _map_owner[tile] == _local_player) { |
181 if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && IsTileOwner(tile, _local_player)) { |
182 order.type = OT_GOTO_DEPOT; |
182 order.type = OT_GOTO_DEPOT; |
183 order.flags = OF_PART_OF_ORDERS; |
183 order.flags = OF_PART_OF_ORDERS; |
184 order.station = GetDepotByTile(tile)->index; |
184 order.station = GetDepotByTile(tile)->index; |
185 return order; |
185 return order; |
186 } |
186 } |
187 break; |
187 break; |
188 |
188 |
189 case MP_STATION: |
189 case MP_STATION: |
190 if (v->type != VEH_Aircraft) break; |
190 if (v->type != VEH_Aircraft) break; |
191 if ( IsAircraftHangarTile(tile) && _map_owner[tile] == _local_player) { |
191 if (IsAircraftHangarTile(tile) && IsTileOwner(tile, _local_player)) { |
192 order.type = OT_GOTO_DEPOT; |
192 order.type = OT_GOTO_DEPOT; |
193 order.flags = OF_PART_OF_ORDERS | OF_NON_STOP; //XXX - whats the nonstop stuff doing here? |
193 order.flags = OF_PART_OF_ORDERS | OF_NON_STOP; //XXX - whats the nonstop stuff doing here? |
194 order.station = _map2[tile]; |
194 order.station = _map2[tile]; |
195 return order; |
195 return order; |
196 } |
196 } |
214 break; |
214 break; |
215 } |
215 } |
216 } |
216 } |
217 |
217 |
218 // check waypoint |
218 // check waypoint |
219 if (IsTileType(tile, MP_RAILWAY) |
219 if (IsTileType(tile, MP_RAILWAY) && |
220 && v->type == VEH_Train |
220 v->type == VEH_Train && |
221 && _map_owner[tile] == _local_player |
221 IsTileOwner(tile, _local_player) && |
222 && (_map5[tile]&0xFE)==0xC4) { |
222 (_map5[tile] & 0xFE) == 0xC4) { |
223 order.type = OT_GOTO_WAYPOINT; |
223 order.type = OT_GOTO_WAYPOINT; |
224 order.flags = 0; |
224 order.flags = 0; |
225 order.station = GetWaypointByTile(tile)->index; |
225 order.station = GetWaypointByTile(tile)->index; |
226 return order; |
226 return order; |
227 } |
227 } |