@@ -2,8 +2,7 @@ import { Store } from "openrct2-flexui";
22import { isMultiplayer } from "../environment" ;
33import { getCarById , RideVehicle } from "../objects/rideVehicle" ;
44import * as Log from "../utilities/logger" ;
5- import { getTileElement } from "../utilities/map" ;
6- import { floor } from "../utilities/math" ;
5+ import { alignWithMap , getTileElement , toTileUnit } from "../utilities/map" ;
76import { cancelCurrentTool , cancelTools } from "../utilities/tools" ;
87import { isNumber , isUndefined } from "../utilities/type" ;
98import { register } from "./actions" ;
@@ -209,8 +208,9 @@ function updateVehicleDrag(args: DragVehicleArgs): void
209208
210209 const position = args . position ;
211210 const progress = position . progress ;
212- if ( isNumber ( position . trackElementIndex ) && isNumber ( progress ) ) {
213- car . moveToTrack ( tileCoordinate ( position . x ) , tileCoordinate ( position . y - 16 ) , position . trackElementIndex ) ;
211+ if ( isNumber ( position . trackElementIndex ) && isNumber ( progress ) )
212+ {
213+ car . moveToTrack ( toTileUnit ( position . x ) , toTileUnit ( position . y ) , position . trackElementIndex ) ;
214214 car . travelBy ( getDistanceFromProgress ( car , progress - car . trackProgress ) ) ;
215215 }
216216 else
@@ -222,19 +222,3 @@ function updateVehicleDrag(args: DragVehicleArgs): void
222222
223223 invoke ( refreshVehicle , id ) ;
224224}
225-
226- /**
227- * Align the coordinate with the edge of a map tile.
228- */
229- function alignWithMap ( coordinate : number ) : number
230- {
231- return floor ( coordinate / 32 ) * 32 ;
232- }
233-
234- /**
235- * Align the coordinate with the edge of a map tile.
236- */
237- function tileCoordinate ( coordinate : number ) : number
238- {
239- return floor ( coordinate / 32 ) ;
240- }
0 commit comments