equal
deleted
inserted
replaced
3044 |
3044 |
3045 if (!TrainCheckIfLineEnds(v)) return; |
3045 if (!TrainCheckIfLineEnds(v)) return; |
3046 |
3046 |
3047 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y); |
3047 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y); |
3048 if (r & 0x8) { |
3048 if (r & 0x8) { |
3049 //debug("%x & 0x8", r); |
3049 DEBUG(misc, 2, "%x & 0x8 (in tile)", r); |
3050 goto invalid_rail; |
3050 goto invalid_rail; |
3051 } |
3051 } |
3052 if (r & 0x2) { |
3052 if (r & 0x2) { |
3053 TrainEnterStation(v, r >> 8); |
3053 TrainEnterStation(v, r >> 8); |
3054 return; |
3054 return; |
3083 * can be switched on halfway a turn */ |
3083 * can be switched on halfway a turn */ |
3084 bits &= ~TrackCrossesTracks(FIND_FIRST_BIT(v->u.rail.track)); |
3084 bits &= ~TrackCrossesTracks(FIND_FIRST_BIT(v->u.rail.track)); |
3085 } |
3085 } |
3086 |
3086 |
3087 if (bits == 0) { |
3087 if (bits == 0) { |
3088 //debug("%x == 0", bits); |
3088 DEBUG(misc, 2, "%x == 0", bits); |
3089 goto invalid_rail; |
3089 goto invalid_rail; |
3090 } |
3090 } |
3091 |
3091 |
3092 /* Check if the new tile contrains tracks that are compatible |
3092 /* Check if the new tile contrains tracks that are compatible |
3093 * with the current train, if not, bail out. */ |
3093 * with the current train, if not, bail out. */ |
3094 if (!CheckCompatibleRail(v, gp.new_tile)) { |
3094 if (!CheckCompatibleRail(v, gp.new_tile)) { |
3095 //debug("!CheckCompatibleRail(%p, %x)", v, gp.new_tile); |
3095 DEBUG(misc, 2, "!CheckCompatibleRail(%p, %x)", v, gp.new_tile); |
3096 goto invalid_rail; |
3096 goto invalid_rail; |
3097 } |
3097 } |
3098 |
3098 |
3099 if (prev == NULL) { |
3099 if (prev == NULL) { |
3100 /* Currently the locomotive is active. Determine which one of the |
3100 /* Currently the locomotive is active. Determine which one of the |
3123 } |
3123 } |
3124 |
3124 |
3125 /* Call the landscape function and tell it that the vehicle entered the tile */ |
3125 /* Call the landscape function and tell it that the vehicle entered the tile */ |
3126 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y); |
3126 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y); |
3127 if (r & 0x8) { |
3127 if (r & 0x8) { |
3128 //debug("%x & 0x8", r); |
3128 DEBUG(misc, 2, "%x & 0x8 (new tile)", r); |
3129 goto invalid_rail; |
3129 goto invalid_rail; |
3130 } |
3130 } |
3131 |
3131 |
3132 if (IsLevelCrossingTile(v->tile) && v->next == NULL) { |
3132 if (IsLevelCrossingTile(v->tile) && v->next == NULL) { |
3133 UnbarCrossing(v->tile); |
3133 UnbarCrossing(v->tile); |