Skip to content

Commit

Permalink
Added Rename ride function to address issue #125 (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manticore-007 authored Nov 23, 2024
1 parent db30c6f commit 3ca540b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ui/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,4 +501,4 @@ function positionSpinner(params: LabelledSpinnerParams & FlexiblePosition): Widg
params.tooltip = "The fantastic map location of your vehicle and where to find it. Only works when the vehicle is not moving.";
params._noDisabledMessage = true;
return labelSpinner(params);
}
}
29 changes: 27 additions & 2 deletions src/ui/rideWindow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkbox, compute, dropdown, DropdownParams, FlexiblePosition, groupbox, label, LabelParams, WidgetCreator, window } from "openrct2-flexui";
import { button, checkbox, compute, dropdown, DropdownParams, FlexiblePosition, groupbox, label, LabelParams, WidgetCreator, window } from "openrct2-flexui";
import { ParkRide } from "../objects/parkRide";
import { setBuildMonth, setBuildYear, setCustomDesign, setExcitementRating, setFrozenRatings, setIndestructable, setIntensityRating, setNauseaRating } from "../services/rideEditor";
import { formatRelativeDate, getDateMonth, getDateYear, monthNames } from "../utilities/date";
Expand All @@ -9,6 +9,7 @@ import { labelled, labelledSpinner, LabelledSpinnerParams, multiplier } from "./

const int16max = 32_767, int16min = -32_768;
const controlsLabelWidth = 85;
const buttonSize = 24;


/**
Expand All @@ -24,7 +25,7 @@ export const rideWindow = window({
title: model._title,
position: "center",
width: { value: 233, min: 185, max: 250 },
height: 252,
height: 322,
colours: [ 24, 24 ],
onOpen: () => model._open(),
onClose: () => model._close(),
Expand Down Expand Up @@ -115,6 +116,30 @@ export const rideWindow = window({
})
]
}),
groupbox({
text: "Ride name",
tooltip: "Edit the name of the ride",
content: [
label({
text: model._title,
}),
button({
text: "Rename ride",
height: buttonSize,
onClick: () => {
ui.showTextInput({
title: "Ride/attraction name",
initialValue: model._title.get(),
description: "Enter new name for this ride/attraction:",
callback: (input) => {
const ride = model._ride.get();
if (ride) context.executeAction("ridesetname", {ride: ride._id, name: input});
}
});
}
})
]
}),
multiplier(model._multiplierIndex)
]
});
Expand Down

0 comments on commit 3ca540b

Please sign in to comment.