Skip to content

Commit 3ca540b

Browse files
Added Rename ride function to address issue #125 (#126)
1 parent db30c6f commit 3ca540b

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/ui/mainWindow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,4 @@ function positionSpinner(params: LabelledSpinnerParams & FlexiblePosition): Widg
501501
params.tooltip = "The fantastic map location of your vehicle and where to find it. Only works when the vehicle is not moving.";
502502
params._noDisabledMessage = true;
503503
return labelSpinner(params);
504-
}
504+
}

src/ui/rideWindow.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { checkbox, compute, dropdown, DropdownParams, FlexiblePosition, groupbox, label, LabelParams, WidgetCreator, window } from "openrct2-flexui";
1+
import { button, checkbox, compute, dropdown, DropdownParams, FlexiblePosition, groupbox, label, LabelParams, WidgetCreator, window } from "openrct2-flexui";
22
import { ParkRide } from "../objects/parkRide";
33
import { setBuildMonth, setBuildYear, setCustomDesign, setExcitementRating, setFrozenRatings, setIndestructable, setIntensityRating, setNauseaRating } from "../services/rideEditor";
44
import { formatRelativeDate, getDateMonth, getDateYear, monthNames } from "../utilities/date";
@@ -9,6 +9,7 @@ import { labelled, labelledSpinner, LabelledSpinnerParams, multiplier } from "./
99

1010
const int16max = 32_767, int16min = -32_768;
1111
const controlsLabelWidth = 85;
12+
const buttonSize = 24;
1213

1314

1415
/**
@@ -24,7 +25,7 @@ export const rideWindow = window({
2425
title: model._title,
2526
position: "center",
2627
width: { value: 233, min: 185, max: 250 },
27-
height: 252,
28+
height: 322,
2829
colours: [ 24, 24 ],
2930
onOpen: () => model._open(),
3031
onClose: () => model._close(),
@@ -115,6 +116,30 @@ export const rideWindow = window({
115116
})
116117
]
117118
}),
119+
groupbox({
120+
text: "Ride name",
121+
tooltip: "Edit the name of the ride",
122+
content: [
123+
label({
124+
text: model._title,
125+
}),
126+
button({
127+
text: "Rename ride",
128+
height: buttonSize,
129+
onClick: () => {
130+
ui.showTextInput({
131+
title: "Ride/attraction name",
132+
initialValue: model._title.get(),
133+
description: "Enter new name for this ride/attraction:",
134+
callback: (input) => {
135+
const ride = model._ride.get();
136+
if (ride) context.executeAction("ridesetname", {ride: ride._id, name: input});
137+
}
138+
});
139+
}
140+
})
141+
]
142+
}),
118143
multiplier(model._multiplierIndex)
119144
]
120145
});

0 commit comments

Comments
 (0)